itextsharp

Why I can't obtain rounded table corners in this iText\iTextSharp footer table?

拟墨画扇 提交于 2019-12-24 14:13:11
问题 I have the following situation: I have to create a round corner table into the footer of my PDF using iTextSharp but I am finding some difficulties to do it. First of all I have create a class named PdfHeaderFooter that extends the PdfPageEventHelper iTextSharp interface. In this class I have implemented the OnEndPage() method that create the footer on the end of all pages, this is my code: // Write on end of each page public override void OnEndPage(PdfWriter writer, Document document) { base

MeasureString with IText

坚强是说给别人听的谎言 提交于 2019-12-24 13:48:13
问题 I want my columns' width be auto size, but I know this is impossible, so I try to use with the function MeasureString without success. Here is my code: Document doc = new Document(PageSize.A4, 20, 20, 72, 72); doc.Open(); PdfPTable t=new PdfPTable(2); //Here I want to know the size of the column. . . . doc.Close(); I know I need an object to set the function MeasureString on it, but I don't know which object. 回答1: Calling GetWidthPoint(string text, float fontSize) on an instance of iTextSharp

Add file with bookmark

柔情痞子 提交于 2019-12-24 13:47:22
问题 I want to add a PDF file using iTextSharp but if PDF file contains bookmarks then they should also be added. Currently I'm using following code Document document = new Document(); //Step 2: we create a writer that listens to the document PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(outputFileName, FileMode.Create)); writer.ViewerPreferences = PdfWriter.PageModeUseOutlines; //Step 3: Open the document document.Open(); PdfContentByte cb = writer.DirectContent; //The current

Extract Images from Pdf via iTextSharp 4.1.6.0

泄露秘密 提交于 2019-12-24 12:51:45
问题 Hello all(and you Bruno too :) ). I'm using iTextSharp 4.1.6.0 that ported for Xamarin .Android. For some reason i need to extract images from pdf. I founded too much examples,but seems they are not acceptable for my case ,because some classes(like : ImageCodeInfo , ImageRenderInfo , System.Drawing.Imaging.EncoderParameters , PdfImageObject and etc,doesn't exist). But one example looks fine,here is it: void ExtractJpeg(string file) { var dir1 = Path.GetDirectoryName(file); var fn = Path

Itextsharp seems to be corrupting a pdf form after filling it out; problems opening in Adobe Reader for WP7

青春壹個敷衍的年華 提交于 2019-12-24 12:15:14
问题 I'm trying to dynamically generate a pdf form from an asp.net C# application. The form is generated and emailed to some users. People have been able to open it on Adobe Reader for months now. Recently, there has been a request that users be able to read these pdf attachments on their mobile phones. Unfortunately, when these people try to open the pdfs on their phones, it says "There was an error opening the document." I tried opening the original form on my wp7 phone and it works. I sent a

Changing signature appearance after signing pdf file with iTextSharp

こ雲淡風輕ζ 提交于 2019-12-24 11:52:06
问题 I'm writing a service where I pre-sign a pdf file with an empty container, take a hash of a byte range from the pdf file and send it to another service, that will allow a user to sign the hash using a mobile phone. I get back a certificate that I will inject into the signature container in the pre-signed pdf file. Everything works so far, except that I want to have visible signatures in the document. The visible signatures require the certificate to get information from it (like who signed it

How to refresh Formatting on Non-Calculated field and refresh Calculated fields in Fillable PDF form

左心房为你撑大大i 提交于 2019-12-24 11:25:12
问题 I have a PDF Template file that I am trying to populate with contents of "MyDocument". All the fields populate fine but the problem is that the "Calculated" fields in my PDF are not refreshed nor is the formatting set on other fields. How do I make the calculated fields refresh and formatting to work using ITextSharp? (I do not care if I get a C# or VB.NET answer) VB.NET: Public Shared Sub Serialize(ByVal stmt As MyDocument, ByVal file As FileInfo) Dim reader As New PdfReader(TemplateFilePath

How to introduce a custom font weight?

杀马特。学长 韩版系。学妹 提交于 2019-12-24 11:14:21
问题 Is there a way to set font weight in iTextSharp as a number? Now I can set bold font like this: iTextSharp.text.Font font_main = new iTextSharp.text.Font(someBaseFont, 12, iTextSharp.text.Font.BOLD); So, only one "boldness" is available. But I want something like this: font_main.weight = 600; Is it possible? 回答1: When you pick a font family, for instance Arial, you also need to pick a font, e.g. Arial regular ( arial.ttf ), Arial Bold ( arialbd.ttf ), Arial Italic ( ariali.ttf ), Arial Bold

Create non-selectable text watermark in PDF

流过昼夜 提交于 2019-12-24 10:58:12
问题 After adding the text watermark and clicking on the PDF, Acrobat reader will display a large blinking cursor that looks more like a rendering artifact or start selecting the watermark text . Can the watermark text be made non-selectable? The watermark is a large "Draft" text under the existing content: using c# itextsharp PDF creation with watermark on each page 回答1: To my knowledge there is no way to make text non-selectable. As an alternative to the large blinking cursor you may instead put

iTextSharp: Writing RTF in a PDF document

ⅰ亾dé卋堺 提交于 2019-12-24 10:38:19
问题 I'm using iTextSharp (with C# and VS2008) to generate a report from a database table row. Generate PDF is not a problem... but when I try to add RTF text into the PDF I cant't find a way into iTextSharp object structure. How can I do it? Thanks a lot! 回答1: Consider converting your RTF to HTML and then writing your HTML to PDF using iTextSharp. I've never done this but here are some resources that might help: Writing Your Own RTF Converter Need help with creating PDF from HTML using itextsharp