itext7

iText 7: Generated Stamp Breaks Upon Rotation

百般思念 提交于 2019-12-12 04:36:41
问题 I'm trying to create stamps using iTextsharp - as far as I'm concerned, the position and size of the resulting stamp is handled appropriately. However, once the user opens the document using the reader, attempting to rotate the stamp simply breaks it. The stamp turns into blank box with an "X" as shown below: The code I am using is as follows: Rectangle location = new Rectangle(crop.GetLeft(),crop.GetBottom(),iWidth/4,iHeight/4); PdfStampAnnotation stamp = new PdfStampAnnotation(location)

Using iText7 (Java) to add a table to an existing PDF and continue on additional pages

佐手、 提交于 2019-12-12 02:44:07
问题 I am attempting to complete a project with almost identical requirements as those associated with this question asked in 2015. The answer provided by Bruno was perfect, but related to iText5. I am relatively new to iText, and am desperately trying to get up-to-speed to complete a current project. I need to populate the fields of a PDF document I need to add a table below the populated section, and the table needs to span multiple pages thereafter Can anyone assist with the translation of

Traverse whole PDF and Remove underlines of hyperlinks (annotations) only + iText

南楼画角 提交于 2019-12-11 19:36:31
问题 I have successfully changed the color of underlines using below link code. Can anyone help me how to remove underlines from PDF, the underlines i have find using below link code. Traverse whole PDF and change blue color to black ( Change color of underlines as well) + iText Below is my code that are finding hyperlinks and changing their colors to black. I have to modify this code to remove those underlines. PdfCanvasEditor editor = new PdfCanvasEditor() { @Override protected void write

iText7 Table of Content

我与影子孤独终老i 提交于 2019-12-11 17:18:17
问题 I am new to iText7, but have a decent grasp of most of the concepts. I would like to create a table of content (TOC) for my PDF, and found the following java example on their website: https://developers.itextpdf.com/content/itext-7-examples/itext-7-bookmarks-tocs/toc-first-page Converting the program to c# has worked out with normal text, but when having the Paragraphs inside Cells in a table, it doesn't work anymore. Furthermore i can't get the Reorder pages part to work, any ideas? EDIT:

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

眉间皱痕 提交于 2019-12-11 16:19:02
问题 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

Why is my form being flattened without calling the flattenFields method?

半城伤御伤魂 提交于 2019-12-11 16:01:10
问题 I am testing my method with this form https://help.adobe.com/en_US/Acrobat/9.0/Samples/interactiveform_enabled.pdf It is being called like so: Pdf.editForm("./src/main/resources/pdfs/interactiveform_enabled.pdf", "./src/main/resources/pdfs/FILLEDOUT.pdf")); where Pdf is just a worker class and editForm is a static method. The editForm method looks like this: public static int editForm(String inputPath, String outputPath) { try { PdfDocument pdf = new PdfDocument(new PdfReader(inputPath), new

iText7 Image Transparency

本秂侑毒 提交于 2019-12-11 15:35:25
问题 I want to add a transparent png image to an existing pdf to blur some part of the text. I don't understand how to apply the transparency I have tried several code examples found in the documentation, but none worked // Read the pdf input PdfReader pdfReader = new PdfReader(value); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); PdfWriter pdfWriter = new PdfWriter(outputStream); PdfDocument pdfDoc = new PdfDocument(pdfReader, pdfWriter); Document document = new Document

iText7 multiple signature

ぃ、小莉子 提交于 2019-12-11 15:21:56
问题 I want to do multiple signatures in a pdf document with iText7 , but the problem is when I have once sign , it works . If I sign twice , the first signature is invalid . It looks like this : unsigned PDF signed PDF and here is my code: @Test public void testMutiSign() { iTextSignerUtil1.SignMultPDF(getBytes(unsignedPath), destPath1); iTextSignerUtil2.SignMultPDF(getBytes(destPath1), destPath2); } IExternalSignatureContainer externalP7DetachSignatureContainer = new IExternalSignatureContainer(

How to set PDF page size A4 when we use ITextRenderer to generate PDF from thymeleaf HTML template?

扶醉桌前 提交于 2019-12-11 14:02:51
问题 How to set PDF page size A4 when we use ITextRenderer to generate PDF from thymeleaf HTML template ? I have generated PDF but page size is not proper, how to set page size A4 ITextRenderer library in JAVA ClassLoaderTemplateResolver templateResolver = new ClassLoaderTemplateResolver(); templateResolver.setSuffix(".html"); templateResolver.setTemplateMode("HTML5"); TemplateEngine templateEngine = new TemplateEngine(); templateEngine.setTemplateResolver(templateResolver); Context context = new

Itext7 HTML to PDF conversion using Html2pdf when HTML is passed as input string and CSS as file

情到浓时终转凉″ 提交于 2019-12-11 08:19:49
问题 I have already implemented the HTML to PDF conversion via Itext 5 XMLWorker. Please find the code below: using (var ms = new MemoryStream()) using (var document = new Document()) { using (var writer = PdfWriter.GetInstance(document, ms)) { document.Open(); document.SetMargins(30, 60, 60, 60); using (var strReader = new StringReader(htmlToExport)) { //Set factories var htmlContext = new HtmlPipelineContext(null); htmlContext.SetTagFactory(Tags.GetHtmlTagProcessorFactory()); //Set css var