Robert,
What we did, and this is not for forms but flat files for document comparison, is during PDF creation we set an RTF flag. If the flag is set, we create an RTF at the same time we are creating the PDF. RTF doesn't handle page events like PDF, so we just piggy back the RTF API calls with the PDF API calls so when the header events fire for PDF, we create a header for RTF. Same with all other events. When the document is finished processing, we discard the PDF and save the RTF for comparison, which there a numerous tools for RTF comparison on the market or just use MS Word. By using the RTF compare we can be assured that text has not changed either in position or content. The usual items such as date and time stamps get caught ever time, so during creation we also do not render these items, thus giving us the ability to compare static files for regression. When document comparison passes regression, we turn the RTF flag off so that only PDF is created. Not sure if this methodology will work with forms. Regards, _______________________________________________________ Kevin Hendricks From: Mark Storer [mailto:[email protected]] Sent: Friday, May 28, 2010 10:03 AM To: Post all your questions about iText here Subject: Re: [iText-questions] Spam: Unit testing flattened PDFs Unit testing PDF is Notoriously Difficult. Ideally, you'd save the coordinates of your various fields and run OCR on your resulting flattened PDF, looking for the correct text in the correct place. Realistically? Umm... ouch. Actually, the pdf.parser.PdfTextExtractor could be Quite Helpful. Yeah... ! Check out SimpleTextExtractingPdfContentStreamProcessor. With a name like that, it must be easy, right? Urgh. Note that it won't pay attention to things like clipping & background-versus-foreground color. Your text might be invisible in Acrobat and still be returned by STEPCSP. Step-cusp. It's even pronounceable. --Mark Storer Senior Software Engineer Cardiff.com import legalese.Disclaimer; Disclaimer<Cardiff> DisCard = null; ________________________________ From: Robert Spielmann [mailto:[email protected]] Sent: Friday, May 28, 2010 5:08 AM To: iText ML Subject: Spam: [iText-questions] Unit testing flattened PDFs Hello world, we are currently using iText to fill form fields with data. We also use flattening in order to remove the fields afterwards. My question: how would we go about unit testing our PDF creation code? Is it possible to remember the bounding box of a form field, then check the text put in place of the field? Any other ways? -- Mit freundlichen Grüßen | Best regards Robert Spielmann | IT Consultant codecentric AG | Merscheider Straße 1 | 42699 Solingen | Deutschland tel: +49 (0) 212.23362842 | fax: +49 (0) 212.23362879 | mobil: +49 (0) 151.14705709 www.codecentric.de | blog.codecentric.de | www.meettheexperts.de | www.more4fi.de Sitz der Gesellschaft: Düsseldorf . HRB 63043 | Amtsgericht Düsseldorf Vorstand: Klaus Jäger (Vorsitzender) . Mirko Novakovic . Rainer Vehns Aufsichtsrat: Patric Fedlmeier (Vorsitzender) . Bernd Klinkmann . Jürgen Schütz Diese E-Mail einschließlich evtl. beigefügter Dateien enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und löschen Sie diese E-Mail und evtl. beigefügter Dateien umgehend. Das unerlaubte Kopieren, Nutzen oder Öffnen evtl. beigefügter Dateien sowie die unbefugte Weitergabe dieser E-Mail ist nicht gestattet. No virus found in this incoming message. Checked by AVG - www.avg.com Version: 9.0.819 / Virus Database: 271.1.1/2895 - Release Date: 05/27/10 23:25:00
------------------------------------------------------------------------------
_______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.itextpdf.com/book/ 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/
