Thickness of lines in PDF file is much too wide compared to the printout

You may have noticed that when printing a report to PDF which is having a layout that is using shapes or lines, then there are some differences between the PDF an the printout.

The thickness of the lines in the PDF file is much too wide compared to the printout.

When having a look to the code the I can see that the thickness of the lines is defined in the method borderWidth on the class PDFViewer.

private int borderWidth(LineThickness thickness, LineType lt)
    int retval = 0;

    if (lt == LineType::None)
        return 0;
    switch (thickness)
    case LineThickness::Hairline    : retval = 35; break;
    case LineThickness::pt1         : retval = 35; break;
    case LineThickness::pt2         : retval = 71; break;
    case LineThickness::pt3         : retval = 106; break;
    case LineThickness::pt4         : retval = 141; break;
    case LineThickness::pt5         : retval = 176; break;
    case LineThickness::pt6         : retval = 212; break;
    if (lt == LineType::Double)
        retval = retval * 3;    // Space for two lines and a blank line in between

    return retval;

I have then changed the thickness to the following values which were looking best to me

    switch (thickness)
    case LineThickness::Hairline    : retval = 8; break;
    case LineThickness::pt1         : retval = 10; break;
    case LineThickness::pt2         : retval = 20; break;
    case LineThickness::pt3         : retval = 30; break;
    case LineThickness::pt4         : retval = 40; break;
    case LineThickness::pt5         : retval = 50; break;
    case LineThickness::pt6         : retval = 60; break;

--author: Daniel Durrer
--editor: Daniel Durrer
--date: 22-10-2010

Comments (3)

  1. Jonas Bergman says:


    Thanks for this post. I have been a bit annoyed by the thick lines.

    (first i did not find the class you mentioned, until I noticed that the correct class name is PdfViewer)

    Your fix works with some reports, but in a few other custom reports some thinner lines suddenly disappear. It could be worth mentioning, so that anyone who uses this code checks their reports after the fix.


  2. Hi Jonas

    Sorry for the confusion!

    I have corrected the class name now.


  3. Jonas Bergman says:

    One more thing. I don´t know if this could be of interest, but since I don´t have the time to open up a new case right now…

    I downloaded fix 983217 today, since one customer experienced distorted company logos when creating pdfs.

    The method writeBitmap was changed in that fix, but it contains errors.

    The first thing is that the two lines asserting write permissions for jpg/bmp files have been mixed up. These lines grant write permission for the wrong file. After permission is granted for the file fn, the bmpImage file is written. And the other way around.

    The second thing that we discovered a while ago is that the line

    WinAPI::getTempFilename(WinAPI::getTempPath(), 'AXP') does not work when running the code on a 64 bit machine (some kind of exception, that I can´t remember right now). That might have been corrected in a later kernel (after SP1), I don´t know. We had to use System.IO.Path::GetTempFileName() to fix this problem and have not bothered to report this to MS.

Skip to main content