itextsharp

iTextSharp - Populating a dynamic table field

本小妞迷上赌 提交于 2019-12-13 18:19:36
问题 I have an XDP and a Dynamic PDF file with dynamic fields. I am able to fill out the text fields and alike (as shown in the code below). The issue is that I have a dynamic table field and I am not sure how to populate it. I found many nice tutorials to create a table "from scratch", but here the table is a field already predefined (width, number of columns, etc.) How could I populate a dynamic table field? Any help will be much appreciated. PS - Here is the code I am using to populate text

ItextSharp can't find PDF

北城余情 提交于 2019-12-13 18:11:51
问题 I am using itextsharp 5.4.5 in a .net 3.5 app. When creating a PdfReader object from a file path I am getting a file not found exception but the file exists. I have confirmed that File.Open is able to open the file. Test code: try { FileStream f = File.Open(Server.MapPath("~/App_Data/pdf/EC_1.0.pdf"), FileMode.Open); f.Close(); f.Dispose(); PdfReader pdfReader = new PdfReader(Server.MapPath("~/App_Data/pdf/EC_1.0.pdf")); pdfReader.Close(); pdfReader.Dispose(); Response.Write("Succeed"); }

generate barcode in pdf when using itextsharp to build the pdf

爷,独闯天下 提交于 2019-12-13 16:34:29
问题 i am in trouble with generating a barcode in pdf. i am using itextsharp to generate pdf and i have number from database togenerate this and i am not familiar with barcodes...please help me to generate the barcode..... i used thefollowing code.. HttpContext.Current.Response.ContentType = "application/pdf" HttpContext.Current.Response.AddHeader("content-disposition", "attachment;filename=GridViewExport.pdf") HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache) Dim pdfDoc

iTextSharp.HTMLWorker bad convert html encrypt UTF-8

我怕爱的太早我们不能终老 提交于 2019-12-13 15:51:35
问题 I'd like to apologize, my English is not very good. I hope that you help me. I have this string from xslt trans.: "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<html>\r\n <head />\r\n <body style=\"font-family: Verdana, sans-serif;\">\r\n ĚŠČŘŽŘÝŽÝÁÁÍÉŮ ěščřžýáíéůú\r\n </body>\r\n</html>" and when I trying convert this html string to pdf: private static byte[] CreatePdfUsingXslt(string htmlText) { var msOutput = new MemoryStream(); var reader = new StringReader(htmlText); var document = new

itextsharp doesn't make new page when content is longer

余生长醉 提交于 2019-12-13 15:26:21
问题 I try from 3 day to find way to make one pdf document, and I will appreciate any help. I have few form fields which access and fill with no problem. Below of this fields I want to place dynamically created table. This table can be long enough to be on more than one page. And here is my problem. I can`t add this table on the same page with form fiels just below them. I find example which merge pdf files. And now I have this scenario. Make one pdf with filled form fields Make pdf with pdfTable

How to get the ascending or descending height of a font that uses 'Text figures'

百般思念 提交于 2019-12-13 14:40:57
问题 I'm having a problem with Text figures (see Wikipedia) in a PDF document created with itextsharp . The distances between the baseline and the lowest point of a number (e.g. 9 ) is NOT the same as the normal descender height of a font. With the following code i can calculate the height of the descender of a font: var fontSize = 60; var fontPath = @"CorpusGothic-Condensed.otf"; var font = BaseFont.CreateFont(fontPath, BaseFont.CP1252, BaseFont.EMBEDDED); var descentHeight = font

Using PDF itextSharp it is possible to put an image on top of text while creating the pdf document

让人想犯罪 __ 提交于 2019-12-13 14:16:55
问题 I attempted several ways to do this, but still cannot get it. It appears iTextSharp requires a 2 pass situation so that an image appears on top of the text. So I am attempting to do this using memory streams, but I keep getting errors. Public Function createDoc(ByRef reqResponse As HttpResponse) As Boolean Dim m As System.IO.MemoryStream = New System.IO.MemoryStream() Dim document As Document = New Document() Dim writer As PdfWriter = iTextSharp.text.pdf.PdfWriter.GetInstance(document, m)

Generating PDF from a DataGridView in Winforms

倾然丶 夕夏残阳落幕 提交于 2019-12-13 13:23:34
问题 I'm attempting to create a PDF from a DataGridView populated from a database. I have just started trying to learn how to use iTextSharp to accomplish this. The result of my code is a PDF that will not open. I get an error saying "File cannot be opened" Here is my code to generate the PDF void SendToPDF(string heading, string filename) { try { Document doc = new Document(PageSize.A4.Rotate(), 30, 30, 20, 20); string myDocs = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); if

Generate pdf using iTextSharp for different languages

回眸只為那壹抹淺笑 提交于 2019-12-13 10:44:21
问题 I have tried different options, but it did not work. The code generated pdf for English but does not work for other languages. using (var ms = new MemoryStream()) { // Create an iTextSharp Document which is an abstraction of a PDF but **NOT** a PDF var doc = new Document(); { // Create a writer that's bound to our PDF abstraction and our stream var writer = PdfWriter.GetInstance(doc, ms); { // Open the document for writing doc.Open(); string finalHtml = string.Empty; // Read your html by

Convert RTF to PDF format

≯℡__Kan透↙ 提交于 2019-12-13 10:43:13
问题 Any ideas how to convert RTF to Text format and to keep both style and fonts? NOTE: I want to avoid using System.Windows.Forms Update I have something like this in RTF <P style="TEXT-ALIGN: center; MARGIN: 0in 0in 0pt" class=MsoNormal align=center><FONT face=Calibri><SPAN style="LINE-HEIGHT: 115%; FONT-SIZE: 14pt"><STRONG>Questions and Answers<BR style="mso-special-character: line-break"></STRONG><BR style="mso-specialcharacter: line-break"></SPAN><SPAN style="LINE-HEIGHT: 115%; FONT-SIZE: