Op 8/08/2012 9:18, David Horák schreef:
Hello everyone!

Please subscribe to the mailing-list if you want to continue the conversation. An administrator had to approve your mail manually, and you may not receive further responses by the community.
You are receiving this mail only because your address was added in Bcc:


The reason I am writing to you regards the creation of pdf forms with the iTextSharp library. Despite having read many articles about this matter, as well as consulted several developers, I have not been able to resolve my issue. I hope some of you could at least point me in the right direction.

To get to the point - my website collects user input from various textboxes. One of them, however, can be up to 60000 characters in length. All the user input compiles in the pdf to constitute a letter, with the abovementioned textbox being the main body of the letter.
The pdf template has been created with Acrobat.

Are you sure? Which version of Acrobat?
This is important because there are two flavors of forms.

Forms created using Adobe Acrobat are based on AcroForm technology. They are static. A text field that measures 7 by 3 inches will remain 7 by 3 inches no matter how much or how little content you're adding. There is nothing you can do about that. If you want the form to expand based on the data, you've created the wrong type of form.

Forms created by Adobe LiveCycle Designer (this tool comes for free with Adobe Acrobat) are based on the XML Forms Architecture (XFA). There are static XFA forms and dynamic XFA forms. In the case of dynamic XFA, the PDF format is used as a container for XML. You can design the form in such a way that it adapts to its content. I think that's what you want to do.

All fields are set to extend vertically to fit in text, but this is sadly not the case. If more characters are entered by the user in the main body of the letter (one of the textboxes), only so much of the text is visible, since only one page is created. At the bottom of the letter, however, there has to be the sender's address (obtained from another textbox), and this should only be on the last page of the pdf file. The issue now is how to produce such a multipage document based on the length of the main body textbox if different template should be used for the last than for other pages. I am trying not to hardcode all the possible textbox lengths in code behind, as this would be very inefficient. What method would you recommend? I'm perhaps thinking of splitting the main body textbox string in substrings, and then based on the number of substrings, where each would fill out one page, generating a new page in pdf.

What does the end result have to look like?
Does it still have to be an interactive form? If so, please throw away your current form and create a dynamic XFA form. You can fill out this form using iText like this: http://itextpdf.com/examples/iia.php?id=165

Can it be a flattened PDF (all interactivity is lost)? Then you have several options. You can create an XFA form, and use XFA Worker to flatten it. The first version of XFA Worker will be released in a couple of weeks. You can already test it here: http://demo.itextsupport.com/xfademo/ Another option is to forget all about creating a template, and create the PDF from scratch (maybe use a single PDF as 'stationery' in the background). Or you could opt for a solution somewhere in between, for instance by creating the template in HTML and convert that HTML to PDF using XML Worker.

Before asking any further questions, please take a look at this video: http://itextpdf.com/summit.php#talk3 It will be so much easier to discuss the different options if you fully understand what is explained in that talk.
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Reply via email to