itext

Search and replace text in PDF using JAVA

房东的猫 提交于 2020-01-14 06:45:51
问题 Need to replace the text in the pdf with different language. In the first step, I was trying to search and replace a text in the pdf file using itextpdf ad pdfbox API. Use the below code snippet which uses itextpdf api to search and replace the text "Hello" to "Hi" from the source PDF file. The new PDF is created without any text replacements. public void manipulatePdf(String src, String dest) throws Exception { PdfDocument pdfDoc = new PdfDocument(new PdfReader(SRC), new PdfWriter(DEST));

iText signing PDF using external signature with PKI SIM

蹲街弑〆低调 提交于 2020-01-14 06:18:04
问题 I am trying to use mobile signature service provider (MSSP) to sign the pdf file. I used some code below to do. But the signature is invalid with the message "The document has been altered or corrupted since the signatures was applied." Encode in "APWebService.sign(phoneNumber, messageDisplay, encode)" only accept 44 charracter. Anyone can help me? public class MyExternalSignatureContainer implements ExternalSignatureContainer { protected byte[] sig; protected Certificate[] chain; public

how to set background color and table border in pdf file using html in c#

邮差的信 提交于 2020-01-14 05:54:09
问题 i have created pdf file genration using html template. but after generating pdf background color on h4 tag and and color also not set please suggest me i have try to inline css on set background color and table proper border color in html but after generating pdf this css not apply it Controller:- public void abcd() { try { string abc = Request.QueryString["abc"]; string strFileName = abc; string strFileExtension = ".pdf"; string strContentType = FileManager.FileContentType_application

itext 7.1 how to check if image is rotated

倖福魔咒の 提交于 2020-01-14 05:50:09
问题 in itext 7.1, I am adding an image to a pdf document with following code : Document document = new Document(writerPdf); //make a new document object ImageData imgData = ImageDataFactory.create(imageBytes); Image image = new Image(imgData); document.add(image); This works fine for most images but I have come across an image that seems normal on desktop but when adding to pdf it is rotated by -90 . imgData.getRotation() gives 0 as output My question is : how to check if image has any rotation

Pdf Signature Validity Check Mark Not Visible on Acrobat Reader

依然范特西╮ 提交于 2020-01-14 05:43:09
问题 I am signing a pdf file with iText. When I view the file on Acrobat Reader 9, the green tick does not appear inside the signature rectangle as it used to do in Acrobat Reader 7. Note that I can see the validity mark on top of the page, but I specifically want the mark to appear in the signature rectangle. Some say that this feature is no longer supported by Acrobat by version 9, however I have viewed some digitally signed files with the green check mark on version 9. So, is there a specific

(Unknown Sender) when sending email with pdf attachment created in iText from java application

梦想的初衷 提交于 2020-01-14 03:49:06
问题 I have a link on a webpage that sends emails out from localhost SMTP with pdf attachments created from iText that I made following How to create an in-memory PDF report and send as an email attachment using iText and Java and it is working, however when I get the emails I can't see the sender name/address. It shows as being from "(unknown sender)" in my gmail inbox and if I hit reply the 'to' box is completely blank. In hotmail is shows as being from "(Unknown)" but when i open it, the sender

Generating PDF with iText and batik

倖福魔咒の 提交于 2020-01-14 02:30:14
问题 I'm trying to export text and SVG graphs to a PDF. I found out that iText and batik can do this. So I tried doing that, but everytime I put in a graph, it would become extraordinary small. I thought it might be something with my code, so I figured I would try an examplecode from Vaadin. public class PdfExportDemo { private String fontDirectory = null; private final String baseFont = "Arial"; private PdfWriter writer; private Document document; private Font captionFont; private Font normalFont

iTextSharp embed subset fonts in existing PDF

£可爱£侵袭症+ 提交于 2020-01-13 17:04:10
问题 We use an old reporting software to create PDFs, but it is unable to embed the used fonts in the file. Now I am trying to use iTextSharp to embed all (non-embedded) fonts in an existing PDF based on these examples EmbedFontPostFacto, ListUsedFonts and other information from other similar questions. Like in the first example I create a fontfile for each font and then add it to the font object (PdfDictionary) or rather to the font descriptor. // the font file byte[] fontfile = null; using

iText avoid to cut tables on page jump

别说谁变了你拦得住时间么 提交于 2020-01-13 11:38:12
问题 I'm working with a pdf which display many tables. When a table doesn't fit on the rest of the page, iText cut the table and set the rest of them on the next page. I want that if a table doesn't fit on the rest of the page, then place it on a new page. How can I do that? 回答1: There are different ways to do this; these are three options: Calculate the height of the table, compare it to the space that is left. When you calculate the height of a table before it's added to the document, the height

Determine whether a PDF page contains text or is purely picture

狂风中的少年 提交于 2020-01-13 08:39:07
问题 How to determine whether a PDF page contains text or is purely picture, using Java? I searched through many forums and websites, but I can not find an answer yet . Is it possible to extract text from PDF, to know if the page is in the format picture or text? PdfReader reader = new PdfReader(INPUTFILE); PrintWriter out = new PrintWriter(new FileOutputStream(OUTPUTFILE)); for (int i = 1; i <= reader.getNumberOfPages(); i++) { // here I want to test the structure of the page !!!! if it's