I need to create some simple but PDF/A-1b conform PDF-Files using iText.
My first approach looks like this:
Document document = new Document(Pagesize.A4);
ByteArrayOutputStream pdfBuffer = new ByteArrayOutputStream);
PdfAWriter pdfAWriter
= PdfAWriter.geInstance (document, pdfBuffer, PdfAConformanceLevel.PDFA_1B);
pdfAWriter.createXmpMetadata();
Font fixedFont = FontFactory.getFont("Courier New", BaseFont.CP1252, BaseFont.EMBEDDED, 10, Font.NORMAL);
document.open();
Chunk chunk = new Chunk("Hello World", fixedFont);
Paragraph paragraph = new Paragraph(chunk);
document.add(paragraph);
document.close();
// this is pseudo code to transfer the Buffer to a real file
writeByteArrayToFile(pdfBuffer.toByteArray());
Thos Code generates an Error Message:
All the fonts must be embedded. This one isn't: Helvetica
Looking around I found out that Helvetica is the default Document Font of iTextn which cannot be changed, that this is a Base PDF Font which is not embedded by default and that I can only embed it if I have a Helvetica pfb or ttf File (which I do not have and do not want to buy since I am not planning to use that font at all in my documents).
There is no need for any Helvetica Text in my PDF at all. I need to generate PDF/A-1b which requires to embed all fonts including the PDF Base Fonts.
So is this a Bug? What is the correct Way to generate a PDF/A with iText if there is no Helvetica Font file available?