contentStream.setFont(PDType1Font.COURIER, 15);
After that i added the . it shoud come up with many options of fonts, i also imported the library for the function setFont();
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.PDPage;
import org.apache.pdfbox.pdmodel.PDPageContentStream;
import org.apache.pdfbox.pdmodel.font.PDType1Font;
I tried to delete and add the library again, but it didnt work
You are using PDFBox 2.x code with PDFBox 3.x in a context where these versions differ, see the PDFBox 3.0 Migration Guide:
Static instances for Standard 14 fonts removed
The static instances of
PDType1Font
for the standard 14 fonts were removed as the underlyingCOSDictionary
isn't supposed to be immutable which led to several issues.A new constructor for
PDType1Font
was introduced to create a standard 14 font. The new EnumStandard14Fonts.FontName
is the one and only parameter and defines the name of the standard 14 font for which the instance ofPDType1Font
is created for. That instance isn't a singleton anymore and has to be recreated if necessary or cached by the user if suitable.