Microsoft Dynamics 365 Blog

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

We're always looking for feedback and would like to hear from you. Please head to the Dynamics 365 Community to start a discussion, ask questions, and tell us what you think!