Hi, > Am 26.04.2017 um 08:19 schrieb Mickael Marrache <[email protected]>: > > Hi, > > I'm trying to fill a PDF form using PDFBox 2.0.5 as follows: > > PDDocument pdfDocument = > PDDocument.load(this.getClass().getClassLoader().getResourceAsStream("form.pdf")); > PDAcroForm acroForm = pdfDocument.getDocumentCatalog().getAcroForm(); > > PDResources formResources = acroForm.getDefaultResources(); > PDTrueTypeFont font = (PDTrueTypeFont) > formResources.getFont(COSName.getPDFName("David,Bold")); > > TrueTypeFont ttFont = font.getTrueTypeFont(); > > PDFont font2 = PDType0Font.load(pdfDocument, ttFont, true); > ttFont.close(); > > formResources.put(COSName.getPDFName("F0"), font2); > > if (acroForm != null) { > PDTextField field = (PDTextField) acroForm.getField("full_name"); > field.setDefaultAppearance("/F0 10 Tf 0 g"); > field.setValue(/* hebrew text here*/); > } > > File targetFile = File.createTempFile("", ".pdf"); > pdfDocument.save(targetFile); > pdfDocument.close(); > > The reason I embed the David,Bold font is explained here > http://stackoverflow.com/questions/42903217/write-cyrillic-chars-into-pdf-form-fields-with-pdfbox
could you upload a PDF before and after filling to a public location? BR Maruan > . > > The issue is that the resulting PDF file has the text in the full_name > textbox displayed in the reverse direction. However, if I click on the > textbox, the text appears correctly. I precise that the text filled in the > textbox is in Hebrew (right-to-left). > > Any idea? > > Thanks, > Mickael --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

