itextsharp

How do I make an iTextSharp signature appear on every page of a document?

孤者浪人 提交于 2019-11-28 14:44:38
when I sign a document the signature only appears on the first page. Is there anything I can do to make it appear on every page? This is the method I'm using right now to sign the PDF, hope it helps find a solution: public static PdfStamper SignHashedUser(string Target, SysX509.X509Certificate2 Certificate, string Reason, string Location, bool AddVisibleSign, PdfReader objReader, int pags) { X509CertificateParser objCP = new X509CertificateParser(); X509Certificate[] objChain = new X509Certificate[] { objCP.ReadCertificate(Certificate.RawData) }; PdfStamper objStamper = PdfStamper

Saving Panel to PDF not working nor getting errors

人盡茶涼 提交于 2019-11-28 14:39:25
I am trying to save a panel to pdf using ITextSharp . When I set a breakpoint and debug, the code stops on this line of code, however it does not give an error and just stops. if (IsPostBack) { Response.ContentType = "application/pdf"; Response.AddHeader("content-disposition", "attachment;filename=Quote.pdf"); Response.Cache.SetCacheability(HttpCacheability.NoCache); StringWriter sw = new StringWriter(); HtmlTextWriter hw = new HtmlTextWriter(sw); **Panel1.RenderControl(hw);** StringReader sr = new StringReader(sw.ToString()); Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 100f, 0f);

How to set zoom level to pdf using iTextSharp?

会有一股神秘感。 提交于 2019-11-28 14:36:23
I need to set the zoom level 75% to pdf file using iTextSharp. I am using following code to set the zoom level. PdfReader reader = new PdfReader("input.pdf".ToString()); iTextSharp.text.Document doc = new iTextSharp.text.Document(reader.GetPageSize(1)); doc.OpenDocument(); PdfWriter writer = PdfWriter.GetInstance(doc, new FileStream("Zoom.pdf", FileMode.Create)); PdfDestination pdfDest = new PdfDestination(PdfDestination.XYZ, 0, doc.PageSize.Height, 0.75f); doc.Open(); PdfAction action = PdfAction.GotoLocalPage(1, pdfDest, writer); writer.SetOpenAction(action); doc.Close(); But I am getting

Replace text in PDF file using iTextSharp(not AcroFields) [closed]

最后都变了- 提交于 2019-11-28 14:35:46
I am working on iTextSharp with asp.net C# to create PDF files. I created many reports(pdfs) using iTextSharp and all works well. Now my client gave me pre-formatted pdf file in which there are some text which need to be replaced with database values. Now I want to replace text in existing pdf file and create new one. But as I googled, it is not possible in iTextSharp. I have some questions now Is it really not possible to replace text in pdf using iTextSharp? Is there any other library or third party tool(free-no licence required) which does so? If so, please give me some suggestion on it.

Odd Numbered Cell Not Added To Pdf

夙愿已清 提交于 2019-11-28 14:18:04
I am trying to add PdfPCell inside a loop to a iTextSharp Table with 2 columns in a Document . But if the count inside the loop is an odd number. Then the last cell does not get added. Can someone please provide a solution to this problem? My code is below: var doc = new Document(); PdfWriter.GetInstance(doc, new FileStream(Server.MapPath("~/QrCodes/") + fileName + ".pdf", FileMode.Create)); doc.Open(); PdfPTable table = new PdfPTable(2); table.WidthPercentage = 100; foreach (var item in items) { if (itemImages.Any(p => p.Reference == item.Reference) == true) { System.Drawing.Image image =

Can iTextSharp open an RTF document, manipulate it, and export the document to PDF?

天涯浪子 提交于 2019-11-28 13:36:10
问题 Using iTextSharp (and c#/ASP.NET) is it possible to open an RTF document, manipulate it by replacing some text, insert an image (WMF or PNG), and the export that manipulated document to a PDF document that retains the formatting of the original RTF document? Essentially I'm hoping to create a simple mail merge solution with the template being in RTF and the output needing to be in PDF. This needs to run on an ASP.NET server. 回答1: No it is not possible per se with iTextSharp. Better approach

How to create and apply redactions?

怎甘沉沦 提交于 2019-11-28 12:59:31
Is there any way to implement PDF redaction using iText? Working with the Acrobat SDK API I found that redactions also just seem to be annotations with the subtype "Redact". So I was wondering if it's possible to create those in iTextSharp as well? With the Acrobat SDK the code would like simply like this: AcroPDAnnot annot = page.AddNewAnnot(-1, "Redact", rect) as AcroPDAnnot; (I haven't be able to apply them though as annot.Perform(avDoc) does not seem to work. Ideas?) In iTextSharp I can create simple text annotations like this PdfAnnotation annotation = PdfAnnotation.CreateText(stamper

How to Generate Table-of-Figures Dot Leaders in a PdfPCell for the Last Line of Wrapped Text

牧云@^-^@ 提交于 2019-11-28 12:55:29
I have a Table of Figures generated using PDFPTable like so. -------------------------------------- |Caption|Figure Title | PP| -------------------------------------- | fig 1 |title text | 2 | --------------------------------|----| | fig 2 | This is a longer title| | | | text that wraps | 55 | -------------------------------------- | fig N | another title | 89 | -------------------------------------- I need to generate leader dots from the last line of text; it may have wrapped in the cell. Here's a sample again showing the Figure 2 item of wrapped titled text and additionally having leader

Split TextChunk into words

送分小仙女□ 提交于 2019-11-28 12:41:27
问题 I've found this example which splits a pdf document into TextChunks Is there either a) a method to split each TextChunk further into words/characters from each TextChunk and still be able to find it's location? or b) a method to get parse a PDF into words/characters instead of chunks and find the location? 回答1: Is there a method to split each TextChunk further into words/characters from each TextChunk and still be able to find it's location? You cannot split these TextChunk objects further

Bolding with Rich Text Values in iTextSharp

 ̄綄美尐妖づ 提交于 2019-11-28 12:32:23
Is it possible to bold a single word within a sentence with iTextSharp? I'm working with large paragraphs of text coming from xml, and I am trying to bold several individual words without having to break the string into individual phrases. Eg: document.Add(new Paragraph("this is <b>bold</b> text")); should output... this is bold text As @kuujinbo pointed out there is the XMLWorker object which is where most of the new HTML parsing work is being done. But if you've just got simple commands like bold or italic you can use the native iTextSharp.text.html.simpleparser.HTMLWorker class. You could