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

Margin appearing near the bottom of page causes react pdf to hang #2996

Open
JDGarner opened this issue Dec 10, 2024 · 0 comments
Open

Margin appearing near the bottom of page causes react pdf to hang #2996

JDGarner opened this issue Dec 10, 2024 · 0 comments

Comments

@JDGarner
Copy link

Describe the bug
When margin is added on an element and displays at the bottom of the page in certain conditions, react pdf hangs forever.

To Reproduce
This code will cause react-pdf to hang:

import { Document, Page, PDFViewer, View } from "@react-pdf/renderer";
import ReactDOM from "react-dom/client";

const ExamplePDF = () => {
  return (
    <PDFViewer width="100%" height={window.innerHeight}>
      <Document>
        <Page size="A4" debug style={{ paddingBottom: 50 }}>
          <View debug fixed style={{ height: 114 }} />
          <View debug style={{ height: 659, marginBottom: 24 }} />
          <View debug style={{ height: 80 }} />
        </Page>
      </Document>
    </PDFViewer>
  );
};

const root = ReactDOM.createRoot(document.getElementById("root") as HTMLElement);
root.render(<ExamplePDF />);

If you change the marginBottom: 24 to paddingBottom: 24 then it works.
It also hangs on the REPL

Expected behavior
It can render the margin at the bottom of the page and not hang

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: MacOS
  • Browser: Chrome
  • React-pdf version: 3.4.2 (It is also broken on the REPL)
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