itextsharp

How to extract text with iTextSharp 4.1.6?

别等时光非礼了梦想. 提交于 2021-02-18 21:55:12
问题 iTextSharp 4.1.6 is the last version licensed under LGPL and is free to use in commercial purpose without paying license fees. It might be interesting for some and for me, how to extract text with this version. Does anyone have an idea? 回答1: I had to hack this together manually as I was in the same boat as you. Hopefully this well help. It's probably not perfect, but I was able to get the text I needed out of the document this way. fileName is a string variable/parameter to the PDF file. var

iTextSharp vertical SignatureAppearance

試著忘記壹切 提交于 2021-02-15 07:54:07
问题 I'm signing a document with token certificate: var cp = new Org.BouncyCastle.X509.X509CertificateParser(); var chain = new[] { cp.ReadCertificate(cert.RawData) }; var externalSignature = new X509Certificate2Signature(cert, "SHA-1"); var pdfReader = new PdfReader(origem); var signedPdf = new FileStream(destino, FileMode.Create); var pdfStamper = PdfStamper.CreateSignature(pdfReader, signedPdf, '\0'); var sig = pdfStamper.SignatureAppearance; sig.SetVisibleSignature(new Rectangle(50, 0, 500, 50

iTextSharp vertical SignatureAppearance

懵懂的女人 提交于 2021-02-15 07:54:05
问题 I'm signing a document with token certificate: var cp = new Org.BouncyCastle.X509.X509CertificateParser(); var chain = new[] { cp.ReadCertificate(cert.RawData) }; var externalSignature = new X509Certificate2Signature(cert, "SHA-1"); var pdfReader = new PdfReader(origem); var signedPdf = new FileStream(destino, FileMode.Create); var pdfStamper = PdfStamper.CreateSignature(pdfReader, signedPdf, '\0'); var sig = pdfStamper.SignatureAppearance; sig.SetVisibleSignature(new Rectangle(50, 0, 500, 50

How do I make text field to be hidden?

六眼飞鱼酱① 提交于 2021-02-10 20:41:54
问题 I'd like to create a text field with iTextSharp that is not visible. Here's code I'm using to create a textfield: TextField field = new iTextSharp.text.pdf.TextField(writer, new iTextSharp.text.Rectangle(x, y - h, x + w, y), name); field.BackgroundColor = new BaseColor(bgcolor[0], bgcolor[1], bgcolor[2]); field.BorderColor = new BaseColor(bordercolor[0], bordercolor[1], bordercolor[2]); field.BorderWidth = border; field.BorderStyle = PdfBorderDictionary.STYLE_SOLID; field.Text = text; writer

How to insert values into an existing PDF on the fly?

*爱你&永不变心* 提交于 2021-02-08 11:42:32
问题 There is a PDF with some fields to accept values from the user(for example: a "bio data" form). My question is that how can I insert the user inputs to the Correct fields of the existing PDF and to generate the filled PDF? if i using iTextSharp, then how can i choose the co ordinates to print values? Is there any design tools to design rectangle fields to accept values? because my PDF template have lots of fields to get values from user side. tnx in adv. 回答1: There are two possibilities: Your

Convert HTML with CSS to PDF using iTextSharp

自作多情 提交于 2021-02-07 19:34:10
问题 I am working in asp.net with C# website. I want to convert a HTML DIV which contains various html elements like divs,label, tables and images with css styles(background color, cssClass etc) and I want its whole content to be converted into PDF using iTextSharp DLL but here I am facing a issue that css is not getting applied.Can any one help me by providing any example or code snippet. 回答1: Install 2 NuGet packages iTextSharp and itextsharp.xmlworker and use the following code: using

How to do to display Chinese font in pdf using iTextSharp?

百般思念 提交于 2021-02-07 15:56:40
问题 In the following code , chinese font( contained html text) doesnot display in pdf generated. I also try styles and font in this method. Please help to solve this problem. Thanks in advance to all. public static bool GeneratedPDF(string strHTMLText, string filename, string action, string rpttype) { bool blnReturn = false; string fontpath = HttpContext.Current.Server.MapPath("~/files/fonts/"); string filepath = HttpContext.Current.Server.MapPath("~/files/pdf/"); BaseFont customfont = BaseFont

Can iTextSharp rasterize/export to JPEG or other image format?

血红的双手。 提交于 2021-02-07 07:17:34
问题 I need to be able to export PDF's that I am creating to JPEG, so that users can have a screenshot/thumbnail of the end product, which is faster than opening the whole PDF. I am running this on an ASP.NET website running in Medium Trust in the Rackspace Mosso Cloud . I have yet to find a library that will either work in Medium trust, or in the case of ABC PDF, which works great locally, wont load in Mosso. Maybe Mosso has a custom trust level? I know that iTextSharp works on Mosso, but I haven

Can iTextSharp rasterize/export to JPEG or other image format?

跟風遠走 提交于 2021-02-07 07:17:21
问题 I need to be able to export PDF's that I am creating to JPEG, so that users can have a screenshot/thumbnail of the end product, which is faster than opening the whole PDF. I am running this on an ASP.NET website running in Medium Trust in the Rackspace Mosso Cloud . I have yet to find a library that will either work in Medium trust, or in the case of ABC PDF, which works great locally, wont load in Mosso. Maybe Mosso has a custom trust level? I know that iTextSharp works on Mosso, but I haven

Removing Text based watermarks using itextsharp

风格不统一 提交于 2021-02-05 11:13:24
问题 According to this post (Removing Watermark from PDF iTextSharp) , @mkl code works fine for ExGstate graphical watermarks but I have tested this code to remove watermark from some files which have Text based watermarks behind PDF contents (like this file : http://s000.tinyupload.com/index.php?file_id=05961025831018336372) I have tried multiple solutions that found in this site but get no success. Can anyone help to remove this watermark types by changing above @mkl solution? thanks 回答1: Just