itext7

Trying to copy source pdf to destination at specific Y position

孤人 提交于 2019-12-24 07:17:52
问题 I am testing a method which reads from an existing pdf called 55PREMIUMPAYMENTWARRANTY.pdf which has a couple of small paragraphs 3 lines each at the top. I am then trying to copy it to a new document at a different Y position using the canvas. I have called this method in a loop with various positions and surprised at the results. The Y position usually starts at 0 at the bottom left, yet it only shows on the new page if the Y value is a negative.. why is that? Usually if I was just writing

iText 7.0.5 - Forms - NullPointerException when adding a lot of tables with form fields

时间秒杀一切 提交于 2019-12-24 01:16:50
问题 I used Bruno's example (https://developers.itextpdf.com/examples/form-examples/clone-create-fields-table) to add form fields to tables in a newly created document. The example itself works without any problems, but if I want to create 50 tables I get the following exception: Exception in thread "main" java.lang.NullPointerException at com.itextpdf.kernel.pdf.PdfDictionary.get(PdfDictionary.java:552) at com.itextpdf.kernel.pdf.PdfDictionary.getAsArray(PdfDictionary.java:156) at com.itextpdf

how to rotate pages but not the text in iText?

时间秒杀一切 提交于 2019-12-22 08:33:33
问题 I'm trying to create a PDF document with some pages in portrait and others in landscape, but seeing this example (iText7 - Page orientation and rotation) I found that the page rotates to landscape but the text also does it (PDF generated from iText7 samples), then, I need that the pages to rotate but the text continues from left to right, how in the next image. Note: I tried to use document.getPdfDocument().addNewPage(new PageSize(PageSize.A4.rotate())); but it works for one page, not for the

iText 7: Paragraph height as it would be rendered

☆樱花仙子☆ 提交于 2019-12-21 05:24:08
问题 I can set the width of a new paragraph as follows, which results in a certain height: Paragraph p = new Paragraph("some longer text some longer text some longer text"); p.setWidth(100); System.out.println("height " + p.getHeight()); document.add(p); Of course p.getHeight() is null , since the rendered height is calculated during rendering the PDF file. But I need the height before the final rendering. How can I get it most efficiently? 回答1: To get the effective width of the paragraph as if it

Itext 7 overriding default margin in pdfHtml

一个人想着一个人 提交于 2019-12-20 06:14:04
问题 I have html content that has to start at the absolute top left corner of the page. However, the HtmlConverter automatically adds a 0.5in gap from the top and left side of the pdf page. How do I override this default margin? 回答1: You can set the margins of a page through CSS using @page. The following declaration sets all the page-margins to 0, as well as draws a border around paragraphs for visual reference: @page{ margin:0pt; } p{ border-left: solid 2pt blue; border-top: solid 1pt blue;

Itext 7 overriding default margin in pdfHtml

别来无恙 提交于 2019-12-20 06:13:04
问题 I have html content that has to start at the absolute top left corner of the page. However, the HtmlConverter automatically adds a 0.5in gap from the top and left side of the pdf page. How do I override this default margin? 回答1: You can set the margins of a page through CSS using @page. The following declaration sets all the page-margins to 0, as well as draws a border around paragraphs for visual reference: @page{ margin:0pt; } p{ border-left: solid 2pt blue; border-top: solid 1pt blue;

How to get vertical cursor position when writing document in iText 7?

∥☆過路亽.° 提交于 2019-12-18 09:37:07
问题 In iText 5 there is a method named getVerticalPosition() which gives the position on the page for the next object written. As answers this question How to find out the current cursor position on a page? and which is documented here What is the equivalent for iText 7 to get the current vertical position on the page for writing the document? UPDATE DATE: 08-11-2018: As per the response in the comment I have updated the logic of adding a page preak or a new page but both are still printing on

Why is one of these two itext 7 signed and validated document is not valid with Adobe DC reader?

浪子不回头ぞ 提交于 2019-12-18 09:33:36
问题 I've two pdf documents certified (signed and validated with the same mechanism based on Itext 7 ) and when i use adobe reader DC to check their validity, only one has the green mark. the good one: https://1drv.ms/b/s!AkF6t4TavwMvgxWaidlUqvPvHH1r the bad one: https://1drv.ms/b/s!AkF6t4TavwMvgxQCMdGY61S1EvUh Regards David L 回答1: This is not an Adobe bug, it's a feature. (And an iText bug) When Adobe performs the cryptographic validation, it will also perform additional checks to see if a

Import itext-7 in android gradle

三世轮回 提交于 2019-12-18 08:46:53
问题 I am trying to add itext-7 to android, after adding the following in gradle compile 'com.itextpdf:root:7.0.0' I am still not able to find the classes of itext e.g PDFWriter etc. Please let me know if there's separate version for itext-7 for Android also how to add it. P.S : I have added itext-5 successfully, but i want to work with itext-7 now. 回答1: The root artifact is a mere parent pom and does not contain iText 7 classes at all. If you want to include all iText 7 Core functionality, you

Draw custom borders for table with more flexibility in itext7

喜欢而已 提交于 2019-12-17 20:32:48
问题 Previously I asked a question about drawing custom table borders: Draw custom borders for table spanning across more than one page in itext7 And there an answer was provided with a way to draw custom borders, but it does not allow to affect the complete row or column line (for example to tilt it slightly) because cell borders are drawn separately for each cell. I want to add some randomness to table borders like in the following screenshot: Here is the code I have that works for tables that