How to get the Elements of a pdf using iText java - itext

I have trouble in getting a element from pdf i.e., Signature and I want to append signature image beside the Signature Field.
I found that it is not AcroField.

Related

This file has Custom XML elements that are no longer supported in Word. Saving the file will remove these elements permanently

One of my customers has reported seeing the following message when working in documents created from templates that I provided:
This file has Custom XML elements that are no longer supported in Word. Saving the file will remove these elements permanently.
I understand that this message relates to Custom XML Markup (https://learn.microsoft.com/en-us/office/troubleshoot/word/custom-xml-elements-not-supported). I can confirm that there is no Custom XML Markup in the document.
Any idea what could be causing this error to display?

Create field in xsl-fo where image signature with PdfStamper will be placed

I need to create a placeholder (sign1) in xsl-fo so that the produced pdf could be signed in a proper place afterwards.
To sign I use iText:
PdfSignatureAppearance appearance....
appearance.setVisibleSignature("sign1");
appearance.setImage(image);

iTextSharp convert to .pdf - change MIME Type

Resolved:
This had nothing to do with iTextSharp. The culprit is XMPIE and how it renders pdfs.
I'm using iTextSharp to convert .pngs to pdfs.
Here's a snippet of code:
var image = iTextSharp.text.Image.GetInstance(imageBytes);
document.Add(image);
My question is: does this actually convert the .png to a .pdf? Does it change the Mime type?
I am trying to use the converted image in XMPIE, which does not support .pngs. The "conversion" seems to work -- meaning that I get a pdf that has my image on it. But when I try to display that image in xmpie it displays all blurred out and grey. The "conversion" works with .jpegs but not .pngs.
Is there another way to convert an image (.png) to a .pdf. My code just seems to add the image to the .pdf and doesn't actually change the mime type.

showing bullets, numbering and images in pdf

In an asp.net mvc-2 application I need to export a view to pdf. I am using itextsharp to generate pdf. In the application I have documents which contains different instructions with instruction title and different images attached to it. I need to export all the instructions under a document to pdf. The instruction title contains bullets and numbering. It is stored in the database in html format. Also the images attached to each instruction is stored in the db in byte format. My pdf contains a table with each row representing an instruction. I am facing two basic issues in generating pdf with these data :
When I try to show the title, it is shown with html tags. In the pdf I need to show the title with bullets and numbers(ie. as entered through the editor).
I need to show byte stream images attached to each instruction in the pdf.
See the first three paragraphs of my post here for the answer to your first problem.
For your second question, iTextSharp (and more to the point, the PDF format) supports several formats. For formats not supported you can use the .Net Framework to convert many of them to a usable format. (The easiest to work with is probably JPEG.)
See this post if you need to know hot to get raw bytes from a database. Once you've got bytes you can use iTextSharp.text.Image.GetInstance() which has (as of 5.1.1) 15 overloads including ones that takes raw bytes, a System.Drawing.Image and `System.IO.Stream'.

Making a PDF output in raster format instead of vector using itextsharp

I have written C# code to save product specifications to a PDF document using iTextSharp, mainly with PdfPTable and Chunks/Paragraphs in the PdfPCells. However, I have been told that the output is unacceptable due to the fact that you can highlight and copy the text from the document and document storage and retrieval server software that they are currently using does not support "Vector" based PDFs. I'm not exactly certain what the difference is between a raster pdf and and vector pdf. Basically, every page of the PDF Document should be an image so that the text can not be highlighted. Is there any way to do this without using the DirectContent? Below is an image, illustrating a portion of the PDF that was created, and how the text can be selected and copied, which is the incorrect functionality.
I would like to avoid directly writing to the canvas, unless there is a way to do this and still have itextsharp handle my formatting and proper paging.
The windows application PDF2R works well, but doesn't seem to offer any programmatic solutions. I have found libraries that stated that they do this sort of conversion, but are several thousand dollars. I'd like to work within my budget and use the itextsharp or something much cheaper than this.
I would suggest you try to generate an image using the System.Drawing class and then insert that into the PDF document.
Call this code on your PdfWriter object:
writer.SetEncryption(PdfWriter.STRENGTH40BITS, null, null, PdfWriter.AllowPrinting);
This won't prevent users from selecting text, but it will prevent them from copying and pasting it. Give it a try.