itextsharp

Tile PDF pages vertically with iTextSharp

时间秒杀一切 提交于 2019-11-28 11:21:59
问题 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 | ----- 回答1: 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

Get the export value of a checkbox using iTextSharp

心不动则不痛 提交于 2019-11-28 11:17:55
I'm working on dynamically filling in the fields on a pdf document using ITextSharp. I'd like to be able to determine the "export value" of the checkbox is from the codebehind in order to determine what value to send to this checkbox if it should be checked. Most of the documents I've worked with in the past had the same export value for every check box but the one I'm currently working with varies from checkbox to checkbox. I could go through all of the text boxes and make them consistent but it would save a lot of time in the future if I could just determine what the export value of these

ITextSharp 4.1.6 - Remove existing line from PDF Template

会有一股神秘感。 提交于 2019-11-28 11:07:01
问题 I have a PDF template created in LibreOffice and I'm filling it in using AcroFields. In some rare cases I'd like to hide a particular field, thus I remove it using RemoveField method. It's border however stays in there. From what I've googled it seems it's probably the way LibreOffice creates the forms. What I've came up with so far was to get the rectangle of the field and cover it with white image. Problem however is, customer plans creating templates using background image and/or other

ITextShape Clickable Polygon or path

て烟熏妆下的殇ゞ 提交于 2019-11-28 10:55:13
问题 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

Add PdfPCell to Paragraph

喜夏-厌秋 提交于 2019-11-28 10:48:47
问题 I'm trying to add a TextField (acrofield) in the middle of a Paragraph sentence using iTextSharp. An example would be "The Effective Date is [Day] day of [Month], [Year] that this will begin." Things I have tried: Paragraph para1 = new Paragraph(); para1.Add(New Phrase("The Effective Date is",fontBold)); //The next line is where it breaks, "Insertion of illegal Element: 30" para1.Add(CreateTextField("Day",1,0)); //this function returns a PdfPCell. PdfPCell tempCell = new PdfPCell(); tempCell

ITextSharp Find coordinates of specific text in PDF

隐身守侯 提交于 2019-11-28 10:44:30
问题 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

Removing text from PDF

早过忘川 提交于 2019-11-28 10:43:50
问题 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

Skip adding empty tables to PDF when parsing XHTML using ITextSharp

て烟熏妆下的殇ゞ 提交于 2019-11-28 10:43:23
问题 ITextSharp throws an error when you attempt to create a PdfTable with 0 columns. I have a requirement to take XHTML that is generated using an XSLT transformation and generate a PDF from it. Currently I am using ITextSharp to do so. The problem that I am having is the XHTML that is generated sometimes contains tables with 0 rows, so when ITextSharp attempts to parse them into a table it throws and error saying there are 0 columns in the table. The reason it says 0 columns is because

How to read text of appearance stream?

回眸只為那壹抹淺笑 提交于 2019-11-28 10:31:33
问题 I have a PDF where the text shown in an annotation (as rendered in Adobe Reader) is different than what is given by its /Contents and /RC entries. This is related to the problem that I was dealing with in this question: Can't change /Contents of annotation In this case, instead of changing the appearance to match the annotation's contents, I want to do the opposite: get the appearance text and change the /Contents and /RC values to match. E.g., if the annotation displays "appearance" and

iText XML to PDF using latest version

南楼画角 提交于 2019-11-28 10:20:08
I found a few examples showing how to use the XML to PDF using a iText XML document. But they are all for the older version 4.x. Is there any examples or can someone post an example of the required/updated code to do the same in version 5.x? All the examples refere to code like this, but I can not find what to use to replace the ITextHandler class with in the new version. http://www.ridgway.co.za/archive/2005/07/31/itextsharpxmltopdfexample.aspx Document document = new Document(); PdfWriter.GetInstance(document, new FileStream("ExampleDoc.pdf", FileMode.Create)); ITextHandler xmlHandler = new