Subject: pdf2ps and acrobat say my PDF has an error 2007-11-06 - By Luis Mineiro
Back Hi,
I have this PDF created with OpenOffice 2.3 under Linux with only 2 pages. I'm adding some overlay content to that PDF, a few numbers here and there and a single phrase in the middle. All of this happens in the first page.
Everyhting is working with no Exceptions and I'm getting a PDF that evince can open and doesn't throw any error.
When I tried to pdf2ps that same PDF ghostscript choked and gave me some error dump like: Error: /undefined in --run-- Operand stack: --dict:7/16(L)-- Execution stack: %interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push 1889 1 3 %oparray_pop 1888 1 3 %oparray_pop 1872 1 3 %oparray_pop --nostringval-- --nostringval-- 2 1 2 --nostringval-- %for_pos_int_continue --nostringval-- --nostringval-- --nostringval-- --nostringval-- %array_continue --nostringval-- false 1 %stopped_push --nostringval-- %loop_continue --nostringval-- Dictionary stack: --dict:1151/1684(ro)(G)-- --dict:2/20(G)-- --dict:97/200(L)-- --dict:97/200(L)-- --dict:106/127(ro)(G)-- --dict:274/300(ro)(G)-- --dict:21/25(L)-- --dict:4/6(L)-- --dict:20/20(L)-- --dict:10/13(L)-- Current allocation mode is local GPL Ghostscript SVN PRE-RELEASE 8.61: Unrecoverable error, exit code 1"
I tried it with different version of ghostscript to see if there was a problem with my GS version but it happens with any version.
I then tried to open the PDF with Adobe Acrobat 8 (Windows XP box) and if I try to print the file it also says that the PDF contains errors and that I should contact the creator (something like that).
What I did after was to debug what could bhe causing the error, so I tried to pdf2ps with the original PDF from OO.org and it ran OK. Back to java code, I started removing chunks of code until the GS error came back. I was able to isolate the error to the following piece of code:
com.lowagie.text.Font titAcc = FontFactory.getFont(FontFactory.TIMES_BOLD, 14, com.lowagie.text.Font.UNDERLINE); Phrase phrase = new Phrase("TITULO DE " + step + " ACCOES", titAcc); ColumnText ct = new ColumnText(over); ct.setSimpleColumn(phrase, 95.3f, 300.0f, 500.0f, 350.0f, 0, Element.ALIGN_CENTER); ct.go();
Where step is a method parameter (int) and over is PdfContentByte over = pdfStamp.getOverContent(1); and pdfStamp is a PdfStamper
I have a few showTextAligned() calls before that code and the resulting PDF, without the Phrase/ColumnText is OK with GS and Acrobat.
Am I doing something wrong?
I need to add some underlined text in a specific position.
Thanks in advance.
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ __ ____ ____ ____ ____ ____ ____ ____ ____ ____ iText-questions mailing list iText-questions@(protected) https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://itext.ugent.be/itext-in-action/
|
|