itextsharp

iTextSharp need to repeat table rows with textfield dynamically

半腔热情 提交于 2020-01-16 04:04:29
问题 I am reading and filling a dynamic pdf template(having dynamic table with textfields in each cell) below way using iTextSharp [assuming I would be getting a single product info from source]: FileStream fs = new FileStream("C:\\ABC\\DestinationFile.pdf", FileMode.Create); PdfReader reader = new PdfReader("C:\\ABC\\SourceTemplateFile.pdf"); PdfStamper stamper = new PdfStamper(reader, fs); xfa = stamper.AcroFields.Xfa; string[] strProductList = productInfo.Product.Split('|'); string dName=

Draw a GraphicsPath in a PDF

前提是你 提交于 2020-01-16 00:25:27
问题 I am trying to create a PDF based on some vector art I have in my C# application. I have two major problems when I try to map the points and types from a GraphicsPath. Some paths are just plain missing. When a sub path is an internal boundary I need to indicate that somehow. ie, the circle in the letter d is filled in. I'm referencing iTextSharp 5.5.2 on NuGet. I'm only using AddString here because I want an easy way to demonstrate creating a complex path in this example. For my need I won't

I cannot align my table to the left of the page?

大憨熊 提交于 2020-01-15 15:38:12
问题 I have created a PDF but the image is appearing to the middle of the page and I cannot figure out how to align the image and the cell of text to the left of the page. This is my code PdfWriter.GetInstance(mydoc, New FileStream(filename, FileMode.Create)) mydoc.Open() Dim titleTable As New Table(2, 1) titleTable.Border = 0 titleTable.BorderWidth = 0 titleTable.Cellpadding = 3 titleTable.SetWidths({20, 80}) titleTable.DefaultCellBorder = iTextSharp.text.Rectangle.NO_BORDER titleTable

I cannot align my table to the left of the page?

半世苍凉 提交于 2020-01-15 15:38:11
问题 I have created a PDF but the image is appearing to the middle of the page and I cannot figure out how to align the image and the cell of text to the left of the page. This is my code PdfWriter.GetInstance(mydoc, New FileStream(filename, FileMode.Create)) mydoc.Open() Dim titleTable As New Table(2, 1) titleTable.Border = 0 titleTable.BorderWidth = 0 titleTable.Cellpadding = 3 titleTable.SetWidths({20, 80}) titleTable.DefaultCellBorder = iTextSharp.text.Rectangle.NO_BORDER titleTable

iTextSharp - Adding a vertical textbox

╄→гoц情女王★ 提交于 2020-01-15 04:53:14
问题 Does anyone know if it's possible to add a vertical textbox to a PDF document using itextsharp. I have tried rotating the page first PdfDictionary pDict = reader.GetPageN(1); pDict.Put(PdfName.ROTATE, new PdfNumber(90)); AddTextBox(stamper, ...........) // Rotate back but this just adds the textbox horizontally, do I need to get another instance of stamper after the rotation? 回答1: When you create the TextField set its Rotation property: PdfReader reader = new PdfReader(file1); using

c#/asp.net - How to catch “System.Web.HttpException: Request timed out”?

本小妞迷上赌 提交于 2020-01-13 19:09:16
问题 In my asp.net/c# project I am using the iTextsharp dll to read the text from many pdf documents, but sometimes I get this error System.Web.HttpException: Request timed out. But the code that does it is: public static bool does_pdf_have_keyword(string keyword, string pdf_src) { try { PdfReader pdfReader = new PdfReader(pdf_src); string currentText; int count = pdfReader.NumberOfPages; for (int page = 1; page <= count; page++) { ITextExtractionStrategy strategy = new

Displaying a pdf to webpage using iTextSharp?

烂漫一生 提交于 2020-01-13 17:04:08
问题 I am generating a pdf using iTextSharp. I would like to display it on the webpage and let the user save it from the online pdf viewer. dynamicpdf has a drawtoweb() method, but it is not free to use and I cannot find the same functionality using iTextSharp. How can I display the pdf? string newFile = "Pdf Document.pdf"; Document doc = new Document(); PdfWriter writer = PdfWriter.GetInstance(doc, new FileStream(newFile, FileMode.Create)); doc.AddCreator("Myself"); doc.AddTitle("Sample PDF

Setting margins, headers and footers for PDF without overlap

烂漫一生 提交于 2020-01-13 10:22:18
问题 I need some help with tweaking my PDF header/footer alongside my text areas. The first page looks okay and it just gets worse from there. Is the header and footer eating into my existing margin spaces? I would like to know what is going wrong and what I can tweak to set the below: Page widths Margin widths Header Footer Text area My header override function is as below: public partial class Header : PdfPageEventHelper { public override void OnStartPage(PdfWriter writer, Document doc) {

Setting margins, headers and footers for PDF without overlap

眉间皱痕 提交于 2020-01-13 10:21:09
问题 I need some help with tweaking my PDF header/footer alongside my text areas. The first page looks okay and it just gets worse from there. Is the header and footer eating into my existing margin spaces? I would like to know what is going wrong and what I can tweak to set the below: Page widths Margin widths Header Footer Text area My header override function is as below: public partial class Header : PdfPageEventHelper { public override void OnStartPage(PdfWriter writer, Document doc) {

How do I force formatting and calculations in a PDF when filling other fields using iTextSharp?

杀马特。学长 韩版系。学妹 提交于 2020-01-12 19:06:34
问题 I have a PDF form with a number of text fields. The values entered in these fields are used to calculate values in other fields (the calculated fields are read-only). When I open the form in Adobe Reader and fill in a field, the calculated fields automatically re-calculate. However, I am using iTextSharp to fill in the fields, flatten the resulting form, then stream the flattened form back to the user over the web. That part works just fine except the calculated fields never calculate. I'm