itextsharp

PdfPTable cell width

不问归期 提交于 2019-12-09 23:58:17
问题 I'm using iTextSharp to create PDFs in my application. However I have to recreate a table, where I have to set the size for a very small column. Below is the picture that shows the size I want to set the column: When the rest of the table creation all is well, I can't set this width . Code: PdfPTable table = new PdfPTable(2); table.WidthPercentage = 82.0f; PdfPCell cell = new PdfPCell(new Phrase("Com a assinatura autógrafa, o signatário desta Auto-declaração garante ter cumprido estas

Insert PDF in PDF (NOT merging files)

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-09 19:06:36
问题 I'd like to insert a PDF page in another PDF page scaled. I'd like to use iTextSharp for this. I have a vector drawing which can be exported as a single page PDF file. I would like to add this file into a page of other PDF document just like I would add an image to a PDF document. Is this possible? The purpose of this is to retain the ability to zoom in without losing quality. It is very hard to reproduce the vector drawing using PDF vectors because it is an extremely complex drawing.

iTextSharp multiple lines in PdfPCell one under another

故事扮演 提交于 2019-12-09 17:17:40
问题 I am using iTextSharp to create table in PDF document. I need several lines inside table cell to appear one under another like this: First line text Second Line Text Third Line Text Fourth line text Some times with extra line like this : First line text Second Line Text Third Line Text Fourth line text I have tried several approaches, with Paragraphs, Chunks, Phrases, did research online but still can not get this result. Please help. Also, how to make columns to adjust width dynamically to

Bad performance convert tif to pdf using ITextSharp

青春壹個敷衍的年華 提交于 2019-12-09 12:30:15
问题 Summary: How can I reduce the amount of time it takes to convert tifs to pdfs using itextsharp ? Background: I'm converting some fairly large tif's to pdf using C# and itextsharp , and I am getting extremely bad performance. The tif files are approximately 50kb a piece, and some documents have up to 150 seperate tif files (each representing a page). For one 132 page document (~6500 kb) it took about 13 minutes to convert. During the conversion, the single CPU server it was running on was

Open Generated pdf file through code directly without saving it onto the disk

喜你入骨 提交于 2019-12-09 07:45:10
问题 I use Sharepoint 2010 and I am developing a web part where on a button click event, a pdf file needs to be generated and opened directly. Should not be saving onto the disk. I tried the below code protected void Button1_OnClick(object sender, EventArgs e) { Document myDoc = new Document(PageSize.A4.Rotate()); try { PdfWriter.GetInstance(myDoc, new FileStream(@"C:\Directory\Test.pdf", FileMode.Create)); myDoc.Open(); myDoc.Add(new Paragraph("Hello World")); } catch (DocumentException ex) {

Using itextsharp xmlworker to convert html to pdf and write text vertically

为君一笑 提交于 2019-12-09 05:47:55
问题 Is there possible to achieve writing text direction bottom-up in xmlworker? I would like to use it in table. My code is <table border=1> <tr> <td style="padding-right:18px"> <p style="writing-mode:sideways-lr;text-align:center">First</p</td> <td style="padding-right:18px"> <p style="writing-mode:sideways-lr;text-align:center">Second</p></td></tr> <tr><td><p style="text-align:center">1</p> </td> <td><p style="text-align:center">2</p></td> </tr> </table> But it it doesn't work after conversion

iTextSharp read from specific position

左心房为你撑大大i 提交于 2019-12-09 05:04:40
问题 I have a problem using iTextSharp when reading data from PDF File. What I want to achieve is to read only specific part of PDF page (I want to only retrieve Address Information, which is located at constant position). I have seen usage of iTextSharp when reading all pages such as following: StringBuilder text = new StringBuilder(); if (File.Exists(fileName)) { PdfReader pdfReader = new PdfReader(fileName); for (int page = 1; page <= pdfReader.NumberOfPages; page++) { ITextExtractionStrategy

How to determine “Checked” value for Checkboxes (from GetAppearanceStates)

╄→гoц情女王★ 提交于 2019-12-09 03:44:04
问题 I have a question about checkbox fields, and consistently figuring out which value to use for a checked state. I have been searching, and shelled out $50 for the iText in Action book and scoured it as well. The book is great, but it didn’t answer this particular question. I know to call GetAppearanceStates(fieldName) to get the domain of possible values for a particular field, and know to call SetField(fieldName, value) to check the box. My question is: how do I definitively know WHICH of the

How can i set an image to a pdf field in existing pdf file?

末鹿安然 提交于 2019-12-09 03:36:17
问题 How can i set an image to a pdf field in existing pdf file? I'm using the iTextSharp object. Setting the text field is working fine. No problem in it. pdfFormFields.SetField("Firstname", "Mujeeb"); Please help. 回答1: Remove the Text field and replace it with a Pushbutton field of the same size and position. If you set the Pushbutton to READ_ONLY then it can't be pressed and it will look like a static image. This keeps the image you're trying to add as a field annotation instead of adding it to

Why is my ITexthandler not working? I'm trying to parse XML into ITextSharp doc

半城伤御伤魂 提交于 2019-12-08 18:37:42
问题 I’m using Visual Developer 2010, MVC 3, c#. I’m trying to parse XML into an iTextSharp document like this: ITextHandler textHandler = new ITextHandler(doc); textHandler.Parse(xmldoc); The error message says ITextHandler is not in this context. How can I make this work? Or is there another constructor that will do the same thing? Here’s my list of using statements: using System; using System.IO; using System.Text; using System.Web; using System.Web.Mvc; using System.Xml; using iTextSharp.text;