Note that there are some explanatory texts on larger screens.

plurals
  1. POPDFbox, exception on fonts
    primarykey
    data
    text
    <p>I've write a simple code for edit content of a form inside a pdf. Everithing works fine (new pdf is created with modified form) but a strange excetpion about fonts were thrown. This is my code:</p> <pre><code>try { PDDocument pdfDoc = PDDocument.load("/home/giozh/universita/schedepazienti.pdf"); PDDocumentCatalog docCatalog = pdfDoc.getDocumentCatalog(); PDAcroForm acroForm = docCatalog.getAcroForm(); PDField field = acroForm.getField("dx1"); if (field != null) { field.setValue("asd"); } else { System.err.println("No field found with name:" + "applicationPrepaid[0].#pageSet[0].Pagina1[0].txtFirstName[0]"); } pdfDoc.save("/home/giozh/universita/schedepazienti1.pdf"); pdfDoc.close(); } catch (IOException ex) { Logger.getLogger(Prove.class.getName()).log(Level.SEVERE, null, ex); } catch (COSVisitorException ex) { Logger.getLogger(Prove.class.getName()).log(Level.SEVERE, null, ex); } </code></pre> <p>and this is exception:</p> <pre><code>Grave: error while creating a font java.io.IOException: Cannot create font as /SubType is not set. at org.apache.pdfbox.pdmodel.font.PDFontFactory.createFont(PDFontFactory.java:88) at org.apache.pdfbox.pdmodel.PDResources.getFonts(PDResources.java:203) at org.apache.pdfbox.pdmodel.interactive.form.PDAppearance.getFontAndUpdateResources(PDAppearance.java:439) at org.apache.pdfbox.pdmodel.interactive.form.PDAppearance.setAppearanceValue(PDAppearance.java:268) at org.apache.pdfbox.pdmodel.interactive.form.PDVariableText.setValue(PDVariableText.java:131) at prove.Prove.main(Prove.java:37) </code></pre> <p>(line 37 is where i call setValue() method) how can i fix it?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload