Java Itext digital signature message signature valid - itext

I am using java Itext to generate digital signature.
pdfsignatureappearence i am able to modify reason lication font and signature is valid and i even able to get green tick mark.
When we open pdf we see message signature valid on top of digital signature.
I want to custom this message
Is it from itext or pdf viewer like Adobe?
Please advuce how can we customize this message ?how and where this text is appearing?
Signature valid on top of digital signature

In a comment you clarify:
consider this image i want to remove or modifty "Siganture valid" text on top of signature
If you get this text in a signature generated by a current iText 5 version, this means that you actually explicitly requested to get it.
Adobe Acrobat only shows signature validity symbols and texts inside the document, stacked onto the signature appearance for signatures that have a specific structure. Adobe Acrobat itself since version 6 by default does not use this structure anymore. Furthermore, these structures are not mentioned in the PDF specification (only in old, proprietary Adobe documents). Current PDF specifications actually forbid that the validation result is presented in the document area. For more details read this answer.
iText 5 only generates signatures with that specific structure if you ask for pre-Acrobat 6 layers, e.g. for a PdfSignatureAppearance appearance:
// Java
appearance.setAcro6Layers(false);
// C#
appearance.Acro6Layers = false;
To not make Adobe Acrobat show "Signature valid" (or the corresponding text in one's selected language), set Acro6Layers to true or don't touch it at all as true is the default.

Related

heading and sub-heading extraction from PDF

I am currently working in extracting text from pdf. my current issue is in distinguishing the headings and sub-headings from the extracted text. I am working with iTextSharp and using the bold text information to detect the heading. The font size cannot be trusted all the time. also tried with PDFBox.
1)I would like to know is there any method to identify headings and sub-headings from PDF.
2)Is adobe or pdfExchange editor provide any API for the same?
For example:
I need to extract
"Tourism in 2040:
Bringing an additional one million visitors
per year to paradise" as heading
"Executive Summary" as sub-heading
Even though this can be extracted using bold text info, it failed in a lot of cases. That's why looking for APIs.

IText Pdf - RadioBox(On/Off) not appearing for some pdf

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.

Adobe Livecycle (XFA) forms generated by iTextSharp render differently in Acrobat and Reader

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);

Field Detection using iText

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.

asp.net web application to convert pdf to word

Is there any clear and proper process to convert a pdf file into a word file with all formatting and images in asp.net web application?
The best way to do that is by using the OCR. It will recognize the text and the images in the PDF file, and then you can save it on a DOC file. I know a third party toolkit named leadtools that should help you doing your requirements, since it support the ASP.NET environment. You can check their Online OCR Demo
Also, you can check their website for more information, or contact their support team.
PDF is a presentational format where all the content is placed by absolute positions. There are no paragraphs and other structured elements (unless it is a Tagged PDF). Technically, you can output every word character by character in any order, but visually it would look like a normal text. Thus, to make a proper conversion to word it is required to do content recognition or some kind of OCR (e.g. ABBYY FineReader)
There are some paid components on the market that allow to do text extraction and some do converting pages to images (obviously, this is not a desired approach for converting into word).