Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Tue Feb 11, 2025 4:16 pm

Spire.PDF for java v. 11.1.2 (paid customer)

I have this:
Code: Select all
PdfFont font = new PdfFont(PdfFontFamily.Helvetica, 11, PdfFontStyle.Bold);


I need the font to be both Bold and Italic, how to achieve this?

I tried using the | operator, but it is not supported by the enum PdfFontStyle

Thanks

donspa72
 
Posts: 7
Joined: Wed Dec 11, 2024 1:30 pm

Wed Feb 12, 2025 2:42 am

Hi,

Thanks for your inquiry.
Please use the code below to define the font with both Bold and Italic style.
Code: Select all
PdfFont font=new PdfFont(PdfFontFamily.Helvetica,11,EnumSet.of(PdfFontStyle.Bold,PdfFontStyle.Italic));

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1385
Joined: Tue Sep 27, 2016 1:06 am

Return to Spire.PDF