Has anyone used itextsharp to add/insert a pdf form to another form and not lose the form fields. I tried it and it doesn't retain the form fields.
Thanks!
Please read chapter 6 of my book "iText in Action". It explains that you lose fields when using PdfWriter or PdfCopy and it explains that you should use the PdfCopyFields class.
Related
I am working on a prototype using iText7 for C#. The PDF I am using is an XFAForm PDF and was created in Adobe Live Cycle Designer. From my research, XFAForms do not support annotations. I was going to add an annotation to the field with a link.
I want to be able to edit the value in a field to include a URL. For example,
Name : Marc
should be:
Name : Marc https://www.google.com
I am able to modify the value in this field, but no luck adding a URL that is clickable. I have tried the following:
element.Add(new XAttribute("href", injectedURL)); element is an XElement
Injecting HTML as the new value with a link
I was thinking about reading the XML, parsing it and injecting the URL in the XML and then writing it back to the PDF, but I do not feel that is a good solution.
Has anyone been able to do this?
I have a static PDF Form created by Adobe Designer. In the properties of the text fields I can see the DataBinding value (the form is bound to an XML Schema).
I'm trying to read this information by means of Apache PDFbox 2.0 but I can get all the info but for this...
Have you any tip?
Thank you very much
Regards
Fabio
when you create a static PDF Form using the Adobe LiveCycle Designer there are two form definitions - the AcroForm and the XFA. The AcroForm has some of the form definitions of the design being done in the Designer but not all of them. The binding information unfortunately is not part of that. What you need to do is extract the XFA and get the binding from the XFA part.
We're using mPDF, but when combining PDF files with Acrobat form fields, the output result strips the form fields.
I've combed through the documentation, looked extensively online, and I can't find a solution that works with mPDF.
mPDF uses FPDI in the back which simply does not support importing of form fields.
Update: As of mPDF 7 you can create fillable forms within PDFs dynamically - :D !
I'm reading in a PDF document with fillable fields, and using PdfStamper to fill in the form, the output of from the stamper is a read only PDF, how can make it output a PDF document with the fields filled but still fillable?
Are you using setFormFlattening(true)? If so, then the behavior is normal. Change true to false and the form will remain "fillable". Learn about the difference by reading my answer to this question: iText How to create multi-page document from a fillable template
This is the most likely reason why your form is no longer interactive: you are removing all the interactivity by flattening the form. (If that's not the case, please share your code so that we can see what is going on.)
Or... is your PDF reader-enabled? If so, use PdfStamper in append mode. Maybe you're experiencing the problem explained in the question Why do I get an error saying that "use of extended features is no longer available"?
I have created a PDF file using Acrobat Adobe 8 that contains fillable fields.
Can that be programmed with ITextSharp instead of Adobe?
Note: I am not referring to filling out the PDF with ITextSharp, instead I would like to create the fillable fields on the PDF file using ITextSharp.
Any code would be appreciated.
thank you for your time!
You can create PDFs that contain fillable fields with iText[Sharp], but they won't look as nice as Adobe Acrobat, which is a much better design tool.
By fillable fields, I'm guessing you mean a TextField. Here's a link with some simple example code from the book to get you started. Specifically, take a look at the CreatePdf() and CellLayout() methods, and the iText API if you need more information.