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

Tilman Hausherr commented on PDFBOX-3046:
-----------------------------------------

Here's what worked for me:
{code}
PrintRequestAttributeSet attr = new HashPrintRequestAttributeSet();
PrinterJob job = PrinterJob.getPrinterJob();
job.setPrintService(printService);
job.setPageable(new PDFPageable(document, Orientation.AUTO, true, 300));
job.print(attr);
{code}

Things I tried that didn't work:


took too long:
{code}

PrintRequestAttributeSet attr = new HashPrintRequestAttributeSet();
PrinterJob job = PrinterJob.getPrinterJob();
job.setPrintService(printService);
job.setPageable(new PDFPageable(document));
job.print(attr);
{code}



Exception in thread "main" java.lang.IllegalArgumentException: Dimensions 
(width=2758064 height=2758064) are too large:
{code}

PDFPrintable printable = new PDFPrintable(document);

DocPrintJob job = printService.createPrintJob();
PrintRequestAttributeSet attr = new HashPrintRequestAttributeSet();
attr.add(new Destination(new URI("file:////..../pdfbox.out")));
Doc doc = new SimpleDoc(printable, DocFlavor.SERVICE_FORMATTED.PRINTABLE, null);
job.print(doc, attr);
{code}



Exception in thread "main" java.lang.IllegalArgumentException: Dimensions 
(width=2761643 height=2761643) are too large:
{code}

PDFPrintable printable = new PDFPrintable(document);

DocPrintJob job = printService.createPrintJob();
PrintRequestAttributeSet attr = new HashPrintRequestAttributeSet();
attr.add(new Destination(new URI("file:////c:/...../pdfbox.out")));
attr.add(new PrinterResolution(300, 300, ResolutionSyntax.DPI));
Doc doc = new SimpleDoc(printable, DocFlavor.SERVICE_FORMATTED.PRINTABLE, null);
job.print(doc, attr);
{code}


Exception in thread "main" java.lang.NegativeArraySizeException (stack trace 
like yours):

{code}
PDFPrintable printable = new PDFPrintable(document);

DocPrintJob job = printService.createPrintJob();
PrintRequestAttributeSet attr = new HashPrintRequestAttributeSet();
attr.add(new Destination(new URI("file:////c:/...../pdfbox.out")));
attr.add(new PrinterResolution(200, 200, ResolutionSyntax.DPI));
Doc doc = new SimpleDoc(printable, DocFlavor.SERVICE_FORMATTED.PRINTABLE, null);
job.print(doc, attr);
{code}


Too small and cut off (PDFPrintable.print() gets passed a very small 
ImageableArea):

{code}
PDFPrintable printable = new PDFPrintable(document, Scaling.SCALE_TO_FIT, true, 
300);

DocPrintJob job = printService.createPrintJob();
PrintRequestAttributeSet attr = new HashPrintRequestAttributeSet();
Doc doc = new SimpleDoc(printable, DocFlavor.SERVICE_FORMATTED.PRINTABLE, null);
job.print(doc, attr);
{code}

Maybe it's possible to fix that one by passing a MediaPrintableArea, but I 
didn't try.


> Specific PDF prints really (REALLY) slow
> ----------------------------------------
>
>                 Key: PDFBOX-3046
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-3046
>             Project: PDFBox
>          Issue Type: Bug
>    Affects Versions: 2.0.0
>         Environment: Windows 10
>            Reporter: Teon Metselaar
>         Attachments: mspubcol.pdf, mspubcol.prn
>
>
> On Windows 10 I have printed a test page using the MS Publisher Color Printer 
> (which outputs a Postscript-file) and converted that file to PDF using 
> GhostScript ps2pdf.
> The resulting single-page PDF file is printed really, really slow (180-190 
> seconds) while other documents (even generated using ps2pdf) print a lot 
> faster (some seconds).
> I can't figure out why this is. I guess it has someting to do with the used 
> font, but other PDF printing libraries (jPedal, jPDFPrint) are able print the 
> same documents in a couple of seconds.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to