Skip to content

Random Extra space in between rows #94

Open

Description

@ayushgit2498

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

Activity

  1. ArjanKw commented on Nov 11, 2024

    @ArjanKw

    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.

  2. ayushgit2498 commented on Nov 12, 2024

    @ayushgit2498
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions