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/
