itext7

How to create template and generate pdf using template and database data iText C#

只愿长相守 提交于 2019-12-02 14:21:06
I want to do below task using iText7. create template using HTML or ..(some fields can be able to hide according to user input) Fill the template with the database data generate accessible pdf How can I do this? As far as I understand, you want to have an HTML template where you will fill in data based on user input as well as data coming from your database. This is possible in iText in general, however you would need to do a lot of work, especially if you want to have a template for the PDFs that you are going to generate (as well as the template for the HTML form for capturing data). It

How during work itext find out coordinates text?

一个人想着一个人 提交于 2019-12-02 10:08:29
I want to know the coordinates of the text that is added to the page. And apply some canvas to this text. (for example custom underline or strikethrough or text inside the triangle) I only need certain words List<String> listString = new ArraList(); PdfDocument pdfDoc = new PdfDocument(new PdfWriter(DEST)); Document doc = new Document(pdfDoc, PageSize.A4); for(String s:listString) //**underlineWord** hidden it will be removed if( s.contains("**underlineWord**")){ s.replace("**underlineWord**",""); Text text = new Text(s) Float[] coords = getCoords(text) Canvas canvas = new Canvas(...);

iText7 Convert PDF to Image

℡╲_俬逩灬. 提交于 2019-12-02 09:56:36
Please let me know what method can be used to convert pdf to image in iText7. In Itexsharp, there was an option to convert pdf file to images. Following is the link. PDF to Image Using iTextSharp http://www.c-sharpcorner.com/UploadFile/a0927b/create-pdf-document-and-convert-to-image-programmatically/ Below is the sample code created using the following refernce link. itext7 pdf to image this is not working as expected. It is not converting the pdf to image. It is creating a 1kb blank image. string fileName = System.IO.Path.GetFileNameWithoutExtension(inputFilePath); var pdfReader = new

iText7 - PdfFormField.setValue() fails if the /DA uses a decimal font size

偶尔善良 提交于 2019-12-02 09:25:04
问题 iText 7.0.0 i have a PDF created by Adobe LiveCycle ES 10 that's producing a TextField with a /DA /Arial-BoldMT 9.00 Tf 0.000 0.000 1.000 rg this causes a failure in PdfFormField.regenerateField() which expects the text font size to be an Integer (i don't see any specific mention in the PDF spec that this would be true) an acceptable workaround for my particular case appears to be just setting /V in the dictionary, but curiously why does setValue() work so hard? 回答1: This is fixed in iText 7

Switch between ColumnDocumentRenderer and DocumentRenderer in same page?

霸气de小男生 提交于 2019-12-02 09:22:27
问题 I was testing few things with iText7 and I have a scenario where I need to have DocumentRenderer paragraph at the top and then start the ColumnDocumentRender with 2 columns right below it on the same page. The problem I am having is when I change the content on same page it overlaps content from DocumentRenderer with content from ColumnDocumentRenderer. I believe it is because one render does not know about the other render and contents starts from the top of the page. I followed this

Font size for Name and Description PDF Digital signature

本秂侑毒 提交于 2019-12-02 09:21:24
If I use font size appearance.setLayer2FontSize(6.0f); it sets font size for both Name and Description. PdfReader reader = null; PdfSigner signer = null; try { reader = new PdfReader(inStream); signer = new PdfSigner(reader, pdfos, false); } catch (IOException e) { LOGGER.error("Error while loading PDF"); throw new DigitalSignException("Error while loading PDF", e); } int noOfPages = signer.getDocument().getNumberOfPages(); PdfSignatureAppearance appearance = signer.getSignatureAppearance().setReason(reason).setLocation(loc) .setReuseAppearance(false); Rectangle rect = new Rectangle(250, 100,

How can i add source PDF content to destination PDF using IText7 without losing Header and Footer?

隐身守侯 提交于 2019-12-02 07:45:29
问题 I am using Itext 7. I have two PDF's. The source PDF has some content. The destination PDF has header and footer. I have a requirement to add the content from source PDF to destination PDF in the middle of the page without overlapping header and footer of the destination PDF. Can anyone please help me with the code ? Below is my code and attached document is the screenshot of the source PDF which needs to be embedded in the final.pdf import java.io.File; import java.io.FileOutputStream;

PDF/A signed with iText7 allows changing attached documents without breaking a signature

孤人 提交于 2019-12-02 07:11:21
问题 I have created a PDF/A document using iText7. The created document has an attachment (). The attachment is a .csv file. Then the whole PDF/A has been signed. I have opened the attached .csv file and changed it after I have signed it. I have used following code to verify the signature: public PdfPKCS7 verifySignature(SignatureUtil util, String name) throws GeneralSecurityException, IOException { System.out.println("Signature covers whole document: " + util.signatureCoversWholeDocument(name));

iText 7 HTML to PDF conversion [duplicate]

浪子不回头ぞ 提交于 2019-12-02 04:34:13
This question already has an answer here: iText 7 java.lang.NoSuchMethodError 1 answer I am using iText 7 for PDF generation.I need to append Rich Text which having HTML document. In itext 5, i was using Chunk class for extracting data. But in itext 7 I don't see any API. And I tried with the code HtmlConverter.convertToPdf(is, os, properties); But it is giving below error. Exception in thread "main" java.lang.NoSuchMethodError: com.itextpdf.layout.font.FontSet.getFonts()Ljava/util/Set; at com.itextpdf.html2pdf.attach.impl.DefaultHtmlProcessor.processDocument(DefaultHtmlProcessor.java:107) at

iText 7 - Different footer on last page - Null pointer in PdfDictionary

送分小仙女□ 提交于 2019-12-02 04:16:20
I am trying to implement a footer in iText7 , the footer should be different on the last page of the document, I have added an event handler which is called when the document is closed but trying to then loop over the pages causes a null pointer exception: java.lang.NullPointerException at com.itextpdf.kernel.pdf.PdfDictionary.get(PdfDictionary.java:482) at com.itextpdf.kernel.pdf.PdfDictionary.get(PdfDictionary.java:152) at com.itextpdf.kernel.pdf.PdfPage.newContentStream(PdfPage.java:777) at com.itextpdf.kernel.pdf.PdfPage.newContentStreamBefore(PdfPage.java:212) Here is the code I am trying