In our application we are using Itext Pdf 5.5.3 library.
We have checked with some of the pdfs in which Checkboxes displayed correctly(check/uncheck) .
However there are some pdf with RadioBoxes and do not display radiobutton(on/off) correctly.
I also use this link to validate pdfs and java code
String[] values = form.getAppearanceStates("Checkbox");
return null values.
Also tried Itext RUPS and found that pdf which are working shows Form Field Names in RUPS Form Tab. And PDfs which are not working do not display form fields.
I tried generating pdf from word document and it doesn't display form fields in RUP , neither I can check/uncheck checkbox in Adobe Acrobat Reader.
What could be the solution to display radiobutton with check on / off ?
Edit -
I had created sample web application to reproduce the issue.
Please setup attached web application and let me know the fix for the issue.
Please download from this link
You have successfully discovered the difference between interactive PDF forms and "flat" PDF documents that look like a form to the human eye, but that aren't interactive forms.
To make the "flat" forms interactive, you need to open those flat documents in PDF editing software (e.g. Adobe Acrobat) and you need to add a form field manually.
You can ask Acrobat to guess where it should add fields, but Acrobat will be wrong in many cases for obvious reasons. You always need a human if you want it to be done correctly.
As for creating an interactive PDF from Word... Forget about it. Use OpenOffice or LibreOffice.
Related
I have created a XML file using R-exams out of just a single exercise to be imported to Moodle. I would like to view it before uploading it in the Moodle question bank. I tried to open it with Firefox and I can see some code but not the output and a message appear saying that the XML file does not seem to have a style sheet associated to it. Is there a way to find this style sheet and to see how the question comes out just using a browser like Firefox or Chrome?
To emulate how the R/exams exercises are converted to HTML by exams2moodle() and how Moodle displays mathematical content, it's best to use
exams2html(..., converter = "pandoc-mathjax")
In recent versions of R/exams the resulting HTML file then automatically loads the MathJax Javascript that enables correct rendering of mathematical content in all modern browsers (including Google Chrome). See also http://www.R-exams.org/tutorials/math/ for some general advice about math in HTML.
To the best of my knowledge there is no tool that would quickly display Moodle XML files in such a way that you can easily assess them.
EDIT: Link to test files below.
As part of a project, I have created dynamic PDF forms in LiveCycle Designer 11.0. These forms are set to be reader enabled in Acrobat before being forwarded to the developer. He then populates the PDF using iTextSharp 5.5.6.
This form has many dynamic properties including hidden fields, dynamic subforms, etc.
When the generated form is opened in Adobe Reader 11.0.12 (my version, but others are affected), the form is a) read only and b) does not show all of the dynamic fields even though the criteria has been satisfied to display them and they have been filled with data. Some are shown.
When it is opened in Adobe Acrobat 11.0.9, the form renders as expected. Sections & fields are displayed/hidden as the form's logic dictates. The form is also fillable, it is not read only or flattened.
When I compare the Security settings of the forms in Acrobat, vs Reader, the "Filling of form fields" setting in Acrobat is set to "Allowed", while it is set to "Not Allowed" in Reader's Security settings.
Here is a link to a zip containing the following:
1) A dynamic PDF generated in iTextSharp
2) An auto-generated class file for the form
3) The data mapping Program.cs file
Link to Test file showcasing the issue
When the file is opened in Acrobat, it works as expected. When it is opened in Reader, it becomes read only and both SignatureA and SignatureB are displayed, when only one should be shown based on which radiobutton is selected in the Signature Test section.
I do not have access to the codebase, so I cannot test the application on my end. Is there any setting in iTextSharp that may be causing this problem?
Thanks for any help you can provide!
Your PDF is not updated by an incremental update, which destroys the "reader enabled" feature (the digital signature becomes invalid due to a full rewrite).
You shall create the PdfStamper instance in append mode:
iTextSharp.text.pdf.PdfStamper stamper = new iTextSharp.text.pdf.PdfStamper(reader, ms, '\0', true);
Using Adobe Acrobat, if you choose Add or Edit Fields... from the Forms menu on a file with no fields, you get a pop-up with a message
Currently, there are no form fields in this PDF. Do you want Acrobat
to detect form fields for you?
Is there a way of accomplishing this sort of of field detection using iText?
Not out of the box but the API exists that you could build your own.
Adobe Acrobat is a PDF renderer and as such it can actually "look" at a PDF as a human does. It "sees" a line with text "near" it and can say with a fair amount of certainty that the line represents a field and the text represents the field's label. Same with circles and squares for radio buttons and check boxes. This document actually describes all of the shapes that Adobe Acrobat searches for.
Adobe's technology, however, assumes that a human will confirm and fix any problems that occur, usually using Adobe's technology:
After running the auto field detection process on a form, check it to make sure the correct fields have been created.
So even if iText supported this, you'd still have to open the PDF in Adobe Acrobat to check and fix things anyway.
But if you want to build your own you could use something like this or this to get at the lines. And this to get at the text.
I know that forms in .pdf made by Adobe Acrobat can act like questionnaire or application blank for filling input fileds and saving results, but is it possible in a way to add more interactiviry to them
- add file upload or attachment to resulting document?
It's kind of possible.
You'll need to add Javascript code to your documents. The code should show Browse For File dialog and import selected file to the document. Please have a look at Import Named File Attachment script (at the bottom of the page). I doubt that this solution will work in Adobe Reader or alternative PDF viewers, but Acrobat Professional should do the trick.
Another solution is given is this thread on Adobe forums:
...I figured out a roundabout way to attach files in adobe reader (not
the full blow adobe acrobat reader). Via Adobe Acrobat 9 Pro I
created a blank form with the "comment/mark up" tools enabled. Then I
merged that file with the other PDF form that was formatted with
fields, radial buttons etc. I had to create the blank form for the
attachments separately because if I tried to enable the "comment/mark
up' tool on the form with fields and radial buttons it disabled the
fields. ... The comment markup tool then allowed me to attach files
via the "attach file as a comment" option.
Are there any good alternatives to Adobe Acrobat for creating interactive PDFs? The terminology is a little fuzzy here - by interactive, I mean "able to be filled in", and not necessarily "scriptable". So this form would be for data collection, rather than report generation which seems to be the common scenario for pdf-related questions on SO.
The trick is that they need to be fillable using Adobe Reader. For those who have not experienced the many frustrations of Acrobat - by default, Reader cannot fill in a form unless it was created using Acrobat Pro >8.0 and has specifically enabled usage rights. That's fine and it basically works (except then Pro users can't save their data - WTF?).
Because I am getting frustrated, I would ideally like to avoid Adobe products altogether (that is on the design side, for the users Reader is still a necessity or I would just do it as a db-backed web form). I'm wondering if anyone has has good experiences with alternatives? Either software libraries or products?
Thanks!
EDIT - Thanks, matt b - I'd seen iText before but didn't know it could create forms. Unfortunately, it looks like Reader cannot save filled-in data to the forms generated by iText (or generated by OO Writer). I've got the nasty feeling that what I want is fundamentally impossible except using Adobe's own rights management tools. If there are other ideas. I'd love to hear them.
You can create fillable form PDFs using OpenOffice.org as well as LibreOffice.
To create the initial form elements in the *.odt documents, enable the View --> Toolbars --> Form Controls tools, which allow you to add clickable checkboxes + radiobuttons, fillable text fields, pushbuttons and some more to the page(s).
When you're finished with your document, use File --> Export as PDF with the checkbox Create PDF form enabled.
Now your PDF form will be editable (and saveable!) with any non-Adobe PDF viewer.
NOTE, however: Adobe uses an own proprietary way to create and fill PDF forms. Adobe Reader does only support to fill PDF forms which were created by an Adobe product (and which have been assigned 'extended rights' so Reader can indeed save the formdata alongside the document).
Adobe Reader will not work with PDF forms you created with OpenOffice.org or LibreOffice ('work' in the sense of: 'allows you to fill+save the form data'.). The technical mechanism behind this is that Adobe digitally sign their form documents with their own key (which is known to the Adobe Reader, and which you agreed to not reverse engineer when you accepted the Adobe Reader EULA...). --
This means:
Non-Adobe PDF Readers will not be able to 'fill+save' forms created with Adobe products (they can 'fill+print' them however).
Adobe PDF readers will refuse to 'fill+save' forms created with non-Adobe products (they will 'fill+print' them however).
The latter two points will be true for all the tools and utilities mentioned in the other answers to this question. If I'm mistaken here, please let me know in a comment...
iText is pretty much the standard in the java-world for generating PDF files programmatically. Perhaps it can also be used to create PDFs with forms in them as you would like?
The open source page layout tool Scribus has a bunch of features oriented to creating interactive PDF forms. I haven't personally used them, but they appear reasonably complete and are covered by the tutorial.
Scribus is worth knowing about if you ever need to do serious page layout in any case.
XSL FO is some thing we used to create PDF files out of existing form data. Unless you want the fillable pdf to be sent out the client, this is a valid option.
IText lets you create Annotations (there are essentially 3 types of 'interactive' components - forms (old style FDF and new XFA) and Annotations. Acrobat and lots of third party tools should let you modify the Annotations values.
There is also a DotNet version of IText called ISharp - both are freeand extremely powerful.
CutePDF Pro allows you to turn a PDF into an interactive form.
Foxit reader allows you to save any pdf with the filled in fields.
I recently dabbled with Scribus. I found it to be an excellent tool if one has enough time to configure and play around with it. I highly recommend it. Wufoo is also very good.
I am not a fan of Acrobat / Adobe. A software should make my life easier not challenge me at every step.
If you search the net with these keywords - FREE FORM CREATOR and you can add the word HTML5.
You will find an array of sites where you can log online and all your clients can have their separate login, fill in data and the form remains in the Cloud and declutter your hard drive. All stakeholders can access the form and edit at anytime. The account can be used as a folder for your business. These forms can be accessed on any device and any platform.
Many of these forms are HTML5 driven, they are so beautiful and fluid. Keep away from macros, they carry viruses.
www.homebasedofficeservices.com