itextsharp

iTextSharp Textfield setting the font to Bold

六月ゝ 毕业季﹏ 提交于 2019-12-04 04:36:29
问题 For a textfield object, I would like to change the style to bold. I have already created the arial font since it is not a default font for the BaseFont object. Apparently the TextField object only takes the BaseFont as a valid font. I was wondering how would I change the style of the font that I have assigned to my textfield to bold. Is there a way to do this? here is my code that I have thus far TextField txtNewField = new TextField(stamp.Writer, new Rectangle(1, 1, 75, 25), "TxtField");

iTextSharp.tool.xml.XMLWorkerHelper.GetInstance().ParseXHtml not working

爷,独闯天下 提交于 2019-12-04 04:14:51
问题 I'm using iTextSharp version: 5.5.6; iTextSharp XML Worker version: 5.5.6 I got some code from Here, but after I run the code, the PDF file will never open :The file is damaged and could not be repaired. Local\EWHvxm9t5++ htmltext="\r\n\r\n\r\n\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n Item \r\n Description\r\n LotNo\r\n Revision\r\n NamePlatSN\r\n DateCreated\r\n CreatedBy\r\n \r\n \r\n \r\n \r\n 100-817412-001\r\n X500-G02 - ENV DWG \r\n 15020008\r\n B \r\n testing123\r\n 4/9/2015 12:00:00

BadPasswordException when filling out pdf with iTextSharp

我与影子孤独终老i 提交于 2019-12-04 04:02:16
I have a third-party PDF file with some form fields, that I need to fill out programmatically. PDF file is secured. Detailed security settings: SecurityMethod: Password Security, Document Open Password: No, ... Form Field Fill-in or Signing: Allowed... When I'm trying to open and fill out the document manually, everything is ok, and I'm not asked for any password. But with the code, it fails with exception. Here's the code (I'm using iTextSharp library): var str = new MemoryStream(); var reader = new PdfReader(_path); var stamper = new PdfStamper(reader, str); Creating the PdfStamper object

How to display indian rupee symbol in iText PDF in MVC3

余生长醉 提交于 2019-12-04 03:58:42
问题 I want to display Special Character India Rupee Symbol in iTextPDf, My Code: Font fontRupee = FontFactory.GetFont("Arial", "₹", true, 12); Chunk chunkRupee = new Chunk(" ₹ 5410", font3); 回答1: It's never a good idea to store a Unicode character such as ₹ in your source code. Plenty of things can go wrong if you do so: Somebody can save the file using an encoding different from Unicode, for instance, the double-byte rupee character can be interpreted as two separate bytes representing two

PDF footer at the bottom using iTextSharp

余生颓废 提交于 2019-12-04 03:48:58
问题 I am trying to create a pdf document in c# using iTextSharp 5.0.6. I want to add header and footer to every page in OnStartPage and OnEndPage events respectively. In case of footer there is a problem that the footer is created right where the page ends whereas I would like to be at the bottom of page. Is there a way in iTextSharp to specify page height so that footer is always created at the bottom. Thanks! 回答1: The page's height is always defined: document.PageSize.Height // document

How to create a iTextSharp.text.Image object startng to a System.Drawing.Bitmap object?

有些话、适合烂在心里 提交于 2019-12-04 02:59:05
问题 I am pretty new in iTextSharp (the C# version of iText ): I have something like this: System.Drawing.Bitmap bitmap = (System.Drawing.Bitmap)ChartHelper.GetPdfChart((int)currentVuln.UrgencyRating * 10); iTextSharp.text.Image img = iTextSharp.text.Image.GetInstance(bitmap); vulnerabilityDetailsTable.AddCell(new PdfPCell(img) { Border = PdfPCell.RIGHT_BORDER, BorderColor = new BaseColor(79, 129, 189), BorderWidth = 1, Padding = 5, MinimumHeight = 30, PaddingTop = 10 }); As you can see I have

Auto Split Columns using iTextSharp

让人想犯罪 __ 提交于 2019-12-04 02:41:16
问题 I have a grid that need to be exported to PDF, grid has 28 columns. I am using iText to write the pdf. Issue -Itext is writting only 13 columns rest columns are not coming in PDF. Page Size is set as A4.Rotate(). Is there any way that remaining columns can be auto written on next page? 回答1: iText will split a table at rows but not at columns. If you want to do that you'll have to do it manually. PdfPTable has a method called WriteSelectedRows() that allows you to specify an X,Y coordinate to

How can you find a problem with a programmatically generated PDF? [closed]

笑着哭i 提交于 2019-12-04 00:17:35
Closed. This question is off-topic. It is not currently accepting answers. Learn more . Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed last year . My group has been using the itext-sharp library and C#/.NET to generate custom, dynamic PDFs. For the most part, this process is working great for our needs. The one problem we can run into during development/testing is layout issues which can cause the PDF to not open/render correctly in Adobe Reader, esp. the newer versions of Acrobat/Reader. The document will open the display correctly for the first

How do I remove link annotations from a PDF using iText?

不想你离开。 提交于 2019-12-03 23:11:35
问题 Here i want to remove Annotation(Link, Text, ..) from PDF permanently using iTextSharp. Already i have tried AnnotationDictionary.Remove(PdfName.LINK); But that Link annotations exist in that PDF. Note: I want remove particular selected Annotations(Link, Text, ..), For Example i want remove Link Annotation with the URI as www.google.com, remaining Link Annotations i want to be retain as per exist. 回答1: I got the answer for my question. Sample Code: //Get the current page PageDictionary = R

Reorder pages in a pdf file using itextsharp

ε祈祈猫儿з 提交于 2019-12-03 22:28:38
I'm trying to reorder several pages in a PDF file. I found some code in a blog but couldn't get it to work. I have a two page pdf, and I want to get the last page to appear as first. I always get an exception saying that page number has to match with order. When I checked the document object, it shows 0 pages. But the PDF passed into has two pages. public void reOrder(string inputFile) { Document document = new Document(); FileStream fs = new FileStream(inputFile, FileMode.Open); PdfWriter writer = PdfWriter.GetInstance(document, fs); document.AddDocListener(writer); writer.SetLinearPageMode()