Shows a white page at the end of generated document

Hi,

I have been using three html templates to generate one PDF document as cover page, content pages and end pages. But, recently there is an issue where my document shows an extra white page at the end of the document.

Since It comes after end page I viewed it with google chrome print option it seems to be fine. And now I can't see any problem with the template either.

This is the code for converting and attaching the end pages :

private PdfDocument AddEndCoverPage(string endCoverPage, PdfDocument PdfWithCoverPage, PdfPageOrientation pdfPageOrientation, SizeF pdfPageSize, Manifest manifest)

{

    try

    {


        HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.Blink);

        BlinkConverterSettings blinkConverterSettings = new BlinkConverterSettings();

        blinkConverterSettings.CommandLineArguments.Add("--no-sandbox");

        blinkConverterSettings.CommandLineArguments.Add("--disable-setuid-sandbox");

        //blinkConverterSettings.ViewPortSize = new Syncfusion.Drawing.Size(1024, 0);

        blinkConverterSettings.ViewPortSize = new Syncfusion.Drawing.Size(manifest.Input.PageSetup.ViewPortSize.CoverPages.Height, manifest.Input.PageSetup.ViewPortSize.CoverPages.Width);

        blinkConverterSettings.Orientation = pdfPageOrientation;

        blinkConverterSettings.PdfPageSize = pdfPageSize;

        blinkConverterSettings.Margin.All = 0;

        blinkConverterSettings.EnableJavaScript = manifest.EnableJavaScript;

        htmlConverter.ConverterSettings = blinkConverterSettings;


        PdfDocument documentEndCoverPage = htmlConverter.Convert(endCoverPage, "");

        MemoryStream stream = new MemoryStream();

        documentEndCoverPage.Save(stream);

        documentEndCoverPage.Close(true);


        PdfLoadedDocument loadedDocument = new PdfLoadedDocument(stream);

        PdfWithCoverPage.Append(loadedDocument);

        return PdfWithCoverPage;

    }

    catch (Exception ex)

    {

        throw new Exception(ex.Message);

    }

}

 


Attachment: Resources_5f2ef1ec.zip

3 Replies

AM Arumugam Muppidathi Syncfusion Team August 26, 2024 03:25 PM UTC

Hi Duminda,


Thank you for reaching out to Syncfusion support.

 

We have checked your issue on our end.  Unfortunately, the issue was not reproduced.  The reported issue may occur for particular HTML document or properties.  We kindly request you to share the complete sample, input HTML file with all resources and reproducible sample with us to replicate the same issue on our end and provide a prompt solution.


Regards,
Arumugam M



DJ Duminda Jayasuriya August 28, 2024 04:06 AM UTC

Hi Arumugam M,


I have attached resources here with.


Thank you,


Attachment: AddoLastPageResources_3e4b7807.zip


AM Arumugam Muppidathi Syncfusion Team August 28, 2024 02:00 PM UTC

Hi Duminda,


We have checked the provided document on our end.  We have tried all the possibilities to replicate the reported issue.  Unfortunately, the issue was not reproduced.  However, we have attached the tried sample below for your reference.

Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/HTML-to-PDF-1740109591

Please try the above sample and let us know the result.  We kindly request you to share the steps to reproduce the reported issue or reproducible sample with us to replicate the same issue on our end and provide a prompt solution.


Regards,
Arumugam M


Loader.
Up arrow icon