Re: [iText-questions] Re gistration Black
Hi all, I bring up an old issue as I lately had to use this, i.e add registration black typographers marks in a PDF job I output using iText. (Though not an active forum poster, I am an avid forum reader. :) According to PDF1.7 Ref, page 266, section 4.5 Color Spaces it is: 1. The name parameter is a name object specifying the name of the colorant that this Separation color space is intended to represent (or one of the special names All or None; see below). Such colorant names are arbitrary, and there can be any number of them, subject to implementation limits. ... 2. The special colorant name All refers collectively to all colorants available on an output device, including those for the standard process colorants. When a Separation space with this colorant name is the current color space, painting operators apply tint values to all available colorants at once. This is useful for purposes such as painting registration targets in the same place on every separation. Such marks are typically painted as the last step in composing a page to ensure that they are not overwritten by subsequent painting operations. So the answer given by Leonard at the time is correct... On the other hand, using the iText API: setDefaultColorspace public void setDefaultColorspace(PdfName name, PdfObject obj) Sets the default colorspace. Parameters: name - the name of the colorspace. It can be PdfName.DEFAULTGRAY, PdfName.DEFAULTRGB or PdfName.DEFAULTCMYK obj - the colorspace. A null or PdfNull removes any colorspace with the same name In the following code line, PdfName can be SEPARATION along with the other API options cb.setDefaultColorspace(PdfName.SEPARATION, PdfObject obj); but ALL is not an option in iText API, either for a PdfName, or a PdfObject.. That said, my question remains: how exactly one defines/uses marks as registration black appearing in all color plates, using iText? On the occasion a great Thanks to Bruno for his excellent work and the new book under construction! Thanks all George Leonard Rosenthol wrote: Exactly, George. The colorspace is Separation, and the name is All. Leonard On Apr 18, 2008, at 1:03 PM, George Bilalis wrote: Hi all, Registration Black has to register on all separated plates of a print job. Thus it has also to register on Spot color (or any other separated) plates besides C,M,Y,K plates. While on the subject, may I ask what might be the ColorSpace of Registration Black in this context, Leonard? thanks George From: leona...@pdfsages.com Date: Fri, 18 Apr 2008 12:07:10 -0400 To: itext-questions@lists.sourceforge.net Subject: Re: [iText-questions] Registration Black No, it isn't. CMYK [1 1 1 1] is a process color, while Registration is a Spot color. Leonard On Apr 18, 2008, at 11:34 AM, Bill Ensley wrote: Registration Black is simply cmyk 100,100,100,100 -Bill Ensley www.bearprinting.com -Original Message- From: itext-questions-boun...@lists.sourceforge.net [mailto:itext-questions-boun...@lists.sourceforge.net] On Behalf Of Neal Johnson Sent: Friday, April 18, 2008 4:23 AM To: itext-questions@lists.sourceforge.net Subject: [iText-questions] Registration Black I'm trying to add Registration color to a iText PDF, so I can add crop marks and targets to a PDF. Is this possible with iText? -- --- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java .sun.com/javaone ___ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Do you like iText? Buy the iText book: http://www.1t3xt.com/docs/book.php Or leave a tip: https://tipit.to/itexttipjar -- --- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http:// java.sun.com/javaone ___ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Do you like iText? Buy the iText book: http://www.1t3xt.com/docs/book.php Or leave a tip: https://tipit.to/itexttipjar -- --- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2.
Re: [iText-questions] PdfStamper modifies XmpMetadata
Can you please post a target.pdf? -Original Message- From: Patrick Hartmann [mailto:patrick.hartm...@abacus.ch] Sent: Tuesday, November 17, 2009 1:33 PM To: itext-questions@lists.sourceforge.net Subject: [iText-questions] PdfStamper modifies XmpMetadata Hi I use iText 2.1.7 to create and modify PDF files. Attached one of my self created PDF files. In every PDF, I write my own XmpMetadata, including a hash code, to be sure, that nobody else has modified the meta data. Let's say, I want to extend the PDF file with a keyword, so I use the PdfStamper. But there is a problem. The PdfStamper changes some data inside my meta data. Why does he do that? I only want to add a keyword to the PDF, but the PdfStamper changes also my meta data. I wrote an example, also attached to this mail. Now, what does the PdfStamper change. When you open the source.pdf and target.pdf (after it has been created), compare the text inside the ocr-element, that is a few levels under the abascan-element. In the source.pdf, every line ends with CR, LF. But in target.pdf, every line ends only with a LF. (see attached screenshot.png) And that of course changes my hash code. Do you have a solution/workaround for this problem? Thanks and best regards Patrick Hartmann -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.1t3xt.com/docs/book.php Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/
Re: [iText-questions] PdfStamper modifies XmpMetadata
FYI - whitespace in XML is not significant (by default). -Original Message- From: Patrick Hartmann [mailto:patrick.hartm...@abacus.ch] Sent: Tuesday, November 17, 2009 1:33 PM To: itext-questions@lists.sourceforge.net Subject: [iText-questions] PdfStamper modifies XmpMetadata Hi I use iText 2.1.7 to create and modify PDF files. Attached one of my self created PDF files. In every PDF, I write my own XmpMetadata, including a hash code, to be sure, that nobody else has modified the meta data. Let's say, I want to extend the PDF file with a keyword, so I use the PdfStamper. But there is a problem. The PdfStamper changes some data inside my meta data. Why does he do that? I only want to add a keyword to the PDF, but the PdfStamper changes also my meta data. I wrote an example, also attached to this mail. Now, what does the PdfStamper change. When you open the source.pdf and target.pdf (after it has been created), compare the text inside the ocr-element, that is a few levels under the abascan-element. In the source.pdf, every line ends with CR, LF. But in target.pdf, every line ends only with a LF. (see attached screenshot.png) And that of course changes my hash code. Do you have a solution/workaround for this problem? Thanks and best regards Patrick Hartmann -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.1t3xt.com/docs/book.php Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/
Re: [iText-questions] PdfStamper modifies XmpMetadata
Patrick Hartmann wrote: Hi I use iText 2.1.7 to create and modify PDF files. The PdfStamper changes some data inside my meta data. Why does he do that? A PDF can contain two sets of metadata. In the /Info dictionary. In an XMP stream. PdfStamper changes the Modification date in both sets. PdfStamper also updates the producer line, so that people can see that iText was used. Please don't remove that line, because in some cases it's the only way free users do something in return for using iText for free. Do you have a solution/workaround for this problem? No, certainly not in the free version of iText. -- This answer is provided by 1T3XT BVBA http://www.1t3xt.com/ - http://www.1t3xt.info -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.1t3xt.com/docs/book.php Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/
Re: [iText-questions] PdfStamper modifies XmpMetadata
Leonard Rosenthol wrote: FYI - whitespace in XML is not significant (by default). It is if he takes a hash of the XML and uses that hash to check if the XML was changed. That's the main problem. -- This answer is provided by 1T3XT BVBA http://www.1t3xt.com/ - http://www.1t3xt.info -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.1t3xt.com/docs/book.php Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/
Re: [iText-questions] PdfStamper modifies XmpMetadata
Sorry about that. I attached the target.pdf. The target.pdf will also be generated, if you execute my test program. Thanks! Leonard Rosenthol lrose...@adobe.com 17.11.2009 13:42 Can you please post a target.pdf? -Original Message- From: Patrick Hartmann [mailto:patrick.hartm...@abacus.ch] Sent: Tuesday, November 17, 2009 1:33 PM To: itext-questions@lists.sourceforge.net Subject: [iText-questions] PdfStamper modifies XmpMetadata Hi I use iText 2.1.7 to create and modify PDF files. Attached one of my self created PDF files. In every PDF, I write my own XmpMetadata, including a hash code, to be sure, that nobody else has modified the meta data. Let's say, I want to extend the PDF file with a keyword, so I use the PdfStamper. But there is a problem. The PdfStamper changes some data inside my meta data. Why does he do that? I only want to add a keyword to the PDF, but the PdfStamper changes also my meta data. I wrote an example, also attached to this mail. Now, what does the PdfStamper change. When you open the source.pdf and target.pdf (after it has been created), compare the text inside the ocr-element, that is a few levels under the abascan-element. In the source.pdf, every line ends with CR, LF. But in target.pdf, every line ends only with a LF. (see attached screenshot.png) And that of course changes my hash code. Do you have a solution/workaround for this problem? Thanks and best regards Patrick Hartmann -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.1t3xt.com/docs/book.php Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/ target.pdf Description: Adobe PDF document -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july___ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.1t3xt.com/docs/book.php Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/
Re: [iText-questions] PdfStamper modifies XmpMetadata
Thanks. Your XMP (in Source.pdf) is invalid - so it's probably a good thing that iText attempts to rewrite it, as it has fixed at least the biggest problem. However, other problems remain. XMP is a subset of RDF which is a specific XML grammar. Your XML isn't compliant with the rules of RDF. Leonard -Original Message- From: Patrick Hartmann [mailto:patrick.hartm...@abacus.ch] Sent: Tuesday, November 17, 2009 1:57 PM To: 'Post all your questions about iText here' Subject: Re: [iText-questions] PdfStamper modifies XmpMetadata Sorry about that. I attached the target.pdf. The target.pdf will also be generated, if you execute my test program. Thanks! Leonard Rosenthol lrose...@adobe.com 17.11.2009 13:42 Can you please post a target.pdf? -Original Message- From: Patrick Hartmann [mailto:patrick.hartm...@abacus.ch] Sent: Tuesday, November 17, 2009 1:33 PM To: itext-questions@lists.sourceforge.net Subject: [iText-questions] PdfStamper modifies XmpMetadata Hi I use iText 2.1.7 to create and modify PDF files. Attached one of my self created PDF files. In every PDF, I write my own XmpMetadata, including a hash code, to be sure, that nobody else has modified the meta data. Let's say, I want to extend the PDF file with a keyword, so I use the PdfStamper. But there is a problem. The PdfStamper changes some data inside my meta data. Why does he do that? I only want to add a keyword to the PDF, but the PdfStamper changes also my meta data. I wrote an example, also attached to this mail. Now, what does the PdfStamper change. When you open the source.pdf and target.pdf (after it has been created), compare the text inside the ocr-element, that is a few levels under the abascan-element. In the source.pdf, every line ends with CR, LF. But in target.pdf, every line ends only with a LF. (see attached screenshot.png) And that of course changes my hash code. Do you have a solution/workaround for this problem? Thanks and best regards Patrick Hartmann -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.1t3xt.com/docs/book.php Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/ -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.1t3xt.com/docs/book.php Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/
[iText-questions] PDF-A/1b conformance
Hi, I am trying to produce PDF-A/1b conformant documents. I am setting pdfWriter.setPdfVersion(PdfWriter.VERSION_1_4); and pdfWriter.setPDFXConformance(PdfWriter.PDFA1B); I am embedding the font which I use explicitly bfDefault = BaseFont.createFont(Frutinger_Medium_LT_54368.ttf, BaseFont.CP1252, BaseFont.EMBEDDED); normalFont = new Font(bfDefault, defaultFontSize, Font.NORMAL); boldFont = new Font(bfDefault, defaultFontSize, Font.BOLD); headerFont = new Font(bfDefault, headerFontSize, Font.BOLD); An exception is thrown (PdfXConformanceException) when I call Document.NewPage() or Document.close() The exception says that I am using the non-embedded font (Helvetia). I am not explicitly ussing this font. Does anyone know what I am doing wrong Or how I can find out where Hevetia is being used implicitly? Thanks in advance for any help. Grüsse Keith Thornton This message is intended for a particular addressee only and may contain business or company secrets. If you have received this email in error, please contact the sender and delete the message immediately. Any use of this email, including saving, publishing, copying, replication or forwarding of the message or the contents is not permitted. -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july___ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.1t3xt.com/docs/book.php Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/
Re: [iText-questions] PDF-A/1b conformance
Thornton, Keith wrote: An exception is thrown (PdfXConformanceException) when I call Document.NewPage() or Document.close() The exception says that I am using the non-embedded font (Helvetia). I am not explicitly ussing this font. Does anyone know what I am doing wrong Or how I can find out where Helvetica is being used implicitly? This happened in older iText versions, but I think I've solved this for the more recent versions. Please check the iText version. If it's 2.1.7 show us some more code. -- This answer is provided by 1T3XT BVBA http://www.1t3xt.com/ - http://www.1t3xt.info -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.1t3xt.com/docs/book.php Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/
Re: [iText-questions] Problem in nesting of lists in RTF?
I believe a related bug has been filed: http://sourceforge.net/tracker/?func=detailaid=2802486group_id=15255atid=115255 They're using the HtmlWorker, but I'm guessing the root cause is just in the RTF generation. I see the same behavior that you are in one of our test cases. However, we're not currently using sub lists in our product (so I haven't looked at fixing it myself, yet). If you're able to fix the source code, and submit a patch - well, that would be awesome. :) I have a couple of similar outstanding patches - maybe when the project goes into incubator mode, they'll get merged in. btw - thanks to Bruno, Howard, et al, the RTF support does go a pretty long way. And if you're willing to fix a couple things here and there for your specific uses - you can do a lot with it. Cheers, Scott On Mon, Nov 16, 2009 at 9:51 PM, Chris von See ch...@techadapt.com wrote: Thanks for the information. I'm a newbie to the list and hadn't seen Bruno's earlier post. Chris von See Senior Geek TechAdapt, Inc. http://www.techadapt.com ch...@techadapt.com Save trees. Print only when necessary. On Nov 16, 2009, at 6:42 PM, mister bean wrote: Per Bruno's earlier post to this list, iText is moving to PDF-only for output. The incubator is for related projects that developers might want to use in conjunction with iText. Whether that means they're dead or alive will depend, I am sure, on the authors of the various packages. If Howard Shenk is reading the list, he might be able to tell you/us directly what involvement he anticipates regarding maintenance and development of the RTF package. Regards, ---mr. bean Chris von See wrote: Well, that wasn't quite the answer I had hoped for :/ Will iText RTF support emerge from the incubator at some point in the future? or is this a death by incubation scenario? Chris On Nov 16, 2009, at 2:37 PM, mister bean wrote: iText is about to move the RTF functionality to an incubator and deprecate this functionality. Unless someone can provide the answer on this list (and even if they do), you might want to consider other options for RTF generation. Best wishes, ---mr. bean re Chris von See wrote: I think I've found a problem with nesting of lists in RTF. Running the program below with PDF output produces nested lists three levels deep with all sub-lists nested properly. However, if you run the same code with RTF output the third level of lists does not show as being indented, although the numbering seems correct. Is there something that needs to be done differently for RTF? Thanks, Chris Test program: import java.io.FileOutputStream; import java.io.IOException; import com.lowagie.text.Chunk; import com.lowagie.text.Document; import com.lowagie.text.DocumentException; import com.lowagie.text.List; import com.lowagie.text.ListItem; import com.lowagie.text.pdf.PdfWriter; import com.lowagie.text.rtf.RtfWriter2; public class TestList { public static void main(String[] args) throws IOException, DocumentException { Document document = new Document(); RtfWriter2.getInstance(document, new FileOutputStream(testlist.rtf)); // PdfWriter.getInstance(document, new FileOutputStream(testlist.pdf)); document.open(); List list1 = new List(List.ALPHABETICAL, 20); list1.add(new ListItem(new Chunk(Level 1 - Item 1))); list1.add(new ListItem(new Chunk(Level 1 - Item 2))); list1.add(new ListItem(new Chunk(Level 1 - Item 3))); List list2 = new List(List.ORDERED, 20); list2.add(new ListItem(new Chunk(Level 2 - Item 1))); list2.add(new ListItem(new Chunk(Level 2 - Item 2))); List list3 = new List(List.ORDERED, 20); list3.add(new ListItem(new Chunk(Level 3 - Item 1))); list3.add(new ListItem(new Chunk(Level 3 - Item 2))); list3.add(new ListItem(new Chunk(Level 3 - Item 3))); list3.add(new ListItem(new Chunk(Level 3 - Item 4))); list2.add(list3); //list2.add(new ListItem(new Chunk(Level 2 - Item 3))); list1.add(list2); list1.add(new ListItem(new Chunk(Level 1 - Item 4))); document.add(list1); document.close(); } } PDF output: RTF output: -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.1t3xt.com/docs/book.php Check the site with examples
[iText-questions] How to get signature image from signed PDF?
subj. i have signed pdf and need to get image from its signature field. -- View this message in context: http://old.nabble.com/How-to-get-signature-image-from-signed-PDF--tp26391681p26391681.html Sent from the iText - General mailing list archive at Nabble.com. -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.1t3xt.com/docs/book.php Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/
Re: [iText-questions] Root Object is invalid or missing after PDF is manipulated with iTextSharp
Hey Mark, great point, sorry i missed. Yes it's a heavily multi threaded environement. Paulo said i should check out the code in SVN? I will ask him about the respository url to get the code from SVN? i am thankful for any more suggestions you have. Thanks Subrah Mark Storer-2 wrote: That file is horrifically mangled all right. The cross reference (xref) table at the end doesn't list all the objects in the file, not by a long shot. The root object, 69, is among those AWOL from the xref... leading to the error you're getting. WHY is it missing? I'm not sure. The xref looks like one you'd find as a result of a stamper in append mode, tacked onto the original PDF, but the rest of the file looks like it should have a single xref. The trailer makes no mention of a previous xref or xref stream. You're not explicitly setting the stamper to use append mode, so it will only go into that mode, IIRC, if forced by a signature. (And I don't see anything in the source that backs that up either, so now I'm Really Confused) Is this a single threaded environment? (he asked, grasping at straws) --Mark Storer Senior Software Engineer Cardiff.com #include disclaimer typedef std::DisclaimerCardiff DisCard; -Original Message- From: subrah [mailto:subnibh...@gmail.com] Sent: Monday, November 16, 2009 12:12 PM To: itext-questions@lists.sourceforge.net Subject: Re: [iText-questions] Root Object is invalid or missing after PDF is manipulated with iTextSharp Attached is the corrupt file. if i try to read the corrupted file using pdfreader i get the error message saying start ref not found. But the issue is that problem is not consistant. I am able to water mark the same original file 2nd time using the same code. So it's like randomly some file is not fully written. i am gussing this is because the pdfstamper is closing the memory stream earlier than it should for some reason. However what i want to confirm is that my understanding that the probelm is infact the memory stream is right or not?. Because i have implmented alternative technique to compltely avoid memory stream and pdf stamper but use pdfwriter and file stream which seem to have fixed the issue in dev. But still need to get response from a heavy testing team. Any light thrwon on this subject will be of great help to me. Thanks Subrah Mark Storer-2 wrote: A: Most of the folks on the list lean toward Java. B: If no one knows the answer, no one answers. Perhaps you could post one of your corrupted PDFs? --Mark Storer Senior Software Engineer Cardiff.com #include disclaimer typedef std::DisclaimerCardiff DisCard; -Original Message- From: subrah [mailto:subnibh...@gmail.com] Sent: Monday, November 16, 2009 8:50 AM To: itext-questions@lists.sourceforge.net Subject: Re: [iText-questions] Root Object is invalid or missing after PDF is manipulated with iTextSharp Hi All, I am wondering why nobody is interested in responding to my question? I seem to have found a fix but just wanted to confirm with experts on this forum. So any help is greatly appreciated. Thanks Subrah subrah wrote: Hi Sorry resending this post as i was not registered user earlier. i am using latest iTextSharp library to edit the pdf documents to put the water marking digitallly (hidden). So when i researched i found that i can add a annotation to the pdf document and then set the flags to annotation.Flags = PdfAnnotation.FLAGS_NOVIEW | PdfAnnotation.FLAGS_INVISIBLE | PdfAnnotation.FLAGS_HIDDEN; to make it invisible. so this is working fine as expected 90% of the time. Remaning 10 % of the time i get an error when i open the document after adding the annotation it says Root object is invalid or missing so looks like it corrupted the file trying to add the annoation. do you have any suggestion? i can share the code i am using to add the annotation if that helps. Full code public static byte[] EditPdf(string sourceFile, string visibleWaterMark, string digitalWaterMark) { PdfReader reader = new PdfReader(sourceFile); using (MemoryStream memoryStream = new MemoryStream()) { PdfStamper pdfStamper = new PdfStamper(reader, memoryStream); // process every page in the pdf file for (int i = 1; i = reader.NumberOfPages; i++) { Rectangle pageSize = reader.GetPageSizeWithRotation(i); PdfContentByte pdfPageContents = pdfStamper.GetUnderContent(i); PdfAnnotation annotation = PdfAnnotation.CreateText(pdfStamper.Writer, new Rectangle(200f, 400f, 300f, 500f), digitalWaterMark,
Re: [iText-questions] Root Object is invalid or missing after PDF is manipulated with iTextSharp
Hi Paulo, Thank you. Sorry if i am missing something. so where is the SVN repository url to check out the code for multi threading? Thanks Subrah Paulo Soares-3 wrote: Try the code in the SVN, it fixes a problem in heavy multithreading. Paulo - Original Message - From: subrah subnibh...@gmail.com To: itext-questions@lists.sourceforge.net Sent: Monday, November 16, 2009 8:12 PM Subject: Re: [iText-questions] Root Object is invalid or missing after PDF is manipulated with iTextSharp Attached is the corrupt file. if i try to read the corrupted file using pdfreader i get the error message saying start ref not found. But the issue is that problem is not consistant. I am able to water mark the same original file 2nd time using the same code. So it's like randomly some file is not fully written. i am gussing this is because the pdfstamper is closing the memory stream earlier than it should for some reason. However what i want to confirm is that my understanding that the probelm is infact the memory stream is right or not?. Because i have implmented alternative technique to compltely avoid memory stream and pdf stamper but use pdfwriter and file stream which seem to have fixed the issue in dev. But still need to get response from a heavy testing team. Any light thrwon on this subject will be of great help to me. Thanks Subrah Mark Storer-2 wrote: A: Most of the folks on the list lean toward Java. B: If no one knows the answer, no one answers. Perhaps you could post one of your corrupted PDFs? --Mark Storer Senior Software Engineer Cardiff.com #include disclaimer typedef std::DisclaimerCardiff DisCard; -Original Message- From: subrah [mailto:subnibh...@gmail.com] Sent: Monday, November 16, 2009 8:50 AM To: itext-questions@lists.sourceforge.net Subject: Re: [iText-questions] Root Object is invalid or missing after PDF is manipulated with iTextSharp Hi All, I am wondering why nobody is interested in responding to my question? I seem to have found a fix but just wanted to confirm with experts on this forum. So any help is greatly appreciated. Thanks Subrah subrah wrote: Hi Sorry resending this post as i was not registered user earlier. i am using latest iTextSharp library to edit the pdf documents to put the water marking digitallly (hidden). So when i researched i found that i can add a annotation to the pdf document and then set the flags to annotation.Flags = PdfAnnotation.FLAGS_NOVIEW | PdfAnnotation.FLAGS_INVISIBLE | PdfAnnotation.FLAGS_HIDDEN; to make it invisible. so this is working fine as expected 90% of the time. Remaning 10 % of the time i get an error when i open the document after adding the annotation it says Root object is invalid or missing so looks like it corrupted the file trying to add the annoation. do you have any suggestion? i can share the code i am using to add the annotation if that helps. Full code public static byte[] EditPdf(string sourceFile, string visibleWaterMark, string digitalWaterMark) { PdfReader reader = new PdfReader(sourceFile); using (MemoryStream memoryStream = new MemoryStream()) { PdfStamper pdfStamper = new PdfStamper(reader, memoryStream); // process every page in the pdf file for (int i = 1; i = reader.NumberOfPages; i++) { Rectangle pageSize = reader.GetPageSizeWithRotation(i); PdfContentByte pdfPageContents = pdfStamper.GetUnderContent(i); PdfAnnotation annotation = PdfAnnotation.CreateText(pdfStamper.Writer, new Rectangle(200f, 400f, 300f, 500f), digitalWaterMark, Street Events Digital Watermark, false, Key); //digital water marking annotation.Flags = PdfAnnotation.FLAGS_NOVIEW | PdfAnnotation.FLAGS_INVISIBLE | PdfAnnotation.FLAGS_HIDDEN; pdfStamper.AddAnnotation(annotation, i); pdfPageContents.BeginText(); BaseFont baseFont = BaseFont.CreateFont(BaseFont.HELVETICA_BOLD, Encoding.ASCII.EncodingName, BaseFont.NOT_EMBEDDED); pdfPageContents.SetFontAndSize(baseFont, 10); pdfPageContents.SetRGBColorFill(225, 224, 223); // visible water marking pdfPageContents.ShowTextAligned(PdfContentByte.ALIGN_RIGHT, visibleWaterMark, pageSize.Width - 50, pageSize.Height - 15, 0); pdfPageContents.EndText(); pdfStamper.FormFlattening = true; } pdfStamper.Close(); return memoryStream.ToArray(); } public static void
Re: [iText-questions] Root Object is invalid or missing after PDF is manipulated with iTextSharp
https://itextsharp.svn.sourceforge.net/svnroot/itextsharp/trunk/src/core -Original Message- From: subrah [mailto:subnibh...@gmail.com] Sent: Tuesday, November 17, 2009 4:32 PM To: itext-questions@lists.sourceforge.net Subject: Re: [iText-questions] Root Object is invalid or missing after PDF is manipulated with iTextSharp Hi Paulo, Thank you. Sorry if i am missing something. so where is the SVN repository url to check out the code for multi threading? Thanks Subrah Paulo Soares-3 wrote: Try the code in the SVN, it fixes a problem in heavy multithreading. Paulo - Original Message - From: subrah subnibh...@gmail.com To: itext-questions@lists.sourceforge.net Sent: Monday, November 16, 2009 8:12 PM Subject: Re: [iText-questions] Root Object is invalid or missing after PDF is manipulated with iTextSharp Attached is the corrupt file. if i try to read the corrupted file using pdfreader i get the error message saying start ref not found. But the issue is that problem is not consistant. I am able to water mark the same original file 2nd time using the same code. So it's like randomly some file is not fully written. i am gussing this is because the pdfstamper is closing the memory stream earlier than it should for some reason. However what i want to confirm is that my understanding that the probelm is infact the memory stream is right or not?. Because i have implmented alternative technique to compltely avoid memory stream and pdf stamper but use pdfwriter and file stream which seem to have fixed the issue in dev. But still need to get response from a heavy testing team. Any light thrwon on this subject will be of great help to me. Thanks Subrah Mark Storer-2 wrote: A: Most of the folks on the list lean toward Java. B: If no one knows the answer, no one answers. Perhaps you could post one of your corrupted PDFs? --Mark Storer Senior Software Engineer Cardiff.com #include disclaimer typedef std::DisclaimerCardiff DisCard; -Original Message- From: subrah [mailto:subnibh...@gmail.com] Sent: Monday, November 16, 2009 8:50 AM To: itext-questions@lists.sourceforge.net Subject: Re: [iText-questions] Root Object is invalid or missing after PDF is manipulated with iTextSharp Hi All, I am wondering why nobody is interested in responding to my question? I seem to have found a fix but just wanted to confirm with experts on this forum. So any help is greatly appreciated. Thanks Subrah subrah wrote: Hi Sorry resending this post as i was not registered user earlier. i am using latest iTextSharp library to edit the pdf documents to put the water marking digitallly (hidden). So when i researched i found that i can add a annotation to the pdf document and then set the flags to annotation.Flags = PdfAnnotation.FLAGS_NOVIEW | PdfAnnotation.FLAGS_INVISIBLE | PdfAnnotation.FLAGS_HIDDEN; to make it invisible. so this is working fine as expected 90% of the time. Remaning 10 % of the time i get an error when i open the document after adding the annotation it says Root object is invalid or missing so looks like it corrupted the file trying to add the annoation. do you have any suggestion? i can share the code i am using to add the annotation if that helps. Full code public static byte[] EditPdf(string sourceFile, string visibleWaterMark, string digitalWaterMark) { PdfReader reader = new PdfReader(sourceFile); using (MemoryStream memoryStream = new MemoryStream()) { PdfStamper pdfStamper = new PdfStamper(reader, memoryStream); // process every page in the pdf file for (int i = 1; i = reader.NumberOfPages; i++) { Rectangle pageSize = reader.GetPageSizeWithRotation(i); PdfContentByte pdfPageContents = pdfStamper.GetUnderContent(i); PdfAnnotation annotation = PdfAnnotation.CreateText(pdfStamper.Writer, new Rectangle(200f, 400f, 300f, 500f), digitalWaterMark, Street Events Digital Watermark, false, Key); //digital water marking annotation.Flags = PdfAnnotation.FLAGS_NOVIEW | PdfAnnotation.FLAGS_INVISIBLE | PdfAnnotation.FLAGS_HIDDEN; pdfStamper.AddAnnotation(annotation, i); pdfPageContents.BeginText(); BaseFont baseFont = BaseFont.CreateFont(BaseFont.HELVETICA_BOLD, Encoding.ASCII.EncodingName, BaseFont.NOT_EMBEDDED); pdfPageContents.SetFontAndSize(baseFont, 10);
Re: [iText-questions] How to get signature image from signed PDF?
Alexander Burkov wrote: subj. i have signed pdf and need to get image from its signature field. sorry for stupid question :) i've found answer searching by key extract Image from pdf file -- View this message in context: http://old.nabble.com/How-to-get-signature-image-from-signed-PDF--tp26391681p26394112.html Sent from the iText - General mailing list archive at Nabble.com. -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.1t3xt.com/docs/book.php Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/
Re: [iText-questions] Could not find XObject named '%s'. Browser locks up.
i compiled the new OrderedTree.cs in my solution. i'm sorry to say this did not resolve my issue. Paulo, do you plan any mulit-threading augmentations/fixes in very near future? thanks, Jason Jty wrote: Paulo, that would be fine. i'll provide you with feedback on your changes too. you can send me the file(s) with the changes to ja...@seasweb.net thanks, Jason Paulo Soares-3 wrote: You'll have to try the fix yourself in your environment, you can get the code and compile it yourself from the SVN. Release dates is with Bruno. Paulo - Original Message - From: Jty jason_ty...@hotmail.com To: itext-questions@lists.sourceforge.net Sent: Sunday, November 15, 2009 2:18 AM Subject: Re: [iText-questions] Could not find XObject named '%s'. Browser locks up. one more thing i want to add - the same outputted PDFs for printing that are problematic when served up to the browser open just fine when opened directly by Reader or Acrobat. Paulo, what is the likelihood my problem is the issue you just fixed, and if so when do you expect it's release to be available? thanks, Jason Paulo Soares-3 wrote: It's funny that I've just commited a change in the SVN to fix a multi-threading issue. Paulo - Original Message - From: Jty jason_ty...@hotmail.com To: itext-questions@lists.sourceforge.net Sent: Friday, November 13, 2009 10:53 PM Subject: [iText-questions] Could not find XObject named '%s'. Browser locks up. i have a webapp that teachers use to fill out forms for special education. i just started using iTextSharp (latest v.) to take a data entry PDF and it's data via FDF, and render it into a completely new PDF containing just the original PDFs image. i do this to ensure i get the smallest file size possible when printing. i have an intermittent error that appears when the new printed PDF is served up to the browser. i get: There was an error processing a page. Could not find XObject named '%s'. this ultimately locks up my browser. strangely enough, all signs point to this being a usage/load issue as it only happens to the PDFs that alot of users are interfacing with simultaneously. i'm not sure if its my code (see below) or the forms themselves (see attached). i find it interesting that i can not produce the error late at night when the server usage is down. also on a separate test server, using the same code, same PDFs, and zero usage everything works great! i appreciate any advice/insight anyone can provide. Jason Code: Private Sub OutputForm() Dim iTextReader As PdfReader Dim iTextStamper As PdfStamper Dim iTextWriter As PdfWriter Dim iTextDoc As Document Dim iTextImage As Image Dim iTextPage As PdfImportedPage Dim iTextFDF As FdfReader Dim memStm As New MemoryStream Dim iPage As Integer Dim sValue As String Dim htFields As New Hashtable Dim enField As IDictionaryEnumerator Try Dim sPDF As String = C:\Form1.pdf 'Read PDF FDF into memory iTextReader = New PdfReader(sPDF) iTextFDF = New FdfReader(sPDF.Replace(.pdf, .fdf)) iTextStamper = New PdfStamper(iTextReader, memStm) iTextReader.Close() 'Field Code htFields = iTextFDF.Fields enField = htFields.GetEnumerator While enField.MoveNext sValue = iTextFDF.GetFieldValue(enField.Key.ToString) If sValue.Length 0 Then iTextStamper.AcroFields.SetField(enField.Key.ToString, sValue) End If End While iTextStamper.FormFlattening = True iTextStamper.Close() 'Create/Open Writer http://old.nabble.com/file/p26344825/Form1.pdf Form1.pdf http://old.nabble.com/file/p26344825/Form1.fdf Form1.fdf iTextReader = New PdfReader(memStm.ToArray) iTextDoc = New Document(IIf(iTextReader.GetPageSize(1).Height iTextReader.GetPageSize(1).Width, iTextReader.GetPageSize(1).Rotate, iTextReader.GetPageSize(1)), 0, 0, 0, 0) iTextWriter = PdfWriter.GetInstance(iTextDoc, New FileStream(c:\Output.pdf, FileMode.Create)) iTextWriter.SetFullCompression() iTextDoc.Open() 'Copy each page from Reader to Writer as image For iPage = 1 To iTextReader.NumberOfPages iTextPage = iTextWriter.GetImportedPage(iTextReader, iPage) iTextImage = Image.GetInstance(iTextPage) If iTextReader.GetPageSize(iPage).Height iTextReader.GetPageSize(iPage).Width Then iTextImage.RotationDegrees = 90 End If iTextDoc.Add(iTextImage) Next iTextDoc.Close() Catch ex As Exception
Re: [iText-questions] Losing dynamic links after generating TOC .
That iterate through each page and import it into the Document object is where you're going wrong. While PdfCopy knows how to preserve links, the regular Document/PdfWriter combo does not. I suspect you'll have to write your TOC document out as a seperate file (or memory stream), then use PdfCopy again. --Mark Storer Senior Software Engineer Cardiff.com #include disclaimer typedef std::DisclaimerCardiff DisCard; -Original Message- From: Digumarti, Swapna [mailto:swapna.diguma...@capgemini.com] Sent: Monday, November 16, 2009 8:59 PM To: iText-questions@lists.sourceforge.net Subject: [iText-questions] Losing dynamic links after generating TOC . Hi, I am facing the following issue while merging two pdfs and then creating a toc. The requirement is that I have to merge 2 existing pdfs(provided by client which may have internal/External links). After these two pdf's are merged(I have used PdfCopy), I have to add a toc to it. The toc will have titles which are hardcoded,but the page number is generated dynamically. I start off by creating the toc which returns me a Document object. Then I iterate thru the pages of the merged document and import each page into the Document object. In doing so,I am losing any dynamic external/internal url present in the initial 2 documents that I had merged. PS:The links were not lost after the merge, they were lost only after the toc was added. PFA the two merged pdfs along with the java main class and the output pdf. Thanks in advance for the help. Swapna. This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message. -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july___ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.1t3xt.com/docs/book.php Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/
Re: [iText-questions] Could not find XObject named '%s'. Browser locks up.
There are no other known problems in that area and even that particular problem would freeze the app, not missing values. Can you try version 4.1.5? Paulo - Original Message - From: Jty jason_ty...@hotmail.com To: itext-questions@lists.sourceforge.net Sent: Tuesday, November 17, 2009 5:38 PM Subject: Re: [iText-questions] Could not find XObject named '%s'. Browser locks up. i compiled the new OrderedTree.cs in my solution. i'm sorry to say this did not resolve my issue. Paulo, do you plan any mulit-threading augmentations/fixes in very near future? thanks, Jason Jty wrote: Paulo, that would be fine. i'll provide you with feedback on your changes too. you can send me the file(s) with the changes to ja...@seasweb.net thanks, Jason Paulo Soares-3 wrote: You'll have to try the fix yourself in your environment, you can get the code and compile it yourself from the SVN. Release dates is with Bruno. Paulo - Original Message - From: Jty jason_ty...@hotmail.com To: itext-questions@lists.sourceforge.net Sent: Sunday, November 15, 2009 2:18 AM Subject: Re: [iText-questions] Could not find XObject named '%s'. Browser locks up. one more thing i want to add - the same outputted PDFs for printing that are problematic when served up to the browser open just fine when opened directly by Reader or Acrobat. Paulo, what is the likelihood my problem is the issue you just fixed, and if so when do you expect it's release to be available? thanks, Jason Paulo Soares-3 wrote: It's funny that I've just commited a change in the SVN to fix a multi-threading issue. Paulo - Original Message - From: Jty jason_ty...@hotmail.com To: itext-questions@lists.sourceforge.net Sent: Friday, November 13, 2009 10:53 PM Subject: [iText-questions] Could not find XObject named '%s'. Browser locks up. i have a webapp that teachers use to fill out forms for special education. i just started using iTextSharp (latest v.) to take a data entry PDF and it's data via FDF, and render it into a completely new PDF containing just the original PDFs image. i do this to ensure i get the smallest file size possible when printing. i have an intermittent error that appears when the new printed PDF is served up to the browser. i get: There was an error processing a page. Could not find XObject named '%s'. this ultimately locks up my browser. strangely enough, all signs point to this being a usage/load issue as it only happens to the PDFs that alot of users are interfacing with simultaneously. i'm not sure if its my code (see below) or the forms themselves (see attached). i find it interesting that i can not produce the error late at night when the server usage is down. also on a separate test server, using the same code, same PDFs, and zero usage everything works great! i appreciate any advice/insight anyone can provide. Jason Code: Private Sub OutputForm() Dim iTextReader As PdfReader Dim iTextStamper As PdfStamper Dim iTextWriter As PdfWriter Dim iTextDoc As Document Dim iTextImage As Image Dim iTextPage As PdfImportedPage Dim iTextFDF As FdfReader Dim memStm As New MemoryStream Dim iPage As Integer Dim sValue As String Dim htFields As New Hashtable Dim enField As IDictionaryEnumerator Try Dim sPDF As String = C:\Form1.pdf 'Read PDF FDF into memory iTextReader = New PdfReader(sPDF) iTextFDF = New FdfReader(sPDF.Replace(.pdf, .fdf)) iTextStamper = New PdfStamper(iTextReader, memStm) iTextReader.Close() 'Field Code htFields = iTextFDF.Fields enField = htFields.GetEnumerator While enField.MoveNext sValue = iTextFDF.GetFieldValue(enField.Key.ToString) If sValue.Length 0 Then iTextStamper.AcroFields.SetField(enField.Key.ToString, sValue) End If End While iTextStamper.FormFlattening = True iTextStamper.Close() 'Create/Open Writer http://old.nabble.com/file/p26344825/Form1.pdf Form1.pdf http://old.nabble.com/file/p26344825/Form1.fdf Form1.fdf iTextReader = New PdfReader(memStm.ToArray) iTextDoc = New Document(IIf(iTextReader.GetPageSize(1).Height iTextReader.GetPageSize(1).Width, iTextReader.GetPageSize(1).Rotate, iTextReader.GetPageSize(1)), 0, 0, 0, 0) iTextWriter = PdfWriter.GetInstance(iTextDoc, New FileStream(c:\Output.pdf, FileMode.Create)) iTextWriter.SetFullCompression() iTextDoc.Open() 'Copy each page from Reader to Writer as image For iPage = 1 To iTextReader.NumberOfPages iTextPage = iTextWriter.GetImportedPage(iTextReader, iPage)
Re: [iText-questions] Could not find XObject named '%s'. Browser locks up.
the repository goes from 4.1.6 - 4.1.2 , did you mean 4.1.2? Jason Paulo Soares-3 wrote: There are no other known problems in that area and even that particular problem would freeze the app, not missing values. Can you try version 4.1.5? Paulo - Original Message - From: Jty jason_ty...@hotmail.com To: itext-questions@lists.sourceforge.net Sent: Tuesday, November 17, 2009 5:38 PM Subject: Re: [iText-questions] Could not find XObject named '%s'. Browser locks up. i compiled the new OrderedTree.cs in my solution. i'm sorry to say this did not resolve my issue. Paulo, do you plan any mulit-threading augmentations/fixes in very near future? thanks, Jason Jty wrote: Paulo, that would be fine. i'll provide you with feedback on your changes too. you can send me the file(s) with the changes to ja...@seasweb.net thanks, Jason Paulo Soares-3 wrote: You'll have to try the fix yourself in your environment, you can get the code and compile it yourself from the SVN. Release dates is with Bruno. Paulo - Original Message - From: Jty jason_ty...@hotmail.com To: itext-questions@lists.sourceforge.net Sent: Sunday, November 15, 2009 2:18 AM Subject: Re: [iText-questions] Could not find XObject named '%s'. Browser locks up. one more thing i want to add - the same outputted PDFs for printing that are problematic when served up to the browser open just fine when opened directly by Reader or Acrobat. Paulo, what is the likelihood my problem is the issue you just fixed, and if so when do you expect it's release to be available? thanks, Jason Paulo Soares-3 wrote: It's funny that I've just commited a change in the SVN to fix a multi-threading issue. Paulo - Original Message - From: Jty jason_ty...@hotmail.com To: itext-questions@lists.sourceforge.net Sent: Friday, November 13, 2009 10:53 PM Subject: [iText-questions] Could not find XObject named '%s'. Browser locks up. i have a webapp that teachers use to fill out forms for special education. i just started using iTextSharp (latest v.) to take a data entry PDF and it's data via FDF, and render it into a completely new PDF containing just the original PDFs image. i do this to ensure i get the smallest file size possible when printing. i have an intermittent error that appears when the new printed PDF is served up to the browser. i get: There was an error processing a page. Could not find XObject named '%s'. this ultimately locks up my browser. strangely enough, all signs point to this being a usage/load issue as it only happens to the PDFs that alot of users are interfacing with simultaneously. i'm not sure if its my code (see below) or the forms themselves (see attached). i find it interesting that i can not produce the error late at night when the server usage is down. also on a separate test server, using the same code, same PDFs, and zero usage everything works great! i appreciate any advice/insight anyone can provide. Jason Code: Private Sub OutputForm() Dim iTextReader As PdfReader Dim iTextStamper As PdfStamper Dim iTextWriter As PdfWriter Dim iTextDoc As Document Dim iTextImage As Image Dim iTextPage As PdfImportedPage Dim iTextFDF As FdfReader Dim memStm As New MemoryStream Dim iPage As Integer Dim sValue As String Dim htFields As New Hashtable Dim enField As IDictionaryEnumerator Try Dim sPDF As String = C:\Form1.pdf 'Read PDF FDF into memory iTextReader = New PdfReader(sPDF) iTextFDF = New FdfReader(sPDF.Replace(.pdf, .fdf)) iTextStamper = New PdfStamper(iTextReader, memStm) iTextReader.Close() 'Field Code htFields = iTextFDF.Fields enField = htFields.GetEnumerator While enField.MoveNext sValue = iTextFDF.GetFieldValue(enField.Key.ToString) If sValue.Length 0 Then iTextStamper.AcroFields.SetField(enField.Key.ToString, sValue) End If End While iTextStamper.FormFlattening = True iTextStamper.Close() 'Create/Open Writer http://old.nabble.com/file/p26344825/Form1.pdf Form1.pdf http://old.nabble.com/file/p26344825/Form1.fdf Form1.fdf iTextReader = New PdfReader(memStm.ToArray) iTextDoc = New Document(IIf(iTextReader.GetPageSize(1).Height iTextReader.GetPageSize(1).Width, iTextReader.GetPageSize(1).Rotate, iTextReader.GetPageSize(1)), 0, 0, 0, 0) iTextWriter = PdfWriter.GetInstance(iTextDoc, New FileStream(c:\Output.pdf, FileMode.Create)) iTextWriter.SetFullCompression() iTextDoc.Open() 'Copy each page from Reader to Writer as image For iPage = 1 To
Re: [iText-questions] Root Object is invalid or missing after PDF is manipulated with iTextSharp
Sorry Just had a meeting ..i am running in to go/ no go situation here. quite a lot of files there(SVN).. any specfic ones you'd like me to look at for multi threading? i feel so close yet not fully there.. any help would be much appreciated here.. i have attached more files which were corrupted even though i used file stream instead of memory stream.. Atached are files File names Originals 1809472_Transcript_7_2008-02_06-06-02.pdf 1809475_Transcript_7_2008-02_05-51-03.pdf Files names after water marking - corrupted 1809472_Transcript_7_2008-02_06-06-02_3055364.pdf 1809472_Transcript_7_2008-02_06-06-02_3055365.pdf my current code - avoded memoery stream and using file stream that did not help either (:. Same orignal files would NOT be corrupt if i re processed them. This is why i am having hard time. not consitant here. public static void WaterMarkPdf(string sourceFile, string destinationFile, string waterMark) { PdfReader reader = new PdfReader(sourceFile); using (FileStream fStream = new FileStream(destinationFile, FileMode.Create, FileAccess.ReadWrite)) { PdfStamper pdfStamper = new PdfStamper(reader, fStream); // process every page in the pdf file for (int i = 1; i = reader.NumberOfPages; i++) { Rectangle pageSize = reader.GetPageSizeWithRotation(i); PdfContentByte pdfPageContents = pdfStamper.GetUnderContent(i); PdfAnnotation annotation = PdfAnnotation.CreateText(pdfStamper.Writer, new Rectangle(200f, 400f, 300f, 500f), waterMark, Digital Watermark, false, Key); //digital water marking annotation.Flags = PdfAnnotation.FLAGS_NOVIEW | PdfAnnotation.FLAGS_INVISIBLE | PdfAnnotation.FLAGS_HIDDEN; pdfStamper.AddAnnotation(annotation, i); pdfPageContents.BeginText(); BaseFont baseFont = BaseFont.CreateFont(BaseFont.HELVETICA_BOLD, Encoding.ASCII.EncodingName, BaseFont.NOT_EMBEDDED); pdfPageContents.SetFontAndSize(baseFont, 10); pdfPageContents.SetRGBColorFill(225, 224, 223); // visible water marking Rectangle pdfCropBox = reader.GetCropBox(i); float posX = pdfCropBox.Width pageSize.Width ? pdfCropBox.Width : pageSize.Width; float posY = pdfCropBox.Height pageSize.Height ? pdfCropBox.Height : pageSize.Height; pdfPageContents.ShowTextAligned(PdfContentByte.ALIGN_RIGHT, waterMark, posX - 50, posY - 15, 0); pdfPageContents.EndText(); pdfStamper.Writer.CloseStream = false; pdfStamper.FormFlattening = true; } pdfStamper.Close(); } } Thanks Subrah Paulo Soares-3 wrote: https://itextsharp.svn.sourceforge.net/svnroot/itextsharp/trunk/src/core -Original Message- From: subrah [mailto:subnibh...@gmail.com] Sent: Tuesday, November 17, 2009 4:32 PM To: itext-questions@lists.sourceforge.net Subject: Re: [iText-questions] Root Object is invalid or missing after PDF is manipulated with iTextSharp Hi Paulo, Thank you. Sorry if i am missing something. so where is the SVN repository url to check out the code for multi threading? Thanks Subrah Paulo Soares-3 wrote: Try the code in the SVN, it fixes a problem in heavy multithreading. Paulo - Original Message - From: subrah subnibh...@gmail.com To: itext-questions@lists.sourceforge.net Sent: Monday, November 16, 2009 8:12 PM Subject: Re: [iText-questions] Root Object is invalid or missing after PDF is manipulated with iTextSharp Attached is the corrupt file. if i try to read the corrupted file using pdfreader i get the error message saying start ref not found. But the issue is that problem is not consistant. I am able to water mark the same original file 2nd time using the same code. So it's like randomly some file is not fully written. i am gussing this is because the pdfstamper is closing the memory stream earlier than it should for some reason. However what i want to confirm is that my understanding that the probelm is infact the memory stream is right or not?. Because i have implmented alternative technique to compltely avoid memory stream and pdf stamper but use pdfwriter and file stream which seem to have fixed the issue in dev.
Re: [iText-questions] Root Object is invalid or missing after PDF is manipulated with iTextSharp
Date: Tue, 17 Nov 2009 12:22:09 -0800 From: To: itext-questions@lists.sourceforge.net Subject: Re: [iText-questions] Root Object is invalid or missing after PDF is manipulated with iTextSharp Sorry Just had a meeting ..i am running in to go/ no go situation here. quite a lot of files there(SVN).. any specfic ones you'd like me to look at for multi threading? i feel so close yet not fully there.. any help would be much appreciated here.. i have attached more files which were corrupted even though i used file stream instead of memory stream.. Atached are files an also search the keywords list: http://1t3xt.info/tutorials/keywords/ I haven't been following this in detail but, and someone who use itext please correct me if wrong, generally the document processing is a single threaded operation unless you try to split up tasks to avoid waiting for IO etc. As I understood the OP, the problem seems to relate to using one JVM to process separate pages concurrently. Asynchronous and indpenedent requests come in and some how they get intermingled. This would seem difficult as you would think each request sets up its own objects but things like static variables or collections would be suspects- often these are caches or general junk bins based on hashtables or other collections. Is the above essentially right? If so, I would also mention one more philosophical note related to Java. Many base classes are synchronized so everyone thinks they are thread safe but of course safe depends on what you are trying to do. Apps generally find blanket class synchonization useless and an invitations for derived classes to create deadlock. So, further, you would hope that itext is NOT designed to be thread safe unless that idea can be reasonably defined for everyone who wants to use it. Also, everything else in your post just suggests it is a threading problem- unreproducible, confusing, or logically impossible results usually are related to timing. In Java anyway, where you don't have the freedom to corrupt memory, they almost always are. Mike Marchywka _ Hotmail: Trusted email with Microsoft's powerful SPAM protection. http://clk.atdmt.com/GBL/go/177141664/direct/01/ http://clk.atdmt.com/GBL/go/177141664/direct/01/ -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.1t3xt.com/docs/book.php Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/
Re: [iText-questions] RTF - problem in cross references
Hi Mark, On many posting I read that internal links are not supported in RtfWriter2 but could not find any explanation why. Is this a limitation imposed by the RTF definition? If not is this feature planed on the road map? Thanks, Alain -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.1t3xt.com/docs/book.php Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/