itextsharp

Digitally Sign and Verify Pdf Document using itextSharp 5.3.3

我的未来我决定 提交于 2019-12-10 19:27:09
问题 I am trying to digitally sign and Verify pdf documents on server(c#) using iTextSharp 5.3.3. I have generated .Pfx file using DigiSign(Online tool) and then using windows to generate the certificate(.cer) file /// <summary> /// Signs a PDF document using iTextSharp library /// </summary> /// <param name="sourceDocument">The path of the source pdf document which is to be signed</param> /// <param name="destinationPath">The path at which the signed pdf document should be generated</param> ///

How to edit and update the pdf file?

扶醉桌前 提交于 2019-12-10 18:26:33
问题 I am working on a web application using asp.net. One of requirements demands that I open a given pdf file containing form fields, fill the fields like checking the check boxes, selecting the values from the select inputs and entering the text in text boxes etc. Once the fields are set then I need to submit it to server and save this as a new pdf file or update the same pdf file . I don't have a submit button in the pdf itself. I need to submit the details to server using a button outside the

Itextsharp: Is There Any Way To Copy Links When Import Pages?

纵饮孤独 提交于 2019-12-10 18:07:12
问题 I'm working on a project where i need to edit pdf's before display it I need add a watermark edit permissions ( lock for avoid 'copy/paste' and 'save as' ) edit viewer preferences And i did it... and work fine except for one thing, the links in the original file does not work in the new file... any idea? NOTE: Actually, this is my code ( i'm using itextsharp ) private void loadPdf() { if (Request.QueryString.HasKeys()) { if (Request.QueryString.GetKey(0) == "thepath" && Request.QueryString

Trying to get a memory stream from a pdfstamper into a pdfreader but getting: “PDF startxref not found”

若如初见. 提交于 2019-12-10 18:04:44
问题 I'm writing an app in c# that fills a bunch of pdf forms, concatenates them then puts in some page numbers. I'm having difficulty with the memorystream result from the pdfstamper. If I change the memorystream to a filestream it works fine but I don't want to use the filesystem. I've created the following code snippet that reproduces my error: public static void TestStreams(string filepath) { PdfReader reader = new PdfReader(filepath); MemoryStream ms = new MemoryStream(); PdfReader

ITextSharp exception to read pdf: Rebuild failed: Dictionary key “” is not a name

邮差的信 提交于 2019-12-10 17:51:54
问题 I receive unhandled exception for specific pdf files using iTextSharp libraries in .net (c#) project. I cannot understand what is specific with pdf I want to upload, though I can see that with basic pdf I download from internet functionality works. The following part of code: string pdfTemplate ="url to specific pdf"; var pdfReader = new PdfReader(pdfTemplate); throw exception: Rebuild failed: Dictionary key Z is not a name. at file pointer 224; Original message: Dictionary key Z is not a

Allow page extraction in a password security pdf with itextsharp

天涯浪子 提交于 2019-12-10 17:39:39
问题 I don't know if it is possible to create a pdf with password security enabled, that also allows extraction of pages. I havn't found any property in itextsharp which will allow enable page extraction. Any one has any idea? This is the property that i would like to enable. Thank you very much. 回答1: I've taken a look at the permission bits in the draft of ISO-32000-2 and I've compared them with the parameters (written in ALL_CAPS) available in iText: bit 1: Not assigned bit 2: Not assigned bit 3

iTextSharp - calculating phrase/paragraph height before adding to column

隐身守侯 提交于 2019-12-10 17:14:45
问题 I am creating PDF work orders that have a varying amount of items and notes. I am using ColumnText.SetSimpleColumn(phrase, x, y, x2, y2, height, alignment) to add text to a single column. I can get the ColumnText.YLine value, but only after applying it to the ColumnText object with the Go() method. What I want to do is to either pre-calculate the final YLine value or undo the adding of a phrase if the YLine is past mjy bottom threshold so I can manually add another page and continue. Is this

Editing javascript in a pdf with .net

ⅰ亾dé卋堺 提交于 2019-12-10 16:41:41
问题 Is it possible to edit the javascript of a pdf document with .net? I've looked at the Acrobat SDK, but without much luck. It looks like you can retrieve values from forms etc. but not edit the document. Am I way off track? Is this even possible? I've tried iTextSharp, but since the pdf contains form fields, the fields are lost when I save the pdf. Any suggestions? 回答1: Well, apparently you can with iTextSharp: Document document = new Document(PageSize.A4, 50, 50, 50, 50); PdfReader reader =

How to bring added images using iTextSharp in C# to the forefront

旧时模样 提交于 2019-12-10 15:57:24
问题 Ok, I'm having to make a PDF that has some styles to it. It's for labels. I have the following code: Document doc = new Document(PageSize.A4); int labelHeight = 394; int labelWidth = 556; float labelTop = doc.PageSize.Height - 2; float labelBottom = doc.PageSize.Height - labelHeight; MemoryStream ms = new MemoryStream(); PdfWriter writer = PdfWriter.GetInstance(doc, ms); doc.Open(); PdfContentByte cb = writer.DirectContent; // Generate Boxes For Content cb.SetColorStroke(new CMYKColor(207,

Set line spacing when using XMLWorker to parse HTML to PDF - ITextSharp C#

早过忘川 提交于 2019-12-10 15:51:44
问题 I am using XMLWorker to parse an HTML string into a PDF Document, and cannot find a way to control the line spacing of the PDF being generated. Document document = new Document(PageSize.LETTER, 72f, 72f, 108f, 90f); MemoryStream stream1 = new MemoryStream(); PdfWriter pdfWriter = PdfWriter.GetInstance(document, stream1); document.Open(); //parse HTML into document XMLWorkerHelper.GetInstance().ParseXHtml(pdfWriter, document, new StringReader(summary.Content)); The "summary.Content" is an HTML