itextpdf

iText signing PDF using external signature with smart card

自作多情 提交于 2019-12-12 03:55:56
问题 I've been toying with iTextSharp 5.5.7 for a while and can't find the right way to make a valid digital signature for PDF from Smart Card - Adobe Reader always says its signed by and unknown and can't decode signatures' DER data. I've looked at MakeSignature.cs code for reference and what is does: Stream data = signatureAppearance.GetRangeStream(); // gets the first hash byte[] hash = DigestAlgorithms.Digest(data, hashAlgorithm); // gets the second hash or is it not a hash at all ? byte[] sh

itextpdf : rectangle modify width

流过昼夜 提交于 2019-12-12 03:46:12
问题 Is it possible to modify width of existing rectangle ? I have : @Override public void onGenericTag(PdfWriter writer, Document document, Rectangle rect, String text){ Rectangle rectangle = new Rectangle(rect); //something like that : rectangle.setWidth(400f); } 回答1: You can (and should) not use a method called setWidth() . Whatever that method would do would be very ambiguous. Suppose that you would have a rectangle with lower-left x coordinate equal to 36 and with upper-right x coordinate

Embed non-embedded fonts in PDF with IText

懵懂的女人 提交于 2019-12-12 01:54:24
问题 So I have the following problem. I receive a PDF file which contains a set of fonts. These fonts are not embedded into the file. Here is a simple example: I would like to embed these fonts inside the PDF , so they're self-contained and always available. But things don't seem that simple. I'm using IText to do my PDF processing. I have read and tried the following questions/answers: how-to-create-pdf-with-font-information-and-embed-actual-font-when-merging-them embed-truetype-fonts-in-existing

itext how to check if giant string is present on the pdf page

感情迁移 提交于 2019-12-11 23:15:37
问题 -I am using the IText plugin to create/read pdfs on my java project. -I am reading multiple text files from any extension(pdf,doc,word etc) and writing their content on a new pdf(all the content of all the files joint together) -To separate each content of each file on the giant pdf, i am always starting a new page, writing the exact path to the file in red at the start of the new page and then writing the content of the file The problem: I want to write how many pages did the file have on

How can I add page background color of pdf using iText in java

你离开我真会死。 提交于 2019-12-11 20:14:44
问题 I am new to iText pdf library. Can any one guide me how to add background color to entire page (not for chunk or paragraph) using iText pdf in java. 回答1: This code will do the job: Rectangle pageSize = new Rectangle(216, 720); pageSize.setBackgroundColor(new BaseColor(0xFF, 0xFF, 0xDE)); Document document = new Document(pageSize); 来源: https://stackoverflow.com/questions/30206160/how-can-i-add-page-background-color-of-pdf-using-itext-in-java

How to set up a table display in iTextpdf

杀马特。学长 韩版系。学妹 提交于 2019-12-11 10:38:28
问题 I have an application that I want to print an invoice like document in a table setup. Each line in the table will be from a separate document from a database. The iteration through the Db is not an issue but I want it to display something like this: I can determine the total number of lines in the table in advance if that makes any difference. Does anyone have a piece of code to use as a starting point? 回答1: Please take a look at the SimpleTable11 example and the PDF that is created when you

iTextPDF hyperlink not linking to the right place

吃可爱长大的小学妹 提交于 2019-12-11 06:58:45
问题 I have a bunch of PDF's which I have merged by this point in the code. At the beginning of the merged PDF I have a contents page which links to said PDF's respectively. These pdfAction.gotoLocalPage links sometimes don't work correctly and instead jump to between the bottom of the page and the next, however the PDF bookmark hyperlinks always work fine. The code for the bookmark: int pageToLinkTo=prevSectionPageCount+sectionPageCount+numberOfIndexPages+currentIndexPage+1; document.put("Title",

How to embed font after flattening template using iText?

怎甘沉沦 提交于 2019-12-11 00:11:27
问题 I want to auto generate some Chinese PDF docs using a template, this is what I have done: Make a template using Acrobat, set all AcroField s at correct places. Set all AcroField 's font to STXiHei . Use Java and iText to fill these fields. The codes are like: BaseFont STXiHei = BaseFont.createFont(getResource("STXiHei.ttf"), BaseFont.IDENTITY_H, BaseFont.EMBEDDED); PdfReader reader = new PdfReader(getResource("template.pdf")); FileOutputStream stream = new FileOutputStream("doc.pdf");

java.lang.NoClassDefFoundError: com.itextpdf.text.Document

主宰稳场 提交于 2019-12-09 18:47:57
问题 I have added the .jar files into my existing project as described in http://www.vogella.com/articles/Eclipse/article.html#classpath . When I try to run the emulator I end up with “java.lang.NoClassDefFoundError: com.itextpdf.text.Document” My .classpath file : <classpath> <classpathentry kind="src" path="src"/> <classpathentry kind="src" path="gen"/> <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/> <classpathentry kind="con" path="com.android.ide.eclipse.adt

All links of existing pdf change the action property to inherit zoom - iText library

久未见 提交于 2019-12-09 03:58:41
问题 This Code is perfect. But the only problem is that I want to copy links and I want to change the property of links to inherit zoom. public class links { public static void main(String[] args) throws DocumentException, IOException,FileNotFoundException { String src = "E:/bookmark.pdf"; String destination = "E:/links.pdf"; PdfReader reader=new PdfReader(src); reader.consolidateNamedDestinations(); Document doc=new Document(); PdfCopy pdfCopy = new PdfCopy(doc,new FileOutputStream(destination));