itextsharp

How to flatten already filled out PDF form using iTextSharp

亡梦爱人 提交于 2019-11-29 18:05:45
问题 I'm using iTextSharp to merge a number of pdf files together into a single file. I'm using method described in iTextSharp official tutorials, specifically here, which merges files page by page via PdfWriter and PdfImportedPage. Turns out some of the files I need to merge are filled out PDF Forms and using this method of merging form data is lost. I've see several examples of using PdfStamper to fill out forms and flatten them. What I can't find, is a way to flatten already filled out PDF Form

ITextShape Clickable Polygon or path

流过昼夜 提交于 2019-11-29 17:42:21
Anyone out there able to create clickable annotation that is an irregular shape using iTextSharp. I know I can create a rectangular one like this float x1 = 100, x2 = 200, y1 = 150, y2 = 200; iTextSharp.text.Rectangle r = new iTextSharp.text.Rectangle(x1, y1, x2, y2); PdfName pfn = new PdfName(lnk.LinkID.ToString()); PdfAction ac = new PdfAction(lnk.linkUrl, false); PdfAnnotation anno = PdfAnnotation.CreateLink(stamper.Writer, r, pfn, ac); int page = 1; stamper.AddAnnotation(anno, page); Any way to do that with say a graphics path, I have seen this answer Draw a GraphicsPath in a PDF , but

Can iTextSharp open an RTF document, manipulate it, and export the document to PDF?

独自空忆成欢 提交于 2019-11-29 17:29:42
Using iTextSharp (and c#/ASP.NET) is it possible to open an RTF document, manipulate it by replacing some text, insert an image (WMF or PNG), and the export that manipulated document to a PDF document that retains the formatting of the original RTF document? Essentially I'm hoping to create a simple mail merge solution with the template being in RTF and the output needing to be in PDF. This needs to run on an ASP.NET server. No it is not possible per se with iTextSharp. Better approach will be to use Word Object to open document, do mailmerge and then save those documents ad HTML. Now you can

dataGridView to pdf with itextsharp

丶灬走出姿态 提交于 2019-11-29 17:25:40
I have a problem while trying to get values of specific columns in dataGridView and add them to the PdtPtable. But the values added in the table is repeated, for example row one is added twice.I tried to go through each row and in every row through each column. PdfPTable pdfTable= new PdfPTable(5); foreach(DataGridViewRow row in dataGridView1.Rows) { foreach (DataGridViewCell celli in row.Cells) { try { pdfTable.AddCell(celli.Value.ToString()); } catch { } } doc.Add(pdfTable); } I have fixed the indentation in your code snippet. You can now see what you're doing wrong in one glimpse. You have:

What is the PdfPTable.DefaultCell property used for?

一笑奈何 提交于 2019-11-29 17:25:36
What is the DefaultCell property used for? The Java documentation for PdfPTable.getDefaultCell() reads: Gets the default PdfPCell that will be used as reference for all the addCell methods except addCell(PdfPCell) . I don't understand it. The documentation for the .NET library is lacking. The Java one is still documented but again not that well. I usually look up from the Java one because the two API's are symmetrical. But I still don't understand the meaning of this property. When creating a PdfPTable , you add cells. One way is to create a PdfPCell object and to add that cell with the

Find location last object on PDF page using iTextSharp

偶尔善良 提交于 2019-11-29 17:03:11
How can I find the location and the height of the last object on a PDF page? There is no footer. I'm wanting to stamp a template below the last item. Not in the footer but directly below the last line of text. The amount of text may vary so I need to calculate if there is enough room at the bottom of the page to insert my template. Thanks for any help, Aaron mkl To determine where text and (bitmap) images on a given page end, have a look at the iText in Action, 2nd edition example ShowTextMargins which parses a PDF and adds a rectangle showing the text and (bitmap) images margin. PdfReader

Removing text from PDF

血红的双手。 提交于 2019-11-29 17:00:38
I'm looking for a solution to remove/delete ALL text from a pdf. I've been using iTextSharp for a while now, and extracting text from a pdf with it is easy (wihouth the use of OCR). However I can't find an option to delete the text. This solution frankly doesn't work for me. page.GetAsArray(PdfName.CONTENTS); returns null for me, also when using PdfName.Text and some others I've tried. The library to use doesn't really matter, I just think iTextsharp should be able to do this. However if there is another (free) solution, bring it EDIT: Just to make clear why I want to remove all text from the

ITextSharp Find coordinates of specific text in PDF

荒凉一梦 提交于 2019-11-29 16:59:55
I have found many sites and postings that the question is the same as mine but what they all seem to have in common is people are answering them with examples of how to insert new text at specific locations. I have a PDF document that is generated by another program that I have no control over and it has a line for a client to sign on but that line is not in an absolute position so a service that we use called AssureSign will not work properly because you have to know where the position of the signature line is. So I need to create a new program that will find the position of the signature

Tile PDF pages vertically with iTextSharp

五迷三道 提交于 2019-11-29 16:36:24
I want to tile pages vertically with iTextSharp Something like this: --------- | L | R | --------- This is 1 page as far as PDF is concerned. I need to split the page vertically into 2 parts page R and page L so that left part of page comes first and followed by right side of page. Something like this: page 1: ----- | L | ----- page 2: ----- | R | ----- Bruno Lowagie I changed your question because splitting a PDF has a different meaning to many of us. For instance: you can split a PDF with 10 pages into two PDF with 5 pages. You don't want to split a PDF, you want to tile a PDF. This is

How to create pdfformfields using iTextSharp?

匆匆过客 提交于 2019-11-29 16:36:05
I am using iTextSharp and CSharp for creating the pdf. I need to add formfields like checkbox, radiobutton and dropdown which can not be edited. I used this.. FileStream pdffile = new FileStream(path + "/Pdf/tes.pdf",FileMode.Create); PdfWriter writer = PdfWriter.GetInstance(doc, pdffile); doc.Open(); Rectangle rect = new Rectangle(100, 100, 100, 100); RadioCheckField checkbox = new RadioCheckField(writer, rect, "bhjabsdf", "on"); checkbox.CheckType = RadioCheckField.TYPE_CHECK; PdfFormField field = checkbox.CheckField; writer.AddAnnotation(field); doc.Close(); But it's not working. I also