itextsharp

How to update a PDF without creating a new PDF?

有些话、适合烂在心里 提交于 2019-11-26 02:26:33
问题 I am required to replace a word in an existing PDF AcroField with another word. I am using PDFStamper of iTEXTSHARP to do the same and it is working fine. But, in doing so it is required to create a new PDF and i would like the change to be reflected in the existing PDF itself. If I am setting the destination filename same as the original filename then no change is being reflected.I am new to iTextSharp , is there anything I am doing wrong? Please help.. I am providing the piece of code I am

Extract images using iTextSharp

心不动则不痛 提交于 2019-11-26 02:11:14
问题 I have been using this code with great success to pull out the first image found in each page of a PDF. However, it is now not working with some new PDFs for an uknown reason. I have used other tools (Datalogics, etc) that do pull out the images fine with these new PDFs. However, I do not want to buy Datalogics or any tool if I can use iTextSharp. Can anybody tell me why this code is not finding the images in the PDF? Knowns: my PDFs only have 1 image per page and nothing else. using

Can't get Czech characters while generating a PDF

混江龙づ霸主 提交于 2019-11-26 01:34:54
问题 I have a problem when adding characters such as \"Č\" or \"Ć\" while generating a PDF. I\'m mostly using paragraphs for inserting some static text into my PDF report. Here is some sample code I used: var document = new Document(); document.Open(); Paragraph p1 = new Paragraph(\"Testing of letters Č,Ć,Š,Ž,Đ\", new Font(Font.FontFamily.HELVETICA, 10)); document.Add(p1); The output I get when the PDF file is generated, looks like this: \"Testing of letters ,,Š,Ž,Đ\" For some reason iTextSharp

Reading PDF content with itextsharp dll in VB.NET or C#

让人想犯罪 __ 提交于 2019-11-26 01:14:24
问题 How can I read PDF content with the itextsharp with the Pdfreader class. My PDF may include Plain text or Images of the text. 回答1: using iTextSharp.text.pdf; using iTextSharp.text.pdf.parser; using System.IO; public string ReadPdfFile(string fileName) { StringBuilder text = new StringBuilder(); if (File.Exists(fileName)) { PdfReader pdfReader = new PdfReader(fileName); for (int page = 1; page <= pdfReader.NumberOfPages; page++) { ITextExtractionStrategy strategy = new

how can i get text formatting with iTextSharp

早过忘川 提交于 2019-11-26 00:55:18
问题 I am using iTextSharp to read text contents from PDF. I am able to read that also. But I am loosing text formatting like the font, color etc. Is there any way to get that formatting as well. Below is the code segment i am using to exact text - PdfReader reader = new PdfReader(\"F:\\\\EBooks\\\\AspectsOfAjax.pdf\"); textBox1.Text = ExtractTextFromPDFBytes(reader.GetPageContent(1)); private string ExtractTextFromPDFBytes(byte[] input) { if (input == null || input.Length == 0) return \"\"; try {

How to convert HTML to PDF using iTextSharp

淺唱寂寞╮ 提交于 2019-11-25 23:03:39
问题 I want to convert the below HTML to PDF using iTextSharp but don\'t know where to start: <style> .headline{font-size:200%} </style> <p> This <em>is </em> <span class=\"headline\" style=\"text-decoration: underline;\">some</span> <strong>sample<em> text</em></strong> <span style=\"color: red;\">!!!</span> </p> 回答1: First, HTML and PDF are not related although they were created around the same time. HTML is intended to convey higher level information such as paragraphs and tables. Although

how can i get text formatting with iTextSharp

可紊 提交于 2019-11-25 19:34:50
I am using iTextSharp to read text contents from PDF. I am able to read that also. But I am loosing text formatting like the font, color etc. Is there any way to get that formatting as well. Below is the code segment i am using to exact text - PdfReader reader = new PdfReader("F:\\EBooks\\AspectsOfAjax.pdf"); textBox1.Text = ExtractTextFromPDFBytes(reader.GetPageContent(1)); private string ExtractTextFromPDFBytes(byte[] input) { if (input == null || input.Length == 0) return ""; try { string resultString = ""; // Flag showing if we are we currently inside a text object bool inTextObject =