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

multiple page in mobile device #761

Open
samirahosseini937 opened this issue Oct 28, 2024 · 2 comments
Open

multiple page in mobile device #761

samirahosseini937 opened this issue Oct 28, 2024 · 2 comments

Comments

@samirahosseini937
Copy link

samirahosseini937 commented Oct 28, 2024

i use this style

@media print {
  /* Hide all elements except the certificate */
  body * {
    visibility: hidden; /* Hide all elements */
    page-break-inside: avoid; /* Prevent breaking inside */
  }

  /* Show only the certificate */
  .certificate {
    visibility: visible;
    page-break-inside: avoid; /* Prevent breaking inside */
  }

  /* Ensure all children of the certificate are visible */
  .certificate * {
    visibility: visible;
  }
}

and print with

  const handlePrint = useReactToPrint({
    contentRef: certificateRef as React.MutableRefObject<HTMLElement>,
  });

why in mobile device create 5 page instead of one page

@MatthewHerbst
Copy link
Owner

Hello. Hard to debug without seeing more code. You also didn't say if it's working properly on desktop devices? Any chance you could make a Codesandbox or similar?

@samirahosseini937
Copy link
Author

In your CodeSandbox, the PDF creator shows the header on mobile

Preview - nodebox - CodeSandbox.PDF

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

2 participants