itext7

Itextsharp 7 - Scaled and Centered Image as watermark

隐身守侯 提交于 2019-12-07 08:34:27
I started using itextsharp 7 a few days ago, i used to work with itextsharp 5 for years . I don't manage to add a scaled image at the center of the page as watermark with itext7. My code with itextsharp 5 : using (PdfStamper pdfStamper = new PdfStamper(pdfReader, memoryStream)) { for (int pageIndex = 1; pageIndex <= pdfReader.NumberOfPages; pageIndex++) { pdfStamper.FormFlattening = false; iTextSharp.text.Rectangle pageRectangle = pdfReader.GetPageSizeWithRotation(pageIndex); PdfContentByte pdfData = pdfStamper.GetOverContent(pageIndex); PdfGState graphicsState = new PdfGState(); graphicsState

How to get font size of form field on iText7?

穿精又带淫゛_ 提交于 2019-12-07 04:34:25
How can I get font size of a PDF form field on iText7? On iText5, I could do it as this: PdfReader reader = new PdfReader(SRC); PdfStamper stamper = new PdfStamper(reader, outputStream); AcroFields fields = stamper.getAcroFields(); AcroFields.Item item = fields.getFieldItem(FIELDNAME); PdfDictionary merged = item.getMerged(0); TextField textField = new TextField(null, null, null); fields.decodeGenericDictionary(merged, textField); float fontSize = textField.getFontSize(); I could not find how I can do this on iText7. How can I do this? I managed to did it. But I am not sure if this is a

iText7 C# Check PDF was locked after signature

依然范特西╮ 提交于 2019-12-06 15:28:45
问题 Hi i was trying too check if PDF file was locked after signature using iText7 .Net. Our current version was : 7.1.8 Currently i'm trying some piece off code but this doesn't respond to my research : try { //GET READER PdfReader reader = new PdfReader(pdfModeleFile); if (reader != null) { //GET DOCUMENT PdfDocument pdfDoc = new PdfDocument(reader); if (pdfDoc != null) { //GET FORM PdfAcroForm form = PdfAcroForm.GetAcroForm(pdfDoc, false); int signState = form.GetSignatureFlags(); if (signState

iText 7 - Merge PDF layers (OCG) with the base PDF

淺唱寂寞╮ 提交于 2019-12-06 14:51:49
问题 Is it possible to merge layers of a PDF (OCG) with the base PDF to result in a PDF without layers? I saw that it's possible to accomplish this using an application as Adobe Acrobat DC using a "Flatten Layers" option but I need this programmed in my Java application using iText7. EDIT: @joelgeraci has a useful and good answer that solves the previous question, but I have initially some hidden layers that will be displayed anyway when removing the OCProperties from the catalog. 回答1: You don't

Reader extensions not needed anymore for digital signature in Acrobat Reader DC?

走远了吗. 提交于 2019-12-06 13:47:53
问题 In a business environment we have Adobe LiveCycle ES for several years. A key feature is to enable "Reader extensions" in PDFs, which unlocks some features in Adobe Reader for reader extended PDFs. One of them was allowing user to digitally sign empty signature fields in Adobe Reader. I remember nothing happened when clicking on the signature field in Adobe Reader if the PDF was not "reader extended". This is the case e.g. if the PDF was generated using iText. This limitation is still

Signing using iText, Adobe Reader reports “Signature was created using Not available.”

点点圈 提交于 2019-12-06 12:12:21
I am successfully signing documents using iText. However, any time that I check the "Advanced Signature Properties" in Adobe Reader I see that the "Signature was created using Not available." My question is, how can I use iText update this piece of information to then display properly in Adobe Reader or any other PDF reader? EDIT #1: An answer suggested using the PdfSignatureAppearance class's setSignatureCreator(String signatureCreator) ( API and Source ). This was not successful in updating the Signature Details in Adobe Reader. The result is the same as the screenshot included above. Here

How to get the text position from the pdf page in iText 7

[亡魂溺海] 提交于 2019-12-06 09:53:35
问题 I am trying to find the text position in PDF page? What I have tried is to get the text in the PDF page by PDF Text Extractor using simple text extraction strategy. I am looping each word to check if my word exists. split the words using: var Words = pdftextextractor.Split(new char[] { ' ', '\n' }); What I wasn't able to do is to find the text position. The problem is I wasn't able to find the location of the text. All I need to find is the y co-ordinates of the word in the PDF file. 回答1:

iText7 508 Table Summary

拈花ヽ惹草 提交于 2019-12-06 08:32:56
We are creating a large table using iText 7 we are almost fully 508 complaint however we are missing the table summary rule. Is there a way to add the table summary at creation time using iText 7? I have attached a picture of what I am looking for. rossfrank It is possible to add AccessibilityProperties to the Table object itself. The Summary needs to be added through a PdfDictionary PdfDictionary attr = new PdfDictionary(); attr.put(new PdfName("Summary"), new PdfString("Info about the table")); table.getAccessibilityProperties().addAttributes(new PdfStructureAttributes(attr)); ApiDocs can be

iText 7: How to build a paragraph mixing different fonts?

旧巷老猫 提交于 2019-12-06 06:43:36
问题 I've been using iText 7 for a few days to build pdf files, unfortunately, iText 7 is very different from iText 5 and the documentation is still very incomplete. I'm trying to build a paragraph that mixes two fonts or two fonts style (example: have a bold text in the middle of a paragraph) Using iText 5 this would be done using Chunks: Font regular = new Font(FontFamily.HELVETICA, 12); Font bold = Font font = new Font(FontFamily.HELVETICA, 12, Font.BOLD); Phrase p = new Phrase("NAME: ", bold);

How does one prevent text from breaking across pages in a PDF created by itext7.pdfhtml?

自闭症网瘾萝莉.ら 提交于 2019-12-06 04:37:32
I am using itext7 version 7.1.2 and itext7.pdfhtml version 2.0.2 to produce a PDF from some HTML containing elements which must not break across pages (e.g. graphs and their accompanying text). I have tried using explicit page breaks (as was used successfully in our legacy iTextSharp solution (using page-break-before: always on any elements containing elements which should not be separated)) but these don't work at all so tried using the more preferable page-break-inside: avoid as a style on the element containing the elements which I did not want to break across multiple pages. Here is a