You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Christian Appl (Jira)" <ji...@apache.org> on 2020/01/15 14:26:00 UTC

[jira] [Updated] (PDFBOX-4740) PDFPrintable is creating incomplete/odd output for some printers

     [ https://issues.apache.org/jira/browse/PDFBOX-4740?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Christian Appl updated PDFBOX-4740:
-----------------------------------
    Description: 
We are printing PDF documents using the class "PDFPrintable", which is working fine for most documents and printers.

Except we found a case where the bounding box of an image is seemingly clipping the contents of a following page in the printouts of certain documents:

!image-2020-01-15-15-01-32-976.png!

(The whole cropbox of the second page should have been painted red - compare attached document)

The following code can be used to reproduce the issue:
{code:java}
private static void print(PDDocument document, String printerName) throws PrinterException {
    PrinterJob printerJob = PrinterJob.getPrinterJob();
    PrintService printService = null;
    // loop through all printers
    for (PrintService deviceInterface : PrinterJob.lookupPrintServices()) {
        // get printer name
        String name = deviceInterface.getName();

        // is this the requested printer?
        if (name != null && name.equals(printerName)) {
            // configure print job for the printer
            printService = deviceInterface;
            break;
        }
    }
    if (printService == null) {
        return;
    }

    printerJob.setPrintService(printService);
    // set source and execute print job.
    printerJob.setPrintable(
        new PDFPrintable(
            document, null, false, 0, true
        )
    );

    // init print attribute set.
    PrintRequestAttributeSet printAttrSet = new HashPrintRequestAttributeSet();
    printAttrSet.add(new JobName(printerName + "_job", Locale.ENGLISH));
    printAttrSet.add(PrintQuality.HIGH);

    // do print.
    printerJob.print(printAttrSet);
}
{code}
The attached document is leading to the erroneous results, when printed via the given method. (and using the following printers)

Some printers, which show this odd behaviour are:
 - "Adobe PDF" printer (most likely the easiest way to reproduce this issue)
 - Konica Minolta C658
 - Kyocera FS-4100DN

We are suspecting, an compatibility issue of PCL based printer drivers and some instructions created by PDFBox.

This behaviour can only then be seen for the following page, if it does contain certain operations. (Such as Shaders => as demonstrated in the example document)

  was:
We are printing PDF documents using the class "PDFPrintable", which is working fine for most documents and printers.

Except we found a case where the bounding box of an image is seemingly clipping the contents of a following page in the printouts of certain documents:

!image-2020-01-15-15-01-32-976.png!

(The whole cropbox of the second page should have been painted red - compare attached document)

The following code can be used to reproduce the issue:
{code:java}
private static void print(PDDocument document, String printerName) throws PrinterException {
    PrinterJob printerJob = PrinterJob.getPrinterJob();
    PrintService printService = null;
    // loop through all printers
    for (PrintService deviceInterface : PrinterJob.lookupPrintServices()) {
        // get printer name
        String name = deviceInterface.getName();

        // is this the requested printer?
        if (name != null && name.equals(printerName)) {
            // configure print job for the printer
            printService = deviceInterface;
            break;
        }
    }
    if (printService == null) {
        return;
    }

    printerJob.setPrintService(printService);
    // set source and execute print job.
    printerJob.setPrintable(
        new PDFPrintable(
            document, null, false, 0, true
        )
    );

    // init print attribute set.
    PrintRequestAttributeSet printAttrSet = new HashPrintRequestAttributeSet();
    printAttrSet.add(new JobName(printerName + "_job", Locale.ENGLISH));
    printAttrSet.add(PrintQuality.HIGH);

    // do print.
    printerJob.print(printAttrSet);
}
{code}

The attached document is leading to the erroneous results, when printed via the given method. (and using the following printers)

Some printers, which show this odd behaviour are:
- "Adobe PDF" printer (most likely the easiest way to reproduce this issue)
- Konica Minolta C658
- Kyocera FS-4100DN

We are suspecting, an compatibility issue of PCL based printer drivers and some instructions created by PDFBox.


> PDFPrintable is creating incomplete/odd output for some printers
> ----------------------------------------------------------------
>
>                 Key: PDFBOX-4740
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-4740
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Rendering
>    Affects Versions: 2.0.15, 2.0.18
>            Reporter: Christian Appl
>            Priority: Major
>              Labels: PDFBox, printer
>         Attachments: image-2020-01-15-15-01-32-976.png, out.pdf
>
>
> We are printing PDF documents using the class "PDFPrintable", which is working fine for most documents and printers.
> Except we found a case where the bounding box of an image is seemingly clipping the contents of a following page in the printouts of certain documents:
> !image-2020-01-15-15-01-32-976.png!
> (The whole cropbox of the second page should have been painted red - compare attached document)
> The following code can be used to reproduce the issue:
> {code:java}
> private static void print(PDDocument document, String printerName) throws PrinterException {
>     PrinterJob printerJob = PrinterJob.getPrinterJob();
>     PrintService printService = null;
>     // loop through all printers
>     for (PrintService deviceInterface : PrinterJob.lookupPrintServices()) {
>         // get printer name
>         String name = deviceInterface.getName();
>         // is this the requested printer?
>         if (name != null && name.equals(printerName)) {
>             // configure print job for the printer
>             printService = deviceInterface;
>             break;
>         }
>     }
>     if (printService == null) {
>         return;
>     }
>     printerJob.setPrintService(printService);
>     // set source and execute print job.
>     printerJob.setPrintable(
>         new PDFPrintable(
>             document, null, false, 0, true
>         )
>     );
>     // init print attribute set.
>     PrintRequestAttributeSet printAttrSet = new HashPrintRequestAttributeSet();
>     printAttrSet.add(new JobName(printerName + "_job", Locale.ENGLISH));
>     printAttrSet.add(PrintQuality.HIGH);
>     // do print.
>     printerJob.print(printAttrSet);
> }
> {code}
> The attached document is leading to the erroneous results, when printed via the given method. (and using the following printers)
> Some printers, which show this odd behaviour are:
>  - "Adobe PDF" printer (most likely the easiest way to reproduce this issue)
>  - Konica Minolta C658
>  - Kyocera FS-4100DN
> We are suspecting, an compatibility issue of PCL based printer drivers and some instructions created by PDFBox.
> This behaviour can only then be seen for the following page, if it does contain certain operations. (Such as Shaders => as demonstrated in the example document)



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

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