itext7

PDF/A signed with iText7 allows changing attached documents without breaking a signature

大城市里の小女人 提交于 2019-12-02 04:06:33
I have created a PDF/A document using iText7. The created document has an attachment (). The attachment is a .csv file. Then the whole PDF/A has been signed. I have opened the attached .csv file and changed it after I have signed it. I have used following code to verify the signature: public PdfPKCS7 verifySignature(SignatureUtil util, String name) throws GeneralSecurityException, IOException { System.out.println("Signature covers whole document: " + util.signatureCoversWholeDocument(name)); System.out.println("Document revision: " + util.getRevision(name) + " of " + util.getTotalRevisions());

How to bring image to the front(of the text/image) or send the image to the back((of the text/image)) in IText7 using java?

无人久伴 提交于 2019-12-02 00:19:04
How to bring image to the front(of the text/image) or send the image to the back((of the text/image)) in IText7(7.0.8) using Java? import java.io.FileNotFoundException; import java.io.IOException; import com.itextpdf.io.image.ImageData; import com.itextpdf.io.image.ImageDataFactory; import com.itextpdf.kernel.pdf.PdfDocument; import com.itextpdf.kernel.pdf.PdfReader; import com.itextpdf.kernel.pdf.PdfResources; import com.itextpdf.kernel.pdf.PdfWriter; import com.itextpdf.kernel.pdf.canvas.PdfCanvas; public class AddImageUnderlayToPDF { public static void main(String[] args) throws

iText7 get table height

非 Y 不嫁゛ 提交于 2019-12-01 14:25:41
Here is a snippet of my code Dim table As iText.Layout.Element.Table = New iText.Layout.Element.Table(4) table.SetWidth(pagesize.GetWidth - 40) Dim something As Paragraph = New Paragraph("LONG TEXT") Dim cell as Cell = New Cell().Add(New Paragraph("Some Text").SetFont(timesNewRoman)) table.AddCell(cell) table.AddCell(cell) table.AddCell(cell) table.AddCell(cell) canvas.Add(table.SetMarginLeft(20)) Dim unit as UnitValue = table.GetHeight() I always get back nothing as the table height? I don't understand why. Is there a way for me to get the table height? If it makes a difference, this table is

iText7 get table height

人盡茶涼 提交于 2019-12-01 13:10:48
问题 Here is a snippet of my code Dim table As iText.Layout.Element.Table = New iText.Layout.Element.Table(4) table.SetWidth(pagesize.GetWidth - 40) Dim something As Paragraph = New Paragraph("LONG TEXT") Dim cell as Cell = New Cell().Add(New Paragraph("Some Text").SetFont(timesNewRoman)) table.AddCell(cell) table.AddCell(cell) table.AddCell(cell) table.AddCell(cell) canvas.Add(table.SetMarginLeft(20)) Dim unit as UnitValue = table.GetHeight() I always get back nothing as the table height? I don't

Traverse whole PDF and change blue color to black ( Change color of underlines as well) + iText

旧巷老猫 提交于 2019-12-01 10:27:00
问题 I am using below code to remove blue colors from pdf text. It is working fine. But it is not changing underlines color, but changing text color correctly. original file part: Manipulated File: As you see in above manipulated file, underline color didn't change. I am looking fix for this thing since two weeks, can anyone help on this. Below is my change color code: public void testChangeBlackTextToGreenDocument(String source, String filename) throws IOException { try (InputStream resource =

iText 7 PDF accessibility: “Table header cell has no associated subcells”

[亡魂溺海] 提交于 2019-12-01 02:09:38
I am converting HTML to a PDF using iText 7. I need the PDF to be accessible (508 compliant with appropriate tags, etc), but, no matter what markup I put on a table, accessibility checkers give the same error: "Table header cell has no associated subcells". I've tried setting scope, headers, etc... nothing seems to work. Here is an example of one of the tables but all of them have the same issue: <table class="problems" summary="Patient's diagnosed problems and associated ICD codes."> <thead> <tr> <th scope="col" id="problem-header"> Problem </th> <th scope="col" id="icd-code-header"> Code <

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

半城伤御伤魂 提交于 2019-11-29 17:29:23
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 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 signature was attacked or not. It analyses several suspects and if that analysis turns out negative, Adobe will

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

女生的网名这么多〃 提交于 2019-11-29 17:17:26
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 the same page foreach (var element in RenderHtmlAndCss(document, css, html)) { AddElement(document, null,

In Itext 7, how to sign a pdf with 2 steps?

北城以北 提交于 2019-11-29 16:48:45
Following the answers given in this previous question : In Itext 7, how to get the range stream to sign a pdf? , i've tried to reimplement the two steps signing method working in Itext 5 but i encounter an issue when trying to reopen the document result of the first step (with the PdfReader or a pdf reader).(invalid document) Here is the presigning part for a document already containing an empty signature field named certification ... why is the result of this step invalid ? PdfReader reader = new PdfReader(fis); Path signfile = Files.createTempFile("sign", ".pdf"); FileOutputStream os = new

Is it possible to merger several pdfs using iText7

不羁岁月 提交于 2019-11-29 15:50:40
Apologies for asking this, but I cannot see anything definitive on the iText website. I have several datasheets for products. Each is a separate file. What I want to do is to use iText to generate a summary / recommended set of actions, based on answers to a webform, and then append to that all the relevant datasheets. This way, I only need to open one new tab in the browser to print all information, rather than opening one for the summary, and one for each datasheet that is needed. So, is it possible to do this programmatically using iText? mkl Yes, you can merge PDFs using iText 7. E.g. look