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

chunlinyao commented on PDFBOX-4935:
------------------------------------

Still no response from oracle.

I modified the test case to simulate printing operation of my pdf file. The 
behavior can reproduced when draw a line inside clip path.

 
{code:java}
import java.awt.*;
import java.awt.geom.GeneralPath;
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);            
            double pageWidth = pageFormat.getWidth();
            double xLeft = pageWidth / 10;
            double yBase = pageFormat.getHeight() / 2;
            g2d.drawString("ScaleX: " + g2d.getTransform().getScaleX(),
                    (int) xLeft, (int) yBase);
            g2d.drawString("ScaleY: " + g2d.getTransform().getScaleY(),
                    (int) xLeft, (int) yBase + 25);
            g2d.drawString("DPI:    " + 
Math.round(g2d.getTransform().getScaleX() * 72),
                    (int) xLeft, (int) yBase + 60);            
            
            float lineWidth = 0.5f;
            g2d.setStroke(new BasicStroke(lineWidth));
            // WITH 72DPI THIS LINE IS OK
            double xRight = pageWidth - xLeft;
            g2d.drawLine((int) xLeft, (int) yBase + 80,
                    (int) (xRight),(int) yBase + 80);            
            
            // DRAW LINE WITH CLIP
            GeneralPath line = new GeneralPath();
            double yLine = yBase + 100;
            line.moveTo(xLeft, yLine);
            line.lineTo(xLeft, yLine - lineWidth / 2.0f);
            line.lineTo(xRight, yLine - lineWidth / 2.0f);
            line.lineTo(xRight, yLine + lineWidth / 2.0f);
            line.lineTo(xLeft, yLine + lineWidth / 2.0f );
            line.closePath();
            g2d.clip(line);
            line.reset();
            line.moveTo(xLeft, yLine);
            line.lineTo(xRight, yLine);
            g2d.draw(line);            
            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