[
https://issues.apache.org/jira/browse/PDFBOX-3387?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
João da Nóbrega updated PDFBOX-3387:
------------------------------------
Attachment: pdfTemplate.saved.pdfbox.2.0.2.pdf
pdfTemplate.saved.pdfbox.1.8.12.pdf
pdfTemplate.printed.pdfbox.2.0.2.pdf
pdfTemplate.printed.pdfbox.1.8.12.pdf
I don't get it. I must be doing something differently. Attached are the
resulting documents after replacing the field with TEST VALUE. The "saved"
document has the value, the printed document does not.
I'm printing to "Microsoft Print to PDF" printer, but printing to any device
wilds the same result.
I used the following code and pdfbox 2.0.2. The same code prints the fields
with pdfbox 1.8.12.
{code:Java}
public static void test() throws Exception
{
try (PDDocument document = PDDocument.load(new
File("C:\\temp\\pdfTemplate.pdf"))) {
PDDocumentCatalog docCatalog = document.getDocumentCatalog();
PDAcroForm acroForm = docCatalog.getAcroForm();
java.util.List<PDField> allFields = acroForm.getFields();
for (PDField oneField : allFields) {
List<PDAnnotationWidget> widgets = oneField.getWidgets();
for (PDAnnotationWidget widget : widgets) {
widget.setPrinted(true);
}
oneField.setValue("TEST VALUE");
}
document.save("C:\\temp\\pdfTemplate.saved.pdf");
PrinterJob job = PrinterJob.getPrinterJob();
// pdfbox 1.8
//document.silentPrint(job);
// pdfbox 2.0
job.setPageable(new
org.apache.pdfbox.printing.PDFPageable(document));
job.print();
}
}
{code}
> AcroFrom fields (values) invisible when printing
> ------------------------------------------------
>
> Key: PDFBOX-3387
> URL: https://issues.apache.org/jira/browse/PDFBOX-3387
> Project: PDFBox
> Issue Type: Improvement
> Components: AcroForm
> Affects Versions: 2.0.2
> Reporter: kazu
> Assignee: Maruan Sahyoun
> Fix For: 2.0.3, 2.1.0
>
> Attachments: pdfTemplate-pdfbox.pdf, pdfTemplate.pdf,
> pdfTemplate.printed.pdfbox.1.8.12.pdf, pdfTemplate.printed.pdfbox.2.0.2.pdf,
> pdfTemplate.saved.pdfbox.1.8.12.pdf, pdfTemplate.saved.pdfbox.2.0.2.pdf,
> pdfTemplate_2.odt
>
>
> AcrobatReader/FoxitReader/... won't print values of e.g. AcroForm TextFields
> within a PDF created with PDFBox. Neither the print-preview shows the values
> within the fields, nor does the printed result.
> Minimal example to reproduce:
> the one provided within the repository:
> https://svn.apache.org/viewvc/pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/interactive/form/CreateSimpleForm.java
> Also had this issue with 1.8.x versions but maybe my code just wasn't
> correct..
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]