DinkToPdf icon indicating copy to clipboard operation
DinkToPdf copied to clipboard

Nearly transparent images on multiple page pdfs

Open kurtyoder opened this issue 1 year ago • 2 comments

My images render perfectly if the pdf is a single page. If the pdf is longer than that, they are so transparent, they are barely visible.

This occurs when my image source is a file location or a base 64 string. Exporting the html content string to an html file displays the image correctly so it isn't something in my html.

Here is my doc model:

HtmlToPdfDocument doc = new()
     {
         GlobalSettings =
         {
             ColorMode = ColorMode.Color,
             Orientation = Orientation.Portrait,
             PaperSize = PaperKind.Letter,
             Margins = new(15, 15, 15, 15),
             DPI = 300,
             ImageDPI = 900,
             
         },
         
         Objects =
         {
             new ObjectSettings()
             {
                 PagesCount = true,
                 
                 HtmlContent = html,
                 
                 WebSettings = {DefaultEncoding = "utf-8", EnableIntelligentShrinking = false},
                 HeaderSettings = {FontSize = 8, Right = "Page [page] of [toPage]", Left = header, Line = true, Spacing = 2.812}
             }
         }
     };

kurtyoder avatar Jul 14 '22 22:07 kurtyoder

Any update for this problem ,I have the same problem cannot repeat the image in header of pages if i have more than one page @kurtyoder @gldraphael @rdvojmoc

islam-nady avatar Aug 28 '22 10:08 islam-nady

This happen to me a time ago while using a component from syncfusion. It was a weird bug from the webkit engine. I had almos transparent images when the image element were the first thing in the PDF document. The workaround i used was to put a label (or other element that prints something on screen) and made it invisble by setting a font or background color to match the page background color.

you can try that, it may help you with your issue

aaguileraThub avatar Aug 30 '22 20:08 aaguileraThub