Return-Path: X-Original-To: apmail-pdfbox-dev-archive@www.apache.org Delivered-To: apmail-pdfbox-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4BE1A10EEF for ; Fri, 4 Dec 2015 12:25:11 +0000 (UTC) Received: (qmail 95411 invoked by uid 500); 4 Dec 2015 12:25:11 -0000 Delivered-To: apmail-pdfbox-dev-archive@pdfbox.apache.org Received: (qmail 95384 invoked by uid 500); 4 Dec 2015 12:25:11 -0000 Mailing-List: contact dev-help@pdfbox.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@pdfbox.apache.org Delivered-To: mailing list dev@pdfbox.apache.org Received: (qmail 95357 invoked by uid 99); 4 Dec 2015 12:25:11 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Dec 2015 12:25:11 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 043192C1F61 for ; Fri, 4 Dec 2015 12:25:11 +0000 (UTC) Date: Fri, 4 Dec 2015 12:25:11 +0000 (UTC) From: "Sridhar (JIRA)" To: dev@pdfbox.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Comment Edited] (PDFBOX-3133) PDFBox 2.0.0-RC2 and earlier 2.0.0 SNAPSHOT Versions print performance is poor with systems having low RAM < 3GB and lower number of fonts. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/PDFBOX-3133?page=3Dcom.atlassia= n.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D150= 41359#comment-15041359 ]=20 Sridhar edited comment on PDFBOX-3133 at 12/4/15 12:24 PM: ----------------------------------------------------------- Dear Tilman I need one urgent help Planning the following work around. I am using the code given below. =C2=A0In that job.print(attr) =C2=A0takes all the 20 sec in low end client machine If I create a printable Image / JPG using APIs similar to command line PDFT= oImage in Server ( which is very high end cluster and may finish all in < 1= sec ) and send JPG Byte Stream to client side,=C2=A0 What should be the code or PDFBox API or Java.awt.print =C2=A0code to print= JPG file at client side? I did a quick browse through on PDFBOx APIs or Java.awt.print APIs but coul= d not find, hence this request to you. Requirement ---------------=C2=A0 PDF file Input to printable =C2=A0 JPG =C2=A0PDFBox code sample JPG bytestream to silent printing either PDFBox or Java.awt.print code =C2=A0 Code snippet for 1 and 2 will resolve our issue. Code used --------------=C2=A0 try { f =3D new File("Test.pdf" ) ; is =3D new FileInputStream(f) ; pdDocument = =3D PDDocument.load(is);=09printWithPaper(pdDocument, "SLEEK") ; } private static void printWithPaper(PDDocument document, String receiptType) { PrinterJob job =3D PrinterJob.getPrinterJob(); job.setPageable(new PDFPag= eable(document, Orientation.AUTO, true, 300) ) ; Book book =3D new Book(); = book.append(new PDFPrintable(document, Scaling.ACTUAL_SIZE, true, 300), get= PageFormat("SLEEK") , document.getNumberOfPages()); job.setPageable(book); = PrintRequestAttributeSet attr =3D new HashPrintRequestAttributeSet(); job.p= rint(attr); } private static PageFormat getPageFormat(String receiptType) { PageFormat pageFormat =3D new PageFormat(); pageFormat.setOrientation(PageFormat.PORTRAIT); Paper paper=3D pageFormat.getPaper(); if ("SLEEK".equalsIgnoreCase(receiptType)) { paperWidth =3D 3.14; paperHeight =3D 50; } else if { //........ } paper.setSize(paperWidth * 72.0, paperHeight * 72.0); paper.setImageableArea(0, 0, paper.getWidth(), paper.getHeight()); pageFormat.setPaper(paper); return pageFormat; } Regards Sridhar Sowmiyanarayanan Tata Consultancy Services Mailto: srid....@tcs.com Website: http://www.tcs.com was (Author: sridhar): Dear Tilman I need one urgent help Planning the following work around. I am using the code given below. =C2=A0In that job.print(attr) =C2=A0takes all the 20 sec in low end client machine If I create a printable Image / JPG using APIs similar to command line PDFT= oImage in Server ( which is very high end cluster and may finish all in < 1= sec ) and send JPG Byte Stream to client side,=C2=A0 What should be the code or PDFBox API or Java.awt.print =C2=A0code to print= JPG file at client side? I did a quick browse through on PDFBOx APIs or Java.awt.print APIs but coul= d not find, hence this request to you. Requirement ---------------=C2=A0 PDF file Input to printable =C2=A0 JPG =C2=A0PDFBox code sample JPG bytestream to silent printing either PDFBox or Java.awt.print code =C2=A0 Code snippet for 1 and 2 will resolve our issue. Code used --------------=C2=A0 try { f =3D new File("Test.pdf" ) ; is =3D new FileInputStream(f) ; pdDocument = =3D PDDocument.load(is);=09printWithPaper(pdDocument, "SLEEK") ; } private static void printWithPaper(PDDocument document, String receiptType) { PrinterJob job =3D PrinterJob.getPrinterJob(); job.setPageable(new PDFPag= eable(document, Orientation.AUTO, true, 300) ) ; Book book =3D new Book(); = book.append(new PDFPrintable(document, Scaling.ACTUAL_SIZE, true, 300), get= PageFormat("SLEEK") , document.getNumberOfPages()); job.setPageable(book); = PrintRequestAttributeSet attr =3D new HashPrintRequestAttributeSet(); job.p= rint(attr); } private static PageFormat getPageFormat(String receiptType) { PageFormat pageFormat =3D new PageFormat(); pageFormat.setOrientation(PageFormat.PORTRAIT); Paper paper=3D pageFormat.getPaper(); if ("SLEEK".equalsIgnoreCase(receiptType)) { paperWidth =3D 3.14; paperHeight =3D 50; } else if { //........ } paper.setSize(paperWidth * 72.0, paperHeight * 72.0); paper.setImageableArea(0, 0, paper.getWidth(), paper.getHeight()); pageFormat.setPaper(paper); return pageFormat; } Regards Sridhar Sowmiyanarayanan Tata Consultancy Services Mailto: sridhar.so@tcs.com Website: http://www.tcs.com > PDFBox 2.0.0-RC2 and earlier 2.0.0 SNAPSHOT Versions print performance is= poor with systems having low RAM < 3GB and lower number of fonts. > -------------------------------------------------------------------------= ------------------------------------------------------------------ > > Key: PDFBOX-3133 > URL: https://issues.apache.org/jira/browse/PDFBOX-3133 > Project: PDFBox > Issue Type: Improvement > Components: PDModel > Affects Versions: 2.0.0 > Environment: MS Windows Systems with low RAM < 3GB and number of = fonts were less < 592 (or if desired fonts in PDF to be printed are not ava= ilable in local system )=20 > Reporter: Sridhar > Assignee: John Hewson > Labels: performance > Fix For: 2.0.0 > > > PDFBox 2.0.0-RC1, SNAPSHOTS and RC2 versions print takes 15+ seconds. > Steps to reproduce > --------------------------=20 > Use Windows System with < 3 GB RAM > Use Systems with less number of fonts or without specific fonts in PDF fi= le to be printed. > Printing PDF file=20 > Took 14 to 20 seconds in system with 3 GB RAM which had 522 foints > Took 24 to 34 seconds in system with 2 GB RAM which had 90 fonts > Took only 2.5 seconds in system with 8 GB RAM which had 1025 fonts.=20 > Doubt > --------=20 > Not browsed the code, but following is the doubt as causing performance i= ssue. > Though the code caches fonts by storing fonts in local .pdfbox.cache file= first time and caching fonts for subsequent times. > Not clear whether the code updates the pdfbox fonts cache file if new fon= ts are found in new PDF file to be printed, while printing subsequent times= .=20 > If the fonts in PDF file to be printed is not available in the .pdfbox.ca= che file stored in local system/local system what is the behaviour? Will t= he code download fonts and update cache for subsequent times or is it limit= ed by fonts available in local system? Looks like later is the case and pe= rformance got hit either due to RAM or not constantly updating fonts cache = or due to un availability of fonts in local system. -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org For additional commands, e-mail: dev-help@pdfbox.apache.org