itextsharp

Add table row counts to every page

荒凉一梦 提交于 2019-12-25 03:14:18
问题 How can I get the total number of rows written to a PdfPTable for every page using iTextSharp? I want to put all of my code onStartPage public class MyPdfPageEventHelpPageNo : iTextSharp.text.pdf.PdfPageEventHelper { public override void OnStartPage(PdfWriter writer, Document document) { /// my code } } 回答1: As Bruno said you'll want to look into IPdfPTableEvent. The downside of that specific interface is that it gets called on every page with only a copy of the table that's being printed to

Hyperlink at footer using itextSharp

前提是你 提交于 2019-12-25 02:57:48
问题 I need to put a hyperlink at the footer of my PDF generated using iTextSharp. I know how to use PdfPageEventHelper to print some text in the footer but not putting a hyperlink. public class PdfHandlerEvents: PdfPageEventHelper { private PdfContentByte _cb; private BaseFont _bf; public override void OnOpenDocument(PdfWriter writer, Document document) { _cb = writer.DirectContent; } public override void OnEndPage(PdfWriter writer, Document document) { base.OnEndPage(writer, document); _bf =

Assigning an Existing Custom Layout/Navigator to a Portfolio Generated By iTextSharp

ε祈祈猫儿з 提交于 2019-12-25 02:54:00
问题 I am generating collections (Acrobat Portfolios) via iTextSharp. I would like to assign an existing custom navigator (custom layout) to the generated collection. I believe iTextSharp allows for the CUSTOM parameter to define a custom navigator, as in the last code line of this block: Document document = new Document(); FileStream stream = new FileStream(portfolioPath, FileMode.Create); PdfWriter writer = PdfWriter.GetInstance(document, stream); document.Open(); document.Add(new Paragraph(" ")

PdfCopyForms in ITextSharp causing a Stack Overflow error

假装没事ソ 提交于 2019-12-25 02:47:29
问题 In this method I am trying to grab the input fields from one PDF document, paste them onto another document, and print out the result as a pdf file. The result would be a new PDF file which has the input fields of the first PDF and the static content of the second PDF. I wrote some code that I thought would perform this task, but I ran into a StackOverflow error each time "copier.close()" is executed. This is the error that it throws: An unhandled exception of type 'System

PdfCopyForms in ITextSharp causing a Stack Overflow error

依然范特西╮ 提交于 2019-12-25 02:47:11
问题 In this method I am trying to grab the input fields from one PDF document, paste them onto another document, and print out the result as a pdf file. The result would be a new PDF file which has the input fields of the first PDF and the static content of the second PDF. I wrote some code that I thought would perform this task, but I ran into a StackOverflow error each time "copier.close()" is executed. This is the error that it throws: An unhandled exception of type 'System

To display special character in pdf using itextSharp

僤鯓⒐⒋嵵緔 提交于 2019-12-25 02:15:44
问题 How to display character like '&' in pdf.I am using itextsharp to create pdf. Please help. 回答1: You need to give us more to work with. What does "no working" mean. Is something else being displayed or is the character just not appearing? Are you parsing HTML or just using regular Phrase and Paragraph classes? Below is a full sample that uses regular iTextSharp classes as well as the HTMLWorker to display ampersands. All three work just fine for me: using System; using System.Collections

ASP.NET Compiler errors with iTextSharp xmlworkerhelper

一世执手 提交于 2019-12-25 01:43:46
问题 I'm trying to write an application that will fire off a series of web reports that I've built in ASP.NET. So I have a web application where the pages live, but I don't really want to use the website to see the pages, I want to create PDFs that I can deliver to my clients. The application I'm trying to write is a console app, written in Visual Studio 2010 in c# and using iTextSharp v5.5.2 and .NET 4.5. It's currently just a framework as I haven't got to the "firing off PDFs" part yet. I'm

iTextSharp How include GenericTag using XML Parsing

☆樱花仙子☆ 提交于 2019-12-25 01:27:34
问题 I'm using iTextSharp library, specifically to view .xml documents and transform them into .pdf files as follows: var docWriter = PdfWriter.GetInstance(document, new FileStream("DOC.pdf", FileMode.Create)); ITextHandler xmlHandler = new ITextHandler(document); xmlHandler.Parse("MLDOC.xml"); I need to know if there is any way to include any attribute within the tags in my .xml file to indicate that they are GenericTag, or otherwise how I can identify a paragraph which I include a PdfAnnotation

PDF text show in Google Chrome but not in Adobe Acrobat

老子叫甜甜 提交于 2019-12-25 01:26:46
问题 I have a very strange problem. Documents i create using iTextSharp appears empty when i open them in Adobe acrobat, but works fine in Google Chrome. Here is some basic code that i use to generate my files: mDocument = new iTextSharp.text.Document(PageSize.A4, 0, 0, 0, 0); mStream = new MemoryStream(); var writer = PdfWriter.GetInstance(mDocument, mStream); var font = BaseFont.CreateFont(BaseFont.HELVETICA, BaseFont.WINANSI, BaseFont.NOT_EMBEDDED); mDocument.Open(); mContent = writer

Invalid PDF digital signature in WinRT app

橙三吉。 提交于 2019-12-25 00:52:23
问题 I am trying to port a working solution for signing PDFs from a standard C# class library to portable class library (or windows store app 8.1). iTextSharp version: 5.5.3.0 The logic is as follows: I create a signature appearance in iTextSharp, hash it (SHA256, it's a third party requirement), send the hash to a webservice which returns me the signed content. As mentioned, the solution is working fine e.g. in ASP.net web applications, but all the attempts to implement it in the WinRT