pdfbox

Form field values set with PDFBOX not visible in Adobe Reader

房东的猫 提交于 2021-02-06 08:56:50
问题 I am having an issue with trying to set some from fields using Apache PDFBOX(1.8.5). I have a few different Static PDFs that I am using for testing. Using the following code, I can set the values of form fields, and save the resulting PDF. I can then open this PDF in Adobe Reader and see the results: PDDocumentCatalog docCatalog = pdfDocument.getDocumentCatalog(); pdfTemplate.setAllSecurityToBeRemoved(true); PDAcroForm acroForm = docCatalog.getAcroForm(); List fields = acroForm.getFields();

How to generate a downloadable PDF with pdfbox (Corrupted PDF)?

ぐ巨炮叔叔 提交于 2021-02-05 17:00:24
问题 How do I make a PDF file downloadable in a link? I'm building a web application using JSF, when the user clicks in a "Save as PDF" link a PDF should be available to be downloaded. So far I've a working code that generates the PDF file, but the file is saved on my desktop and what I want to do is that when the user clicks on the link the pdf file should be downloadable instead of being stored in the app. UPDATE 3: Thank you for your help guys, I modifed my code with your suggestions and it's

How to generate a downloadable PDF with pdfbox (Corrupted PDF)?

余生颓废 提交于 2021-02-05 16:52:49
问题 How do I make a PDF file downloadable in a link? I'm building a web application using JSF, when the user clicks in a "Save as PDF" link a PDF should be available to be downloaded. So far I've a working code that generates the PDF file, but the file is saved on my desktop and what I want to do is that when the user clicks on the link the pdf file should be downloadable instead of being stored in the app. UPDATE 3: Thank you for your help guys, I modifed my code with your suggestions and it's

How to generate a downloadable PDF with pdfbox (Corrupted PDF)?

梦想的初衷 提交于 2021-02-05 16:50:32
问题 How do I make a PDF file downloadable in a link? I'm building a web application using JSF, when the user clicks in a "Save as PDF" link a PDF should be available to be downloaded. So far I've a working code that generates the PDF file, but the file is saved on my desktop and what I want to do is that when the user clicks on the link the pdf file should be downloadable instead of being stored in the app. UPDATE 3: Thank you for your help guys, I modifed my code with your suggestions and it's

PDFBox returns missing descendant font dictionary

天大地大妈咪最大 提交于 2021-01-29 14:37:36
问题 when extracting the first page of a PDF I get java.io.IOException: Missing descendant font dictionary . The extraction code is the following: PDDocument pdDocument = PDDocument.load(file); PageExtractor pageExtractor = new PageExtractor(pdDocument, 1, 1); PDDocument singlePageDocument = pageExtractor.extract(); It only happens with few PDFs and the error points to the Fonts definitions, but I am unclear on how fonts in PDF are processed by Apache PDFBox (using version v2.0.18). Any tip?

PDFBOX acroForm filled but when opened in Acrobat reader values disappears

时光怂恿深爱的人放手 提交于 2021-01-29 12:37:50
问题 I have PDF form, I am trying to fill it with PDFBOX. It works, form is filled and I open with other reader or browser, I can see values, however When I tries to open in Adobe Reader values disappears, I tried every possible way to find out why But values, are not visible. I have template form, that I use and fill data, rename fields, and merge it into other document, and redo that process until all forms are filled up. I am not sure if this related to my code or Adobe reader. Link to PDF form

pdfbox 2.0.2 > Calling of PageDrawer.processPage method caught exceptions

北慕城南 提交于 2021-01-29 12:31:02
问题 As a newbie of pdfbox 2.0.2 (https://github.com/apache/pdfbox/tree/2.0.2) user, I would like to get all the stroked lines (for instance, column and row borders of a table) of a page (PDPage), and thus I created the following class: package org.apache.pdfbox.rendering; import java.awt.geom.GeneralPath; import java.io.IOException; import java.net.MalformedURLException; import java.net.URI; import org.apache.commons.io.IOUtils; import org.apache.pdfbox.pdmodel.PDDocument; import org.apache

Get page index of pdf page containing digital signature [closed]

送分小仙女□ 提交于 2021-01-29 11:00:34
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 2 years ago . Improve this question I have the requirement to get the page index of the page containing a digital signature in a pdf document. How can I get it using Apache PDFBox? 回答1: try (PDDocument doc = PDDocument.load(new File("...."))) { PDPageTree pageTree = doc.getPages(); PDAcroForm

Error when extracting text from pdf using pdfbox

匆匆过客 提交于 2021-01-29 02:52:52
问题 sample pdf Sample pdf is a chinese resume, 3 pages, using standard code below PDDocument document = PDDocument.load(new File(path)); PDFTextStripper stripper = new PDFTextStripper(); text = stripper.getText(document); Extraction result is like below image, only some words 回答1: If you run the text extraction code and enable logging, you'll see numerous warnings: Feb 12, 2019 5:45:58 PM org.apache.pdfbox.pdmodel.font.PDType0Font toUnicode WARN: No Unicode mapping for CID+5482 (5482) in font

Error when extracting text from pdf using pdfbox

百般思念 提交于 2021-01-29 02:50:38
问题 sample pdf Sample pdf is a chinese resume, 3 pages, using standard code below PDDocument document = PDDocument.load(new File(path)); PDFTextStripper stripper = new PDFTextStripper(); text = stripper.getText(document); Extraction result is like below image, only some words 回答1: If you run the text extraction code and enable logging, you'll see numerous warnings: Feb 12, 2019 5:45:58 PM org.apache.pdfbox.pdmodel.font.PDType0Font toUnicode WARN: No Unicode mapping for CID+5482 (5482) in font