DinkToPdf icon indicating copy to clipboard operation
DinkToPdf copied to clipboard

Small contents in PDF

Open aram-aramyan opened this issue 3 years ago • 2 comments

Platform: Windows 10 x64 Paper size is 100m x 50 mm ~= 3.97in x 1.97in

The page contains an image with style="width: 98mm". The resulting PDF shows ~20% smaller image. theimage

When I set img style="width: 120mm" then I get almost what I need.

I've tried removing everything and just drawing some hr style="width: 100mm" ... hr style="width: 130mm". In that case only 130mm comes to look like it should be.

var doc = new HtmlToPdfDocument()
            {
                GlobalSettings =
                {
                    ColorMode = ColorMode.Grayscale,
                    PaperSize = new PechkinPaperSize("3.97in", "1.97in"),
                    Margins = new MarginSettings(0,0,0,0),
                    Out = filePath
                },
                Objects = {
                    new ObjectSettings() {
                        HtmlContent = htmlContents,
                        WebSettings = { DefaultEncoding = "utf-8" }
                    }
                }
            };

            _converter.Convert(doc);

Found this: https://github.com/rdvojmoc/DinkToPdf/issues/42 Tried adjusting Dpi to 380/600 Nothing changed

aram-aramyan avatar Jun 21 '21 22:06 aram-aramyan

You can play with ObjectSettings.LoadSettings.ZoomFactor setting

TropinAlexey avatar Aug 10 '22 10:08 TropinAlexey

You can play with ObjectSettings.LoadSettings.ZoomFactor setting

That worked for me (1.25).

DmitrySikorsky avatar Nov 15 '22 20:11 DmitrySikorsky