itextsharp

itextsharp html to pdf

这一生的挚爱 提交于 2020-01-06 14:04:40
问题 I want to change some HTML in a pdf. All my html is in HTML string but I don't know how to pass it in correctly within iTextSharp . public void PDF() { // Create a doc object var doc = new doc(PageSize.A4, 50, 50, 25, 25); // Create a new PdfWrite object, writing the output to the file ~/PDFTemplate/SimpleFormFieldDemo.pdf var output = new FileStream(Server.MapPath("t.pdf"), FileMode.Create); var writer = PdfWriter.GetInstance(doc, output); // Open the doc for writing doc.Open(); //Add

itextsharp html to pdf

久未见 提交于 2020-01-06 14:03:20
问题 I want to change some HTML in a pdf. All my html is in HTML string but I don't know how to pass it in correctly within iTextSharp . public void PDF() { // Create a doc object var doc = new doc(PageSize.A4, 50, 50, 25, 25); // Create a new PdfWrite object, writing the output to the file ~/PDFTemplate/SimpleFormFieldDemo.pdf var output = new FileStream(Server.MapPath("t.pdf"), FileMode.Create); var writer = PdfWriter.GetInstance(doc, output); // Open the doc for writing doc.Open(); //Add

iTextSharp problem concatenating PDF documents

女生的网名这么多〃 提交于 2020-01-06 13:52:43
问题 I am trying to build up a single PDF from a bunch of other PDFs that I am filling out some form values in. Essentially I am doing a PDF mail merge. My code is below: byte[] completedDocument = null; using (MemoryStream streamCompleted = new MemoryStream()) { using (Document document = new Document()) { document.Open(); PdfCopy copy = new PdfCopy(document, streamCompleted); copy.Open(); foreach (var item in eventItems) { byte[] mergedDocument = null; PdfReader reader = new PdfReader

Does iTextsharp support multi color diagonal gradients?

时光总嘲笑我的痴心妄想 提交于 2020-01-06 11:09:20
问题 My goal is to create a diagonal gradient with multiple colors as the background of an ellipse. A horizontal or vertical gradient can be done with the code below. I basically draw rectangles with gradient shadings and clip an ellipse out of it. Here's my horizontal gradient: The code for a horizontal gradient: var cb = writer.DirectContent; var boundingBox = new Rectangle(200, 200, 700, 350); //draw a path, for example an ellipse cb.Ellipse(boundingBox.Left, boundingBox.Bottom, boundingBox

Format error not a pdf or currupted

情到浓时终转凉″ 提交于 2020-01-06 08:43:07
问题 I'm trying to export the gridview data to pdf and its doing fine.but the pdf file is showing error message like this-- The code is-- protected void Export_to_PDF(object sender, System.EventArgs e) { try { Response.Clear(); //this clears the Response of any headers or previous output Response.Buffer = true; //ma Response.ContentType = "application/pdf"; Response.AddHeader("content-disposition", "attachment;filename=DataTable.pdf"); Response.Cache.SetCacheability(HttpCacheability.NoCache);

Can I use an iTextSharp cell event to repeat data on the next page when a row is split?

末鹿安然 提交于 2020-01-06 08:39:58
问题 I have a very deep row in a pdfptable. The columns in the left-hand side of this row contain a sub table which has many rows within it. I would like the deep row to split onto more than one page if it is too deep to fit on one page. I can set SplitLate to false to ensure that the row splits. However, the data for the deep columns on the right hand side only shows on the first page and I would like it to be repeated on the second page. A bit of investigation suggested that I could use a cell

Can I use an iTextSharp cell event to repeat data on the next page when a row is split?

时间秒杀一切 提交于 2020-01-06 08:39:06
问题 I have a very deep row in a pdfptable. The columns in the left-hand side of this row contain a sub table which has many rows within it. I would like the deep row to split onto more than one page if it is too deep to fit on one page. I can set SplitLate to false to ensure that the row splits. However, the data for the deep columns on the right hand side only shows on the first page and I would like it to be repeated on the second page. A bit of investigation suggested that I could use a cell

Insert HTML directly in PDF using itextsharp

a 夏天 提交于 2020-01-06 06:52:46
问题 I have WPF application in which user enters some text in rich text box(rtb), I convert that rtb string to HTML and then convert that HTML to image and then insert it in the PDF document using (Stream inputPdfStream = new FileStream("sample.pdf", FileMode.Open, FileAccess.Read, FileShare.Read)) using (Stream outputPdfStream = new FileStream("result2.pdf", FileMode.Create, FileAccess.Write, FileShare.None)) { var reader = new PdfReader(inputPdfStream); var stamper = new PdfStamper(reader,

How to add a secure and hidden attachment to a PDF document using iTextSharp

夙愿已清 提交于 2020-01-06 06:45:49
问题 I want to attach a file to an existing PDF document using iTextSharp and I can able to do it using pdfStamper.AddFileAttachment(...) method. Now I want to make the attachment hidden/secure in a way that no one able to see the attachment and even not able to retrieve it directly from PDF. It should only be retrieved from code. 回答1: I wouldn't store anything that has to be hidden in a File Attachment. That's a public, well-known mechanism that is understood and supported by multiple pieces of

How to add a secure and hidden attachment to a PDF document using iTextSharp

冷暖自知 提交于 2020-01-06 06:45:35
问题 I want to attach a file to an existing PDF document using iTextSharp and I can able to do it using pdfStamper.AddFileAttachment(...) method. Now I want to make the attachment hidden/secure in a way that no one able to see the attachment and even not able to retrieve it directly from PDF. It should only be retrieved from code. 回答1: I wouldn't store anything that has to be hidden in a File Attachment. That's a public, well-known mechanism that is understood and supported by multiple pieces of