Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PdfBox Alpha 3.0.0-alpha3 , PDType1Font constructor issue

Tags:

java

pdfbox

hung

Good afternoon,

I recently try to upgrade pdfBox to 3.0.0-alpha3. I align the using of class PDType1font with new constructor requirements:

PDType1Font(Standard14Fonts.FontName baseFont)

My code now is:

FontName font_name_3v= Standard14Fonts.getMappedFontName("HELVETICA_BOLD");
PDFont pdfFont=  new PDType1Font(font_name_3v);

But it hung infinite on line : PDFont pdfFont= new PDType1Font(font_name_3v);

I follow the documentation:

  • https://javadoc.io/static/org.apache.pdfbox/pdfbox/3.0.0-alpha3/org/apache/pdfbox/pdmodel/font/PDType1Font.html#PDType1Font-org.apache.pdfbox.pdmodel.font.Standard14Fonts.FontName-
  • https://javadoc.io/doc/org.apache.pdfbox/pdfbox/3.0.0-alpha3/index.html

Thank you

like image 886
Th3Gh0st Avatar asked Sep 11 '25 07:09

Th3Gh0st


1 Answers

Solution:

I was missing to specify font family, working code:

PDFont pdfFont=  new PDType1Font(font_name_3v.HELVETICA_BOLD);
like image 191
Th3Gh0st Avatar answered Sep 13 '25 20:09

Th3Gh0st