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 975C29F1B for ; Mon, 23 Jul 2012 12:25:17 +0000 (UTC) Received: (qmail 90345 invoked by uid 500); 23 Jul 2012 12:25:17 -0000 Delivered-To: apmail-pdfbox-users-archive@pdfbox.apache.org Received: (qmail 90225 invoked by uid 500); 23 Jul 2012 12:25: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 90110 invoked by uid 99); 23 Jul 2012 12:25:15 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 23 Jul 2012 12:25:15 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of pierre@huttin.com designates 178.32.125.228 as permitted sender) Received: from [178.32.125.228] (HELO mo6.mail-out.ovh.net) (178.32.125.228) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 23 Jul 2012 12:25:05 +0000 Received: from mail365.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo6.mail-out.ovh.net (Postfix) with SMTP id 632DDFF8485 for ; Mon, 23 Jul 2012 14:29:23 +0200 (CEST) Received: from b0.ovh.net (HELO queueout) (213.186.33.50) by b0.ovh.net with SMTP; 23 Jul 2012 12:22:07 -0000 Received: from ns0.ovh.net (HELO ssl0.ovh.net) (213.186.33.20) by ns0.ovh.net with SMTP; 23 Jul 2012 12:22:07 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Date: Mon, 23 Jul 2012 14:22:07 +0200 From: To: X-Ovh-Mailout: 178.32.228.6 (mo6.mail-out.ovh.net) Subject: Error with saved PDF file and error in openning with conforming parser Message-ID: X-Sender: pierre@huttin.com User-Agent: RoundCube Webmail/0.4 X-Ovh-Tracer-Id: 4751016133485170908 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeegkedrkeeiucetufdoteggodetrfdofgetucfrrhhofhhilhgvmecuqfggjfenuceurghilhhouhhtmecufedttdenucenucfhrhhomhepoehpihgvrhhrvgeshhhuthhtihhnrdgtohhmqeenucfjughrpeggtgfgfffhvffukfigfgesthejjhdttderje X-Virus-Checked: Checked by ClamAV on apache.org Hello, I have some pdf documents who generate me some strange error, when I just open it and save it the resulting PDF is not opennable anymore by adobe reader (it block adobe reader and crash it), also the resulting file is bigger than the orignal one. the code I use to open the file and save it into a new one : PDDocument document = null; File f = new File(args[0]); if (f.exists()) { document = PDDocument.load(f); FileOutputStream fos = new FileOutputStream(new File(f.getParent(), "OUPUT-"+f.getName())); document.save(fos); document.close(); fos.close(); } SO I have decide to open it using the conforming parser but I recive the following error message: java.io.IOException: Invalid hex string: 10477c80ad68883700693730a39c8cc2><54ffd9970b64a157a094b79269584729 at org.apache.pdfbox.cos.COSString.createFromHexString(COSString.java:218) at org.apache.pdfbox.cos.COSString.createFromHexString(COSString.java:188) at org.apache.pdfbox.pdfparser.ConformingPDFParser.readObjectBackwards(ConformingPDFParser.java:329) at org.apache.pdfbox.pdfparser.ConformingPDFParser.readDictionaryBackwards(ConformingPDFParser.java:572) at org.apache.pdfbox.pdfparser.ConformingPDFParser.parseTrailerInformation(ConformingPDFParser.java:152) at org.apache.pdfbox.pdfparser.ConformingPDFParser.parse(ConformingPDFParser.java:77) at com.xxxxx.tests.PDFDocOpenSave.main(PDFDocOpenSave.java:23) Caused by: java.lang.NumberFormatException: For input string: "><" at java.lang.NumberFormatException.forInputString(Unknown Source) at java.lang.Integer.parseInt(Unknown Source) at org.apache.pdfbox.cos.COSString.createFromHexString(COSString.java:212) ... 6 more and effectivley if I check in the orignal file I found the value in the trailer : 0000146487 00000 n trailer <<54ffd9970b64a157a094b79269584729>]>> startxref 197312 %%EOF Thanks in advance for your help. Best regards, Pierre Huttin