use of com.itextpdf.io.font.FontProgram in project Rolls-Royce by EntryDSM.
the class ConverterPropertiesCreator method createConverterProperties.
public ConverterProperties createConverterProperties() {
ConverterProperties properties = new ConverterProperties();
FontProvider fontProvider = new DefaultFontProvider(false, false, false);
fonts.forEach(font -> {
try {
FontProgram fontProgram = FontProgramFactory.createFont(fontPath + font);
fontProvider.addFont(fontProgram);
} catch (IOException e) {
e.printStackTrace();
}
});
properties.setFontProvider(fontProvider);
return properties;
}
use of com.itextpdf.io.font.FontProgram in project i7js-highlevel by itext.
the class C01E02_Text_Paragraph_Cardo2 method main.
public static void main(String[] args) throws IOException {
File file = new File(DEST);
file.getParentFile().mkdirs();
C01E02_Text_Paragraph_Cardo2 app = new C01E02_Text_Paragraph_Cardo2();
FontProgram fontProgram = FontProgramFactory.createFont(REGULAR);
FontProgram boldProgram = FontProgramFactory.createFont(BOLD);
FontProgram italicProgram = FontProgramFactory.createFont(ITALIC);
for (int i = 0; i < 3; ) {
app.font = PdfFontFactory.createFont(fontProgram, PdfEncodings.WINANSI, EmbeddingStrategy.PREFER_EMBEDDED);
app.bold = PdfFontFactory.createFont(boldProgram, PdfEncodings.WINANSI, EmbeddingStrategy.PREFER_EMBEDDED);
app.italic = PdfFontFactory.createFont(italicProgram, PdfEncodings.WINANSI, EmbeddingStrategy.PREFER_EMBEDDED);
app.createPdf(String.format(DEST, ++i));
}
}
use of com.itextpdf.io.font.FontProgram in project i7js-highlevel by itext.
the class C01E02_Text_Paragraph_Cardo method createPdf.
public void createPdf(String dest) throws IOException {
// Initialize PDF document
PdfDocument pdf = new PdfDocument(new PdfWriter(dest));
// Initialize document
Document document = new Document(pdf);
// Add content
FontProgram fontProgram = FontProgramFactory.createFont(REGULAR);
PdfFont font = PdfFontFactory.createFont(fontProgram, PdfEncodings.WINANSI, EmbeddingStrategy.PREFER_EMBEDDED);
PdfFont bold = PdfFontFactory.createFont(BOLD, PdfEncodings.WINANSI, EmbeddingStrategy.PREFER_EMBEDDED);
PdfFont italic = PdfFontFactory.createFont(ITALIC, PdfEncodings.WINANSI, EmbeddingStrategy.PREFER_EMBEDDED);
Text title = new Text("The Strange Case of Dr. Jekyll and Mr. Hyde").setFont(bold);
Text author = new Text("Robert Louis Stevenson").setFont(font);
Paragraph p = new Paragraph().setFont(italic).add(title).add(" by ").add(author);
document.add(p);
// Close document
document.close();
}
Aggregations