[ 
https://issues.apache.org/jira/browse/PDFBOX-4935?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17178352#comment-17178352
 ] 

Tilman Hausherr commented on PDFBOX-4935:
-----------------------------------------

Please try the code below, that does not use PDFBox. It prints the dpi. You may 
have to adjust the positions. If you have the same effect (always 72 dpi, even 
on a classic desktop printer) please submit a detailed bug report here: 
https://bugreport.java.com/bugreport/

If they tell you a JDK number (e.g. JDK-8175984) then please post it here. This 
can take a few days. I do have writing access to the bug tracker but I never 
submit bugs there directly, I prefer to use the ordinary channel so that all is 
kept in the format they use, besides they will likely have questions for you 
that I can't answer.

{code:java}
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.print.PageFormat;
import java.awt.print.Printable;
import java.awt.print.PrinterException;
import java.awt.print.PrinterJob;
import javax.print.PrintServiceLookup;

/**
 *
 * @author Tilman Hausherr
 */
public class PDFBOX4935PrintDpi implements Printable
{

    public static void main(String[] args) throws PrinterException
    {
        new PDFBOX4935PrintDpi().doStuff();
    }

    PDFBOX4935PrintDpi()
    {
    }

    void doStuff() throws PrinterException
    {
        PrinterJob job = PrinterJob.getPrinterJob();
        job.setPrintService(PrintServiceLookup.lookupDefaultPrintService());
        job.setPrintable(this);
        if (job.printDialog())
        {
            job.print();
        }
    }

    @Override
    public int print(Graphics graphics, PageFormat pageFormat, int index)
    {
        if (index == 0)
        {
            Graphics2D g2d = (Graphics2D) graphics;
            g2d.setFont(new Font("Courier", Font.PLAIN, 12));
            g2d.setColor(Color.BLACK);

            g2d.drawString("ScaleX: " + g2d.getTransform().getScaleX(), 
                    (int) (pageFormat.getWidth() / 10), (int) 
(pageFormat.getHeight() / 2));
            g2d.drawString("ScaleY: " + g2d.getTransform().getScaleY(), 
                    (int) (pageFormat.getWidth() / 10), (int) 
(pageFormat.getHeight() / 2) + 25);
            g2d.drawString("DPI:    " + 
Math.round(g2d.getTransform().getScaleX() * 72), 
                    (int) (pageFormat.getWidth() / 10), (int) 
(pageFormat.getHeight() / 2) + 60);

            return Printable.PAGE_EXISTS;
        }
        return Printable.NO_SUCH_PAGE;
    }
}
{code}

> PDF with thin table cell border not print out.
> ----------------------------------------------
>
>                 Key: PDFBOX-4935
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-4935
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Rendering
>    Affects Versions: 2.0.20
>         Environment: My OS is MacOS 10.15.5
> java 1.8.0_201
>            Reporter: chunlinyao
>            Priority: Minor
>         Attachments: job_73.QZ.Tray.PDF.Print.pdf, report.pdf
>
>
> I have a pdf file generated by apache fop. PDFBox not render it correctly on 
> macOS.
> On windows it rendered perfectly.
> I initially reported this issue to QZTray, but they found it related to 
> PDFBox.
> [https://github.com/qzind/tray/issues/695]
>  
> report.pdf is the origin pdf, the job_73.QZ.Tray.PDF.Print.pdf is printed 
> result.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: dev-h...@pdfbox.apache.org

Reply via email to