Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

White line appears at page edges when setting background color in PDF #3040

Open
oguzkaganyaglioglu opened this issue Jan 17, 2025 · 0 comments

Comments

@oguzkaganyaglioglu
Copy link

When using Microsoft Edge, a thin white line appears at the edge of the page when setting a background color on a Page component. The position of the white line depends on the page orientation:

  • In landscape mode: white line appears at the bottom
  • In portrait mode: white line appears on the right side

Importantly, this issue is browser-specific and does not occur in Chrome.

Reproduction Steps

  1. Create a new React project with the following dependencies:
{
    "next": "^14.2.18",
    "@react-pdf/renderer": "^4.1.6"
}
  1. Implement the following component:
const PdfGenerator = () => {
  return (
    <PDFViewer width="100%" height="100%">
      <Document>
        <Page
          size="A4"
          orientation="landscape"
          style={{
            width: "100%",
            height: "100%",
            backgroundColor: "#000000",
            position: "absolute",
            top: 0,
            left: 0,
            right: 0,
            bottom: 0,
            margin: 0,
            padding: 0,
            border: "none",
          }}
        >
          <Text style={{ margin: 30, color: "#FFFFFF", fontSize: 14 }}>
            This is a page with a custom background color
          </Text>
        </Page>
      </Document>
    </PDFViewer>
  );
};
  1. Render the component in Microsoft Edge
  2. Observe the thin white line at the edge

Expected Behavior

The background color should extend fully to all edges of the page without any white lines appearing, as it does in Chrome.

Actual Behavior

In Microsoft Edge only:

  • A thin white line appears at the bottom edge in landscape orientation
  • A thin white line appears at the right edge in portrait orientation

The issue does not occur in Google Chrome, where the background renders correctly.

Environment

  • @react-pdf/renderer version: 4.1.6
  • Next.js version: 14.2.18
  • Browser: Microsoft Edge

Additional Notes

  • Issue is reproducible only in Microsoft Edge
  • Works as expected in Google Chrome
  • The white line appears consistently:
    • Despite absolute positioning
    • Despite zero margins and padding
    • Despite 100% width and height
    • With various background colors
  • The issue appears in both development and production builds

Additional Context

As it seen on the image there is a thin white line at the right side
Image

This is how I expect it to be

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant