Hi, > Am 12.01.2017 um 08:10 schrieb Bharat Bhatt <[email protected]>: > > Hi, > > I want to change the appearance of drop down list (PDListBox). How to use > different font, font size and color of text? > I tried using following code > String defaultAppearanceString = "/Helv 12 Tf 0 0 0 rg"; > PDListBox.setDefaultAppearance(defaultAppearanceString);
that's the correct way of doing it. In addition if you'd like to style border, background color etc. you can set the PDAppearanceCharacteristicsDictionary http://pdfbox.apache.org/docs/2.0.3/javadocs/org/apache/pdfbox/pdmodel/interactive/annotation/PDAppearanceCharacteristicsDictionary.html. Please note that this setting applies to the PDAnnotationWidget. If you load a font and set the resource with that font using PDResources.add(PDFont font) it will return the COSName for that resource which you can use for your defaultAppearanceString. http://pdfbox.apache.org/docs/2.0.3/javadocs/org/apache/pdfbox/pdmodel/PDResources.html#add(org.apache.pdfbox.pdmodel.font.PDFont) You could also use PDResources.put and choose a name yourself. http://pdfbox.apache.org/docs/2.0.3/javadocs/org/apache/pdfbox/pdmodel/PDResources.html#put(org.apache.pdfbox.cos.COSName,%20org.apache.pdfbox.pdmodel.font.PDFont) BR Maruan > > Please let me know what will be better approach? > How to get the font name like "Helv" for different font > from PDType1Font.HELVETICA > > Thanks, > Bharat --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

