You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
This second image is of web page having the same html and css
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.
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:
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.
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.
Activity
ArjanKw commentedon 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:
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 commentedon Nov 12, 2024
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.