itext7

Itext7: render PDF page to image

余生颓废 提交于 2019-12-11 06:39:44
问题 Can I render a PDF Page to a real image object (e.g. BufferedImage) using IText 7? 回答1: If you really want to do this, consider using GhostScript. Ghostscript is a suite of software based on an interpreter for Adobe Systems' PostScript and Portable Document Format (PDF) page description languages. Its main purposes are the rasterization or rendering of such page description language files, for the display or printing of document pages, and the conversion between PostScript and PDF files. --

iText 7.1.6 + Document was closed. It is impossible to execute action

霸气de小男生 提交于 2019-12-11 06:27:07
问题 I am using Itext 7.1.6 to generate the PDF. When I try to run , I get this error document was closed . It is impossible to execute the action. I checked solutions in stackoverflow for this but they are saying it is related to fonts. I modified the fonts by creating instance every time I use it but even then I get same issue. I am unable to figure out how I can resolve this issue. Can anyone please help me to fix it ? Please find the below code and exception Document doc = null; PdfPage

iText 7 .NET makes my fields readonly automatically

痞子三分冷 提交于 2019-12-11 06:16:02
问题 I am fairly new to iText. I downloaded a free 30 day trial and tried the following on .NET MVC: 1. Extract fields from PDF form: string src = "mypdf.pdf"; string dest = "mypdfRES.pdf"; PdfReader newReader = new PdfReader(src); newReader.SetUnethicalReading(true); PdfDocument pdf = new PdfDocument(newReader, new PdfWriter(dest)); PdfAcroForm form = PdfAcroForm.GetAcroForm(pdf, true); IDictionary<String, PdfFormField> fields = form.GetFormFields(); After that I set a value to a specific field

Errors with itext7

倖福魔咒の 提交于 2019-12-11 06:08:22
问题 I am trying to add some "multiple rows and columns"'s cell to table, but got IndexOutOfBoundsException. Any help will be greatly appreciated. Thanks! public static void main(String[] args) throws FileNotFoundException { PdfWriter writer = new PdfWriter("D:\\test.pdf"); PdfDocument pdf = new PdfDocument(writer); Document document = new Document(pdf); Table table = new Table(10); table.setWidthPercent(100); table.addCell(new Cell(1, 3).add(new Paragraph(1 + "_" + 3 + "_"))); table.addCell(new

Multiple Renderers per iText document: Updated with more details

别等时光非礼了梦想. 提交于 2019-12-11 01:46:32
问题 I am using iText7 to create a document which has multiple sections. Some of the sections are to be formatted normally, but some are to be formatted into columns. I can get it to format properly into columns by using the ColumnDocumentRenderer object, but when I do so, the entire document is set to use columns. Is there any way to have iText swap which renderer to use on the fly? When I try to swap out renderers on the fly, I get a null pointer exception (com.itextpdf.kernel.pdf.PdfDictionary

Get the Creation Date of a PDF file using iText 7

隐身守侯 提交于 2019-12-10 17:52:21
问题 I have to create a tool which adds to several .pdf file names their creation date. I'd like to use the creationdate stored internally in pdfs and for this I downloaded iText Community Edition. Now, my code starts like this (VB) Module Module1 Sub Main() Dim filename As String = My.Application.CommandLineArgs(0) Dim PDFReader = New Pdf.PdfReader(filename) Dim PDFDocument = New Pdf.PdfDocument(PDFReader) Dim documentinfo As Pdf.PdfDocumentInfo = PDFDocument.GetDocumentInfo Dim author As String

iText 7 return Pdf from Asp.Net WebApi

不羁的心 提交于 2019-12-10 12:06:11
问题 So I am alreay searching about this the entire day and I just don't know how to get it working. Basically I want to create a PDF server side with iText 7 in my ASP.Net WebApi. Very straightforward and easy Pdf creation: [HttpGet] public HttpResponseMessage CreateLieferschein() { MemoryStream stream = new MemoryStream(); PdfWriter writer = new PdfWriter(stream); var pdf = new PdfDocument(writer); var document = new Document(pdf); document.Add(new Paragraph("Hello World!")); } From here on I

iText7 C# .net core extract images from pdf document

给你一囗甜甜゛ 提交于 2019-12-10 12:04:37
问题 I know similar questions have been asked before, however, they are hideously out of date (some going back to 2006). I have a .net 3.5 app (w/ iTextSharp 5) I am converting to .net core (iText 7) which extracts signatures from FedEx tracking documents, sent in a byte[] array via a SOAP service. This code has worked very well for many years now with minor updates. There are a couple of images in the PDF document returned from Fedex but the signature block is not the 110x46 image (which is the

AcroField changes made using itext7 in C# do not commit/are not visable due to hybrid AcroForm-XFA issues

北战南征 提交于 2019-12-10 11:47:23
问题 Project is to fill existing forms programmatically from a database/datagridview and allow the user to edit the forms afterwards as the database does not hold all values needed. I am able to get the values, and put them into the form however: Values set using AcroForms do not show/print when viewing form. Background color change does not show when viewing form. Both changes appear when clicking into the field. I understand this is caused by hybrid XFA and AcroForms issues, and that pdfXFA is a

iText 7 - Add and Remove Watermark on a PDF

泄露秘密 提交于 2019-12-10 10:06:13
问题 I would like to add and remove a watermark to a PDF using iText 7. I was able to add the watermark, but unable to remove it again. I could only find relevant code/examples related to iText 5. Any pointers appreciated, thanks. This is how I added the Watermark (using Layers): pdfDoc = new PdfDocument(new PdfReader(sourceFile), new PdfWriter(destinationPath)); var numberOfPages = pdfDoc.GetNumberOfPages(); PageSize ps = pdfDoc.GetDefaultPageSize(); for (var i = 1; i <= numberOfPages; i++) {