Return-Path: X-Original-To: apmail-pdfbox-users-archive@www.apache.org Delivered-To: apmail-pdfbox-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C942F6C5B for ; Thu, 9 Jun 2011 16:48:16 +0000 (UTC) Received: (qmail 3461 invoked by uid 500); 9 Jun 2011 16:48:16 -0000 Delivered-To: apmail-pdfbox-users-archive@pdfbox.apache.org Received: (qmail 3429 invoked by uid 500); 9 Jun 2011 16:48:16 -0000 Mailing-List: contact users-help@pdfbox.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@pdfbox.apache.org Delivered-To: mailing list users@pdfbox.apache.org Received: (qmail 3421 invoked by uid 99); 9 Jun 2011 16:48:16 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 Jun 2011 16:48:16 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of shea.martin@me.com designates 17.148.16.101 as permitted sender) Received: from [17.148.16.101] (HELO asmtpout026.mac.com) (17.148.16.101) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 Jun 2011 16:48:09 +0000 MIME-version: 1.0 Content-type: multipart/alternative; boundary="Boundary_(ID_7MR3lbFfE+8D6/8CC7qJ1g)" Received: from [172.16.1.64] (142-165-93-83.regn.hsdb.sasknet.sk.ca [142.165.93.83]) by asmtp026.mac.com (Oracle Communications Messaging Exchange Server 7u4-20.01 64bit (built Nov 21 2010)) with ESMTPSA id <0LMJ001W27YTBM50@asmtp026.mac.com> for users@pdfbox.apache.org; Thu, 09 Jun 2011 09:47:19 -0700 (PDT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.4.6813,1.0.148,0.0.0000 definitions=2011-06-09_03:2011-06-09,2011-06-08,1970-01-01 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 ipscore=0 suspectscore=1 phishscore=0 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx engine=6.0.2-1012030000 definitions=main-1106090119 From: Shea Martin Subject: Re: Can view document, but getPrintable fails due to unknown compression of zip stream Date: Thu, 09 Jun 2011 10:47:17 -0600 In-reply-to: To: users@pdfbox.apache.org References: Message-id: <9B3DE80D-7F25-4582-BF8C-D4542577FD17@me.com> X-Mailer: Apple Mail (2.1084) X-Virus-Checked: Checked by ClamAV on apache.org --Boundary_(ID_7MR3lbFfE+8D6/8CC7qJ1g) Content-type: text/plain; CHARSET=US-ASCII Content-transfer-encoding: 7BIT Solution: pdf.decrypt(""); I guess this is somehting I have to check from now on. Perhaps a better erorr message would help people with this in the future. CHeers, ~S On 2011-06-09, at 10:29 AM, Shea Martin wrote: > I have removed my code from suspicion, the following fails with pdfbox, jempbox, and fontbox in my classpath. But if I put run pdfbox-app, as a PrintPDF, or PDFReader it works on the same pdf. The app jar must include something extra? > > The following produces the same corrupt stream error. > static void main(String[] args) > { > PDDocument pdf = PDDocument.load("testdata/cash_for_keys.pdf"); > pdf.silentPrint(); > } > On 2011-06-09, at 7:46 AM, samfree@me.com wrote: > >> >> Hello, >> >> I am using PDFBox to print PDF's. I have come across a PDF which I can not print. FlateFilter is thrown a ZipException due to an unknown compression method. Yet, I know PDFBox can handle the file, because PDFReader, and PrintPDF utilities work fine. (aside: Speaking of which, could the error message printed when this happens be more specific than "Stop reading corrupt stream". ) >> >> So I am not sure if the bug is in my code or PDFBox's; this is the code I am using to print, which works with most PDF's. >> >> public class MyPdfDoc implements Printable >> { >> >> private PDDocument pdfDoc; >> >> public MyPdfDoc( String path ) >> { >> try >> { >> pdfDoc = PDDocument.load(path); >> } >> catch( IOException e ) >> { >> log.severe("failed to load " + path + ": " + e); >> pdfDoc = null; >> } >> } >> >> @Override >> public int print( Graphics graphics, PageFormat pageFormat, int pageIndex ) throws PrinterException >> { >> if( pdfDoc == null || pageIndex >= pdfDoc.getNumberOfPages() ) >> { >> return NO_SUCH_PAGE; >> } >> >> Printable printable = pdfDoc.getPrintable(pageIndex); >> return printable.print(graphics, pageFormat, pageIndex); >> } >> } >> >> Any help appreciated, thanks. >> ~S > > ---------------- > Shea Martin > > > > ---------------- Shea Martin --Boundary_(ID_7MR3lbFfE+8D6/8CC7qJ1g)--