itextsharp

Remove unused image objects

旧城冷巷雨未停 提交于 2019-12-23 05:06:04
问题 I have PDF files that are being created with a composition tool to produce financial statements. The PDF files are around the 5000 - 10000 pages per file using global image resources to maximise space efficiences. These statements include marketing images. Many of them (about 3mb worth), not every particular statements uses all the images. When I extract the PDF file using a tool that has been developed for this purpose (or if I use adobe acrobat just for testing purposes) - to extract a

How to find the background color of the text using itextsharp

南笙酒味 提交于 2019-12-23 04:52:35
问题 I am able to find the foreground color of the text using itxtsharp (renderInfo.GetFillColor()), is it possible to find the background color of the text using itextsharp.i.e. Some of the text in the PDF file are inside the color box, i need to skip the text that are present inside the color box, is it possible. Please advice on this. Thanks in advance. //Used to get the foreground color of the text BaseColor curColor = new BaseColor(0f, 0f, 0f); if (renderInfo.GetFillColor() != null) curColor

Stack empty Error when using iTextSharp for converting HTML to PDF

空扰寡人 提交于 2019-12-23 04:52:27
问题 I want to export in pdf my htmlcode var document = new Document(); string filePath = Server.MapPath("~/generatedBook"); string exceptionPath = Server.MapPath("~/exceptions"); PdfWriter pdfWriter = PdfWriter.GetInstance(document, new FileStream(filePath + "/Book"+_IdSes+".pdf", FileMode.Create)); pdfWriter.SetFullCompression(); pdfWriter.StrictImageSequence = true; pdfWriter.SetLinearPageMode(); try { document.SetPageSize(PageSize.A4.Rotate()); document.SetPageSize(new Rectangle(792f, 612f));

iTextSharp acroFields.SetField method and multiple form fields with same name

落爺英雄遲暮 提交于 2019-12-23 04:43:09
问题 In case of multiple fields with same name iTextSharp acroFields.SetField(Name, Value) sets value for first field only. How to set the value for the rest of the fields? When looping thru the acroFields.Fields the field names are reported as form1[0].#subform[0].TextField1[0] - TextField form1[0].#subform[0].TextField2[0] - TextField form1[0].#subform[0].TextField2[1] - TextField form1[0].#subform[0].TextField2[2] - TextField When using acroFields.SetField("TextField1", Value); the value of

Retrieve binary image data from SQL Server into pdf via iTextSharp ASP.NET

女生的网名这么多〃 提交于 2019-12-23 04:40:10
问题 I'm trying to retrieve binary image data from my SQL server and export it into my pdf file by using the follow method phrase.Add(new Chunk("Image :", normalFont)); Byte[] bytes = (Byte[])dr[0]; Response.Buffer = true; Response.Charset = ""; Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.ContentType = "image/jpg"; Response.BinaryWrite(bytes); Response.Flush(); Response.End(); phrase.Add(bytes); table.AddCell(phrase); When i'm trying to display binary image data into my

Using itextsharp and MVC to display a range of PDF pages in a web page

孤街浪徒 提交于 2019-12-23 04:04:56
问题 I used this site to copy examples and to ask help from various people so I thought I would share my attempt at putting things together with others who might be interested. The following takes a range of pages from an existing PDF file and displays the result in an iframe or a new Tab. It uses [itextsharp][1] The code contains a fair amount of novice code but at least it works. There is absolutely no point point in asking me any questions because I almost certainly will not know the answer. If

Write FDF to PDF using iTextsharp

十年热恋 提交于 2019-12-23 02:28:15
问题 I am trying to save a PDF file by saving the data from the FDF into a PDFTemplate , in my WPF application. So, the situation is like this. I have a PDFTemplate.pdf which serves as a template and has placeholders (or fields). Now I generate this FDF file pro-grammatically, which in turn contain all the field names required for the PDFTemplate to be filled in. Also, this FDF contains the file path for the PDFTemaplte also, so that on opening, it knows which PDF to use. Now, when try and double

Removing all text from a PDF

自作多情 提交于 2019-12-23 01:57:11
问题 I have a collection of PDFs that comprise of scanned images, which have then been OCR'd. The text is still displayed "graphically" - in other words, the scanned image text is still present - and the OCR'd text is "behind the image". This allows the documents to be searched, the text copied etc. Due to a nasty (and now resolved) bug in OS X, some of the OCR'd text is corrupted. I'd like to therefore remove the text from the PDF, and re-OCR the document. For many non-trivial reasons, I don't

iTextSharp get PDF DPI

此生再无相见时 提交于 2019-12-22 18:57:10
问题 How can I get the DPI of the PDF that I am reading from my hard drive into iTextSharp? 回答1: PDF's do not necessarily use DPI in their definitions. PDF's allow the document creator to define their own user coordinate space which may or may not map to anything similar to Dots Per Inch. 回答2: Check this How to calculate the correct image size in out pdf using itextsharp ? PDF UserUnit shall give the size of default user space units, in multiples of 1 ⁄ 72 inch. ISO-32000-1 (section 8.3.2.3) tells

Dynamically creating .pdfs under the ITextSharp Free Licence

荒凉一梦 提交于 2019-12-22 17:42:13
问题 In a ASP.NET C# website/server I am using the .pdf creater library called ITextSharp to create .pdfs with text & some images about a product. As usual the boss doesn't want to purchase a licence. I know that if I use ITextSharp versions 4.1.6 or lower I can use the library under the free licence(cant I?) My Question: Will the older versions(4.1.6-)/free versions meet my needs of generating a pdf with an image at the top, text content in the middle(some paragraphs) and an image at the bottom?