itextsharp

Getting a Stack Overflow Exception generating a PDF [duplicate]

怎甘沉沦 提交于 2019-12-20 03:36:13
问题 This question already has an answer here : “'System.StackOverflowException” in “OnEndPage” event handler (1 answer) Closed 4 years ago . As a continuation to my earlier question I have been trying out the header and footer functions for my PDF. After a little discussion I have changed quite a lot of code on the PdfPageEventHelper class. Below is what I have: public class ReportHeaderFooter : PdfPageEventHelper { public string HeaderTitle { get; set; } public IReportsAccessor ReportsAccessor {

what is wrong with godaddy's timestamp server and itextsharp?

十年热恋 提交于 2019-12-20 02:54:47
问题 I am using the iTextSharp library to sign PDF documents. When I use the standard TSAClientBouncyCastle class to get time stamp from GoDaddy's server ( http://tsa.starfieldtech.com ), the response is an empty stream. At the same time, it perfectly works with other RFC 3161 compliant timestamp servers. Also, when I use microsoft's signtool.exe to sign exe file with /tr option, it works with Godaddy's server. So I wonder what is wrong with my attempt to get a timestamp programmatically using the

iTextSharp XMLWorkerHelper and Images for HTML to PDF

大兔子大兔子 提交于 2019-12-20 02:35:28
问题 Bottom line is I'm using iTextSharp to write out HTML to a PDF -- with an image . Right now, I'm at the latest version of iTextSharp which is 5.5.5.0. I have access to Bruno's book, and I'm using the methodology spelled out by demo.iTextSupport.com for the conversion. Unfortunately, the book doesn't appear to have any reference to XMLWorkerHelper , which is what I'm using to create the PDF from the HTML. Here's the method I finally got working that successfully generates a PDF from a well

Reduce paragraph line break height on iTextSharp

霸气de小男生 提交于 2019-12-20 01:39:10
问题 How can I reduce the height of a line break which occurs when a paragraph length is too long for the width of the ColumnText? I've tried the following, as I've seen other questions which answered with this: p.Leading = 0 But this has made no affect. I've also tried increasing the Leading to 100 to see if a larger line break is added, but neither work. SpacingBefore/SpacingAfter doesn't help either: p.SpacingBefore = 0 p.SpacingAfter = 0 How can I reduce this? 回答1: When using a table, you need

Can I use iText to render PDF in my Swing application?

早过忘川 提交于 2019-12-20 01:16:08
问题 Can iText render PDF documents in Swing application ? Or do I have to use another library/framework for that? 回答1: iText is for producing PDF files programmatically (e.g. converting from HTML to PDF, or producing PDF reports.) To view PDF you could use a library like ICEpdf 回答2: There is also an open source/commercial versions of JPedal and Suns PDFRenderer. 来源: https://stackoverflow.com/questions/2717522/can-i-use-itext-to-render-pdf-in-my-swing-application

iTextSharp RenameField bug?

落爺英雄遲暮 提交于 2019-12-20 01:06:56
问题 I am attempting to rename a checkbox that is subclassed. Let's say the checkbox's name is MyForm.Check1.page0. When I run: reader.AcroField.RenameField("MyForm.Check1.page0", "MyForm.Check1.newName"); The checkbox is renamed just "newName". The subclass information is dropped. I get from the documentation that the subclass cannot be changed, but this was unexpected. According to the documentation: "Renames a field. Only the last part of the name can be renamed. For example, if the original

iTextSharp Adding Text plus Barcode in a single cell?

北战南征 提交于 2019-12-20 01:03:14
问题 Basically, I want to combine a string with a barcode into a single cell using iTextSharp. From the code below it is the following two lines: table.AddCell(tempstring); table.AddCell(new text.Phrase(new text.Chunk(image39, 0, 0))); FULL CODE LISTED BELOW using text = iTextSharp.text; using pdf = iTextSharp.text.pdf; text.Document doc = new text.Document(); pdf.PdfWriter writer = pdf.PdfWriter.GetInstance(doc, new FileStream(pdfgen.sWorkPath + "\\OrderNumber" + txtSellerNumber.Text.ToString() +

Header and Footer in ITextSharp

夙愿已清 提交于 2019-12-19 21:52:24
问题 I know this question has been asked a thousand times, but I am yet to find a straight forward answer. I am relatively new to ITextSharp, so please explain as if you were talking to a toddler. How can I add a simple text only header and footer to the document I am creating? I am creating a simple pdf document with the following code: void Button1Click(object sender, EventArgs e) { Document doc = new Document(iTextSharp.text.PageSize.LEDGER, 10, 10, 42, 35); PdfWriter wri = PdfWriter

iTextSharp: which alignment properties are used in a PdfPCell?

北城以北 提交于 2019-12-19 17:48:10
问题 When I use the alignment of the cell so it works: PdfPCell cell1 = new PdfPCell(new Phrase("Text" , Font)); cell1.HorizontalAlignment = 2; But once the alignment does not work: PdfPCell cell1 = new PdfPCell(); cell1.AddElement(new Phrase("Text 1", Font)); cell1.AddElement(new Phrase("Text 2", Font)); cell1.HorizontalAlignment = 2; The reason? 回答1: You are confusing text mode with composite mode . In the first code snippet, you work in text mode . This means that the content of the cell is

Custom page size in iTextSharp in C#.NET

徘徊边缘 提交于 2019-12-19 16:09:31
问题 I want to create a custom page size which is (5"X2") PDF using iTextSharp in C#. Is there any way to do this? Document doc = new Document(iTextSharp.text.PageSize.A4, 15, 15, 0, 0); 回答1: Below code will demonstrate how to implement the custom PDF using PDF coordinates in C#.net. For this task you must aware about the pdf coordinates. BaseFont f_cn; string poath = Server.MapPath("~/fonts/CALIBRI.TTF"); f_cn = BaseFont.CreateFont(poath, BaseFont.CP1252, BaseFont.NOT_EMBEDDED); using (System.IO