itextsharp

iTextSharp adding new instances of an existing page

北城以北 提交于 2019-12-02 08:07:03
Let's say I have a three page PDF and all three of them have AcroFields. I need to be able to generate a new PDF with page 2 repeated N number of times. Each new instance of page 2 will need to have the field names modified to make them distinct from the other instances of page 2. Can someone who's solved this problem before provide a syntax example? This is explained in the MergeForms2 example. You should split your document into 3 documents each having one page. Use the renameFields() method to create variations of the second page. Concatenating forms is done like this: Document document =

Javascript to automatically supply password

六月ゝ 毕业季﹏ 提交于 2019-12-02 07:43:38
I have an application that displays password protected PDFs using iTextSharp. pdfCopy.SetEncryption(true, "Secretinfo", "Secretinfo", 0); If the user saves the PDF, the saved copy of the PDF is password protected. Which is great. The problem is it also prompts for password before displaying the PDF on the browser. Which isn't good. So I'm thinking maybe it's possible to supply the password using javascript just to display it on the browser. It's bad practice but I don't see that I have any other choice. I'm no good at JavaScript. Maybe someone here can help me? But hey if you have another idea

Pdf's fields should remain editable using itextsharp in asp.net

冷暖自知 提交于 2019-12-02 07:41:16
问题 I have a fillable pdf. In which i have few textboxes. I fill these fields by using following code(itextsharp). DataTable dt = new DataTable(); String pdfPath1 = Server.MapPath("pdfs\\transmittal2.pdf"); if (File.Exists(pdfPath1)) { dt = objClsTransmittal.GetTransmittal(jobid, cid); String comment = "Correspondence generated for " + dt.Rows[0]["Recipient"].ToString(); var formfield = PDFHelper.GetFormFieldNames(pdfPath1); formfield["DocDate"] = DateTime.Now.ToLongDateString(); formfield[

iTextSharp ColumnText.SetSimpleColumn Addtext causes Error in Adobe Reader X 10.1.5

大兔子大兔子 提交于 2019-12-02 07:20:38
The code below illustrates a problem I have with iTextSharp. Everything works perfectly. The pdf file is created and appears correct on the screen. When I print the pdf from Adobe Reader X, it looks exactly right but Adobe reports "An error exists on this page. Acrobat may not display the page correctly. Please contact the person who created the PDF document to correct the problem." Unfortunately, the file has to be attached to an email and sent to clients. The error message is not a good look and I want to fix it. It happens in all versions of Reader that I have tried, including 10.1.15

Vector graphics with ITextSharp

馋奶兔 提交于 2019-12-02 07:17:21
问题 I have heard that ITextSharp does not have support for the JAVA2D class, does this mean that i cant import vector points from a clients databas to "print" to a ITextSharp application? I would relly like to find answer to this before going further with this suggestion. Anyone have real experiences of this? 回答1: While it is true that you can't use JAVA2D with iTextSharp you can still draw vector graphics in a PDF-native way by writing directly to the PdfWriter.DirectContent object. It supports

Pdf's fields should remain editable using itextsharp in asp.net

和自甴很熟 提交于 2019-12-02 07:10:02
I have a fillable pdf. In which i have few textboxes. I fill these fields by using following code(itextsharp). DataTable dt = new DataTable(); String pdfPath1 = Server.MapPath("pdfs\\transmittal2.pdf"); if (File.Exists(pdfPath1)) { dt = objClsTransmittal.GetTransmittal(jobid, cid); String comment = "Correspondence generated for " + dt.Rows[0]["Recipient"].ToString(); var formfield = PDFHelper.GetFormFieldNames(pdfPath1); formfield["DocDate"] = DateTime.Now.ToLongDateString(); formfield["Address1"] = dt.Rows[0]["Company"].ToString(); formfield["Address2"] = dt.Rows[0]["Address1"].ToString();

consolidate the fonts between merges pdfs itextsharp C#

岁酱吖の 提交于 2019-12-02 06:55:47
I need to merge multiple pdfs together. I am using itextsharp to create all the pdfs. I need to reduce the size of the pdfs to the lowest possible size. I know the fonts are being duplicated for each pdf. Is there to use only one set of fonts throughout the merged pdf? For example, pdf1 is 2.8mb and pdf2 is 2.8 mb I merge them together and its about 5.7mb. I know for a fact that both of those pdfs are using the same font but the data for the font is being duclpicated even though its in the same pdf. I tried using setting the compression properties to best compression and set full compression

Adding form elements to a table with iTextSharp

感情迁移 提交于 2019-12-02 06:52:45
问题 I'm trying to create a PDF document that is essentially a list of users in a table format. I need the table to have checkboxes in it. So far, I have the table and the checkboxes separately but I cannot find a way to get the checkboxes in the table. I think I need to add them using the AddCell() method. Here is my code: static void Main(string[] args) { // create the document, filestream, writer Document doc = new Document(PageSize.LETTER); FileStream file = new FileStream(@"C:\Users\test\User

Download multiple pdf documents using itextsharp

▼魔方 西西 提交于 2019-12-02 06:40:31
问题 i have a tree view in which there are certain set of document list and another grid having patient details. what i need to do is when we select docs from treeview (select multiple..checkbox enabled) and patients from grid and click on a button should create all the documents using ITEXTSHARP.that is multiple documents are created. I tried it like this, on button click foreach( TreeNode node in TreeView1.Nodes) { if (node.ChildNodes.Count>0) { for(int i=0 ;i<(node.ChildNodes.Count);i++) { if

PDF coordinate system in iTextSharp

∥☆過路亽.° 提交于 2019-12-02 06:32:46
Now I'm working on extracting line and rectangle from PDF by using iTextSharp. The method I used is as below: PdfReader reader = new PdfReader(strPDFFileName); var pageSize = reader.GetPageSize(1); var cropBox = reader.GetCropBox(1); byte[] pageBytes = reader.GetPageContent(1); PRTokeniser tokeniser = new PRTokeniser(new(RandomAccessFileOrArray(pageBytes)); PRTokeniser.TokType tokenType; string tokenValue; CoordinateCollection cc = new CoordinateCollection(); while (tokeniser.NextToken()) { tokenType = tokeniser.TokenType; tokenValue = tokeniser.StringValue; if (tokenType == PRTokeniser