itext7

Spacing between paragraphs

限于喜欢 提交于 2020-05-09 05:48:07
问题 In iText7 I need to create 5 lines of text at the top of a document that are centered to the page. The easiest way I found to do this is: doc.add(new Paragraph("text of line 1").SetTextAlignment(TextAlignment.CENTER)); doc.add(new Paragraph("text of line 2").SetTextAlignment(TextAlignment.CENTER)); etc. However there is a larger amount of space between each of the lines than I want. Within a paragraph you can set line leading, but how do I set leading between paragraphs in a document? Or am I

How to understand pdf forms flags?

倖福魔咒の 提交于 2020-04-30 06:37:15
问题 I read pdf structure using pdfbox and I can't find out some data from stream: 1 g 0 0 18 18 re f 0.5 0.5 17 17 re s q 1 1 16 16 re W n 0 g BT /ZaDb 14.532 Tf 2.853 4.081 Td 13.9943 TL (4) Tj ET Q It is stream information about checkbox but what does it mean that letters? Can anyone explain to me or it would be better if you can share with me where I can read about it? 回答1: 1 g --- select DeviceGray WHITE as non-stroking color 0 0 18 18 re --- define a 18×18 rectangular path, lower left at 0,0

Add signature field on rotated document

喜你入骨 提交于 2020-04-16 05:45:11
问题 I am trying to add signature field on rotated document but I want to have no rotation applied on signature field and it should be added on rotated page with 0 rotation. I have tried the following method but it does not work for me. page.SetIgnorePageRotationForContent(true); Could anyone provide solution of this issue? Signature appearance code snippet: PdfFormXObject layer2Object = _pdfSignatureAppearance.GetLayer2(); PdfCanvas pdfCanvas = new PdfCanvas(layer2Object, _pdfSigner.GetDocument()

HTML to PDF adding a table of contents (TOC) dynamically

余生颓废 提交于 2020-04-14 07:32:08
问题 I am using iText 7 to convert html to PDF, but I couldn't find even one example on how to add a table of contents to the final PDF. Converting a text to PDF and adding a TOC is an easy task when following iText example here, but apparently it is not possible when converting HTML to PDF. The requirement is simple, just find all the HTML tag attributes "data-toc" and use the value to create the TOC Here is what I got so far using the same approach used in the Text to PDF sample here: VS 2019

iText embedding Color space (ICC Profile) in PDF Images

做~自己de王妃 提交于 2020-04-07 09:04:52
问题 I am using iText-7 java library to generate pdf using below code. (I am adding image to pdf doc) pdf = new PdfDocument(writer); Document document = new Document(pdf); ImageData data = ImageDataFactory.create(imgfilepath); Image img = new Image(data); img.scaleToFit(imageWidth, imageHeight); img.setFixedPosition(1, 0, 0); document.add(img); -Using same Image i have created PDF from acrobat. Problem : (1) When i print above 2 PDFs- 1 created using iText, 2- created using Acrobat - i see quality

iText embedding Color space (ICC Profile) in PDF Images

白昼怎懂夜的黑 提交于 2020-04-07 09:04:09
问题 I am using iText-7 java library to generate pdf using below code. (I am adding image to pdf doc) pdf = new PdfDocument(writer); Document document = new Document(pdf); ImageData data = ImageDataFactory.create(imgfilepath); Image img = new Image(data); img.scaleToFit(imageWidth, imageHeight); img.setFixedPosition(1, 0, 0); document.add(img); -Using same Image i have created PDF from acrobat. Problem : (1) When i print above 2 PDFs- 1 created using iText, 2- created using Acrobat - i see quality

iText embedding Color space (ICC Profile) in PDF Images

前提是你 提交于 2020-04-07 09:03:09
问题 I am using iText-7 java library to generate pdf using below code. (I am adding image to pdf doc) pdf = new PdfDocument(writer); Document document = new Document(pdf); ImageData data = ImageDataFactory.create(imgfilepath); Image img = new Image(data); img.scaleToFit(imageWidth, imageHeight); img.setFixedPosition(1, 0, 0); document.add(img); -Using same Image i have created PDF from acrobat. Problem : (1) When i print above 2 PDFs- 1 created using iText, 2- created using Acrobat - i see quality

Adding a new page in PDF using itext 7

扶醉桌前 提交于 2020-04-06 04:49:34
问题 I'm trying to create a PDF Document using iText 7 with below code and my PDF documents contents are overlapping in same page when generated.(i.e in Page 1). I see the document.newPage(); method is missing in iText 7. How can i add pages to my PDF document without using pdfDocumet.copyPages(...) or PDFmerger in itext 7. PdfDocument pdfDoc = new PdfDocument(new PdfWriter(dest)); pdfDoc.addNewPage(); Document PageOnedocument = new Document(pdfDoc,PageSize.A4); addPageOneContents(PageOnedocument)

Adding a new page in PDF using itext 7

ぃ、小莉子 提交于 2020-04-06 04:48:46
问题 I'm trying to create a PDF Document using iText 7 with below code and my PDF documents contents are overlapping in same page when generated.(i.e in Page 1). I see the document.newPage(); method is missing in iText 7. How can i add pages to my PDF document without using pdfDocumet.copyPages(...) or PDFmerger in itext 7. PdfDocument pdfDoc = new PdfDocument(new PdfWriter(dest)); pdfDoc.addNewPage(); Document PageOnedocument = new Document(pdfDoc,PageSize.A4); addPageOneContents(PageOnedocument)

Text scaling problem with itext7, hidden margins?

我们两清 提交于 2020-02-25 04:13:53
问题 I'm trying to get this c# function from within a asp.netcore razor project using itext7 (7.1.7) to output a div containing text that scales up to within the constraints given with height and width. However, for some reason it seems there's some kind of hidden margin that will not scale the text to the boundaries of the given width and height, even though the margins are set to 0. At the moment the maximum text i get is only half of what it should be. Also, the paragraph, nor the div is