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

Random Extra space in between rows #94

Open
ayushgit2498 opened this issue Oct 24, 2024 · 2 comments
Open

Random Extra space in between rows #94

ayushgit2498 opened this issue Oct 24, 2024 · 2 comments

Comments

@ayushgit2498
Copy link

I am generating a PDF using HTML and CSS in .NET 8, with the majority of the content consisting of tables. Occasionally, certain rows display extra spacing, despite all rows having identical CSS. This issue can happen randomly to any row, and after generating the PDF 5-6 times, the extra space might disappear, but it’s inconsistent. I tested rendering the same HTML and CSS as a webpage, and everything displays correctly as expected.

I’ve attached screenshots for reference.
First Image is of PDF
PDF Image

This second image is of web page having the same html and css
Web Page Image

@ArjanKw
Copy link

ArjanKw commented Nov 11, 2024

This project is a wrapper around wkhtmltopdf. Have you tried to run the HTML directly through wkhtmltopdf to see if the problem still persists? If so, this isn't an issue we are able to fix.

Wkhtmltopdf has multiple open issues regarding adding random extra spacing behind elements and might need additional setup to prevent spacing behind letters in special fonts.

You might get wkhtmltopdf to work by playing with the settings. In particular --disable-smart-shrinking, --enable-smart-shrinking and the Zoom property. The Zoom property is added as a Rotativa property in version 1.4.0, the other properties can be added as CustomSwitches:

return new ViewAsPdf()
{
    Zoom = 1,
    CustomSwitches = "--disable-smart-shrinking"
};

See the full list of switches here.

Wkhtmltopdf also doesn't work well with responsive CSS, you could try to eliminate that. You could also try to fix the height to a hard value. Please let us know your findings.

@ayushgit2498
Copy link
Author

Hey Arjan,

I tried everything that you mentioned but still the issue of random extra space did not get solved. I appreciate you taking the efforts to provide me with all the necessary links and solutions.

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