itextsharp

Add signature image on PDF without digitally signing it using iTextSharp

北战南征 提交于 2019-11-30 17:11:36
问题 I am using iTextSharp to work with PDFs. I want to add signature image to Signature field without digitally signing the document (without any involvement of certificate). Is it possible? I am able to work with digital signing but I also want to just add signature image on signature field without any use of certificates. UPDATE: Write now I have following code. // Set PDF Reader and PDF Stamper PdfReader reader = new PdfReader(sourceDocument); // File stream where PDF will write FileStream

iTextSharp - Add image to PDF from Datatable

怎甘沉沦 提交于 2019-11-30 15:58:53
问题 I try to create a PDF report from a datatable. One of the columns contents image. How can I extract the image from datatable and insert into PDF table? I'm using iTextShap version 5.4.2.0. Here is the code: public void Report(DataTable dt, string output) { Document doc = new Document(PageSize.LETTER, 50, 50, 80, 50); PdfWriter PDFWriter = PdfWriter.GetInstance(doc, new FileStream(output, FileMode.Create)); PDFWriter.ViewerPreferences = PdfWriter.PageModeUseOutlines; iTextSharp.text.Font hel8

how to add the current page number and total number of pages in Itextsharp [duplicate]

跟風遠走 提交于 2019-11-30 15:57:16
问题 This question already has answers here : put page number when create PDF with iTextSharp (2 answers) Closed 3 years ago . how the current page number and the total number of pages in the pdf file as Page : 3/10 My code is as follows //PdfPTable saleTable = SaleTable(); FileStream fileStream = new FileStream(Customer + "Invoice.pdf", FileMode.Create, FileAccess.Write, FileShare.None); Document doc = new Document(PageSize.A4); PdfWriter writer = PdfWriter.GetInstance(doc, fileStream); doc.Open(

Convert PartialView Html to String for ITextSharp HtmlParser

大兔子大兔子 提交于 2019-11-30 15:28:52
I've got a partial view, i'm trying to use ITextSharp to convert the html to pdf. How can I convert the html to string so I can use ItextSharps HtmlParser? I've tried something like this with no luck...any ideas?: var contents = System.IO.File.ReadAllText(Url.Action("myPartial", "myController", new { id = 1 }, "http")); I have created a special ViewResult class that you can return as the result of an Action. You can see the code on bitbucket (look at the PdfFromHtmlResult class). So what it basically does is: Render the view through the Razor engine (or any other registered engine) to Html

how to add the current page number and total number of pages in Itextsharp [duplicate]

烂漫一生 提交于 2019-11-30 14:46:16
This question already has an answer here: put page number when create PDF with iTextSharp 2 answers how the current page number and the total number of pages in the pdf file as Page : 3/10 My code is as follows //PdfPTable saleTable = SaleTable(); FileStream fileStream = new FileStream(Customer + "Invoice.pdf", FileMode.Create, FileAccess.Write, FileShare.None); Document doc = new Document(PageSize.A4); PdfWriter writer = PdfWriter.GetInstance(doc, fileStream); doc.Open(); glue = new Chunk(new VerticalPositionMark()); _phrase1.Add(new Chunk(glue)); _phrase1.Add(new Chunk("Page Number: "));

itextsharp convert points to cm

前提是你 提交于 2019-11-30 14:05:11
问题 I am using iTextsharp - a java pdf lib - to generate pdfs dynamically. Now as I understood it, measurements are specified in points. I know where to place what on the place in cm. so I need the conversion: points <-> cm 回答1: iText(Sharp) has a Utilities class (package com.itextpdf.text / namespace iTextSharp.text ) which contains several static conversion methods, in particular: // iText public static final float millimetersToPoints(final float value); public static final float

Display ASP.NET generated pdf byte[] to web page without saving the file

只谈情不闲聊 提交于 2019-11-30 14:01:47
问题 I'm using iTextSharp for generating a pdf. I can save the PDF file from the PDF byte[]. byte[] outputPDF = cnt.CreateBreakPDF(); File.WriteAllBytes(pdfOutPutPath, outputPDF); What is the best way to display the output byte[] to a web page? I want to show the PDF inside a div in my page. Not the PDF as a full response. I've seen answers for MVC, but I'm using ASP.NET Web Application. Is there a better way than using HTTP handlers to do so? I don't want to send all the details for creating PDF

How to flatten already filled out PDF form using iTextSharp

半世苍凉 提交于 2019-11-30 12:06:49
I'm using iTextSharp to merge a number of pdf files together into a single file. I'm using method described in iTextSharp official tutorials, specifically here , which merges files page by page via PdfWriter and PdfImportedPage. Turns out some of the files I need to merge are filled out PDF Forms and using this method of merging form data is lost. I've see several examples of using PdfStamper to fill out forms and flatten them. What I can't find, is a way to flatten already filled out PDF Form and hopefully merge it with the other files without saving it flattened out version first. Thanks

Search Particular Word in PDF using Itextsharp

家住魔仙堡 提交于 2019-11-30 11:53:07
问题 This is my first post in StackOverflow. I have a PDF file in my System drive... I want to write a program in C# using Itextsharp.dll reference to search for a Particular word in that PDF ... say I want to search "StackOverFlow"... If the PDF contains the Word " StackOverFlow" , it should return true. Else it should return false. I have looked into many articles but didn't get the solution till now ..:-( What I have tried till now is : public string ReadPdfFile(string fileName) { StringBuilder

How to draw a line every 25 words?

[亡魂溺海] 提交于 2019-11-30 10:00:28
问题 Using iTextSharp, I create a pdf writing some text into it. What I need is to draw a line to delimiter the text every 25 words, like the following image: Basically, I need to do that: draw a line every 25 words, just like the image. I'm aware there's a way of finding the position of a word on a page, but considering I'm writing the text to the pdf file, I guess there could be a way of calculating this without really having to find the text position, right? 回答1: Please take a look at the