itext

Itext 7 Split Paragraph

蓝咒 提交于 2021-02-08 10:15:05
问题 How can I split a given paragraph to 2 paragraphs, due to that it fits only partial into canvas. After split, I would like to add the first part into canvas and the second to a new canvas. public Paragraph addParagraphToPage(PdfDocument pdfDocument, int pageNum, Rectangle rectangle, Paragraph p) { PdfPage page = pdfDocument.getPage(pageNum); PdfCanvas pdfCanvas = new PdfCanvas(page.newContentStreamAfter(), page.getResources(), pdfDocument); Canvas canvas = new Canvas(pdfCanvas, pdfDocument,

How to format text in pdf template with iText

好久不见. 提交于 2021-02-08 08:45:24
问题 I have created a pdf template with 'open office writer' and filled the fields with iText. In pseudo code like this: PdfReader reader = new PdfReader("C:/temp/Template.pdf"); FileOutputStream fileOutputStream = new FileOutputStream("C:/temp/TemplateTest.pdf"); PdfStamper stamper = new PdfStamper(reader, fileOutputStream); stamper.setFormFlattening(true); stamper.getAcroFields().setField("description", "This is a important description."); stamper.close(); Now I just want the word 'important' in

Want to generate landscape pdf using Flying Saucer

心已入冬 提交于 2021-02-08 08:41:31
问题 I am having below given html with me, when I am converting this to PDF using flying saucer, It is not fitting A4 Portrait size. How to generate landscape pdf file. <html> <head> <title> Selenium Test SC </title> </head> <body style='font-family:Tahoma;font-size:9pt;letter-spacing:0.5px'> <table border='1' style='color:black;font-size:12px;'> <tr> <td> <a href="file:///C:/Users/611066167/Documents/Sel%20Test%20Result/Screenshots/Screen1.png" target="_blank"> NGSD:TMD (Search) <img src="file://

iTextSharp Read Text From Single Layer of PDF

孤者浪人 提交于 2021-02-08 06:32:06
问题 Currently I am using a custom LocationTextExtractionStrategy to extract text from a PDF that returns a TextRenderInfo[]. I would like to be able to determine if a TextRenderInfo object (or PDFString, child of TextRenderInfo) appears in a specific layer. I am not sure if this is possible. To get the layers in a PDF, I am using: Dictionary<string,PdfLayer> layers; using (var pdfReader = new PdfReader(src)) { var newSrc = Path.Combine(["new file location"]); using (var stream = new FileStream

Attach digital signature to pdf using mssp

回眸只為那壹抹淺笑 提交于 2021-02-08 04:42:03
问题 I am trying to sign pdf document digitally and need to attach signature to signature panel using MSSP(mobile signature service provider). I researched some stackoverflow questions and i did things as below. First i create checksum of pdf. Before generate the checksum add empty signature to pdf. After i generated the checksum i send that as data to sign document to the server. The server gives to me base64 signature and i found certificate chain from base64 signature. Now i need to attach

Attach digital signature to pdf using mssp

家住魔仙堡 提交于 2021-02-08 04:41:12
问题 I am trying to sign pdf document digitally and need to attach signature to signature panel using MSSP(mobile signature service provider). I researched some stackoverflow questions and i did things as below. First i create checksum of pdf. Before generate the checksum add empty signature to pdf. After i generated the checksum i send that as data to sign document to the server. The server gives to me base64 signature and i found certificate chain from base64 signature. Now i need to attach

Changing PDF Producer property with iText

生来就可爱ヽ(ⅴ<●) 提交于 2021-02-07 19:11:04
问题 Is it possible to change an existing property of a PDF document with iText? I tried this Map<String, String> moreInfo = new HashMap<String, String>(); moreInfo.put(Meta.PRODUCER, "XXX"); moreInfo.put(Meta.AUTHOR, "YYY"); try { stamp1.setMoreInfo(moreInfo); } catch (Throwable t) { Log.d(this.getClass().getName(), t.getMessage()); } I don't get any exception, but also nothing changes. 回答1: That's not possible with the AGPL version of iText. Buying a license will enable you to change that field.

Page size and formatting of PDF using iText pdfHTML

空扰寡人 提交于 2021-02-07 18:34:26
问题 I am trying to export 3 HTML pages (all with same content) into a PDF using iText7.1.0 and pdfHTML2.0.0 using this example. For some reason, the pages have formatting issue at the footer. The jsFiddle link to my HTML code that is being used by PDF renderer. Below is the Java code used for rendering the PDF (Test.html is the same HTML code in the fiddle): package com.itextpdf.htmlsamples.chapter01; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.File;

Error:Failed to resolve: com.itextpdf:itextpdf:4.2.2

非 Y 不嫁゛ 提交于 2021-02-04 21:56:27
问题 I am trying to create pdf files in android using itext library. But whenever i run the project, I am getting the following error. Error:Failed to resolve: com.itextpdf:itextpdf:4.2.2 I have entered the following dependencies in my gradle. compile 'com.lowagie:itext:4.2.2' compile 'com.itextpdf:itextg:5.5.9' Can someone please help in this. I have searched a lot on internet but have found nothing. 回答1: When you want to create an Android application, you need to use iTextG, so this is correct:

Footer in pdf with iTextSharp

点点圈 提交于 2021-02-04 16:46:18
问题 I'm trying to add a footer in every page of a PDF document. I want to have a name and the current date. I'm using this code, but it's only printing in the last page. I need it in every page. What am I missing here? DateTime horario = DateTime.MinValue; document.Add(new iText.Paragraph(document.BottomMargin, "TEST FOOTER" + horario)); 回答1: I manage to fix doing this. In my class that create the pdf i add this line. pdfWriter.PageEvent = new PDFFooter(); and i created another class called