itextsharp

iTextSharp - XFA fill date/time field

孤者浪人 提交于 2019-12-21 06:09:10
问题 The workflow is like this: we download a template form, prefill values which will be static, export a XML template the XML is parsed with a .NET forms app, dynamic values are added the resulting XML needs to be imported back into the PDF template All goes well using the MergeXfaData method on iTextSharp, however for some reason, date/time fields are not being filled in (textfields and checkboxes work ok). Cannot figure out why. Searching through forums I discovered someone saying XFA only

How can I convert a BouncyCastle X509Certificate to an X509Certificate2?

笑着哭i 提交于 2019-12-21 05:05:35
问题 Is there any way to convert a Org.BouncyCastle.X509.X509Certificate to System.Security.Cryptography.X509Certificates.X509Certificate2 ? The inverse operation is easy, combining Org.BouncyCastle.X509.X509CertificateParser with System.Security.Cryptography.X509Certificates.X509Certificate2.Export() . 回答1: Easy!! using B = Org.BouncyCastle.X509; //Bouncy certificates using W = System.Security.Cryptography.X509Certificates; W.X509Certificate2 certificate = new W.X509Certificate2(); certificate

iTextSharp creates PDF with blank pages

我的梦境 提交于 2019-12-21 04:29:11
问题 I've just added the iTextSharp XMLWorker nuget package (and its dependencies) to my project and I'm trying to convert the HTML from a string into a PDF file, even though no exceptions are being thrown, the PDF file is being generated with two blank pages. Why? The previous version of the code was using just iTextSharp 5.5.8.0 with HTMLWorker and ParseList method, then I switched to Here is the code I'm using: public void ExportToPdf() { string htmlString = ""; Document document = new Document

How to read data from table-structured PDF using itextsharp?

泪湿孤枕 提交于 2019-12-21 02:25:29
问题 I am having a problem with reading some data from pdf file. My file is structurized and it contains tables and plain text. Standard parser reads data from separate columns at the same line. For example: Some Table Header Data Col1a Data Col2a Data Col3a Data Col1b Data Col2b Data Col3b Data Col2c with this code PdfReader reader = new PdfReader(pdfName); List<String> text = new List<String>(); String page; List<String> pageStrings; string[] separators = { "\n", "\r\n" }; for (int i = 1; i <=

How to set PDF paragraph or font line-height with iTextSharp?

孤者浪人 提交于 2019-12-20 17:37:31
问题 How can I change the line-height of a PDF font or paragraph using iTextSharp? 回答1: Line spacing in terms of typography is called leading. If you can use line spacing, you can use Paragraph.Leading or Paragraph.LeadingMultiplier. See http://itextsharp.sourceforge.net/tutorial/ch02.html#phrase 回答2: paragraph.SetLeading(X, Y) where X - is fixed leading and Y is leading multiplayer. Leading is space between two text baselines. Final leading value is calculated like: X+Y*max font size in row. 回答3:

iTextSharp to generate PDF from WPF FixedDocument

邮差的信 提交于 2019-12-20 09:55:27
问题 I have a simple WPF app that displays and prints some reports with a FixedDocument. How can generate PDF's from that, with a free and open solution, such as iTextSharp? 回答1: A WPF FixedDocument, also known as an XPS document, is a definite improvement over PDF. It has many capabilities that PDF lacks. In most cases it is better to distribute your document as XPS rather than PDF, but sometimes it is necessary to convert from XPS to PDF, for example if you need to open the document on devices

How to correctly fill in XFA form data using iTextSharp to allow editing and saving result in Acrobat XI

旧时模样 提交于 2019-12-20 07:44:37
问题 I have an application that I'm using the populate a pdf form using iTextSharp. /// <summary> /// Imports XFA Data into a new PDF file. /// </summary> /// <param name="pdfTemplate">A PDF File with an unpopulated form.</param> /// <param name="xmlFormData">XFA form data in XML format.</param> /// <returns>a memorystream containing the new PDF file.</returns> public static void XFAImport(System.IO.Stream pdfTemplate, System.IO.Stream xmlFormData, System.IO.Stream outputStream) { using

How to generate pdf if our column less than the declared table column

谁说胖子不能爱 提交于 2019-12-20 07:35:55
问题 I have declared a table with 50 columns and I pass only 40 column data. In this case pdf not generates .Pdf generates, only if I pass 50 column data. how can I solve this issue? I found a function to solve this problem but I forget that function name. Anybody help me... eg: it works, PdfPTable table1 = new PdfPTable(50); for (int i = 1; i <=50; i++) { table1.DefaultCell.HorizontalAlignment = Element.ALIGN_CENTER; table1.AddCell(new Phrase(new Phrase("100", font4))); } which is not working is,

iTextSharp to generate a gridview in pdf

会有一股神秘感。 提交于 2019-12-20 07:18:06
问题 I'm trying to export a gridview to pdf with package iTextSharp. I'm doing it in my .aspx files : <form id="formOptions" runat="server"> [...] <asp:GridView ID="gvReportingStockComp" runat="server" AutoGenerateColumns="false" Visible="true"> <Columns> <asp:BoundField DataField="cod_wo" HeaderText="N° OF" /> <asp:BoundField DataField="composant" HeaderText="Composant" /> <asp:BoundField DataField="BESOIN" HeaderText="Besoin/OF" /> <asp:BoundField DataField="BESOIN_T" HeaderText="Besoin total" /

Draw a rectangle at the *current position* and then get its position coordinates

笑着哭i 提交于 2019-12-20 06:38:56
问题 So, I am writing some text into a PDF file using iTextSharp. After having added a few paragraphs and phrases to the PDF document, I want to: Draw the next piece of text on top of a rectangle that has a fill color, say, red. I can compute the required width and height that the rectangle must have based on the text metrics of the text I am going to write on top of it. But how do I tell the Rectangle API what is top and left coordinates are, as in where it must be drawn? 回答1: Seems that you are