Can you help me to create a pdf/A-3 with an embedded xml file with itextsharp . I am trying to create but got error "All the fonts must be embedded. This one isn't: Helvetica"
The sample code I have provided here
using iTextSharp.text.pdf;
using iTextSharp.text;
private void createPdfA()
{
Document document = new Document();
PdfAWriter writer = PdfAWriter.GetInstance(document,
new FileStream("./xmp_metadata.pdf",FileMode.Create),
PdfAConformanceLevel.PDF_A_3B);
writer.CreateXmpMetadata();
document.Open();
ICC_Profile icc = ICC_Profile
.GetInstance(
"./sRGB Color Space Profile.icm");
writer.SetOutputIntents("Custom", "", "http://www.color.org",
"sRGB IEC61966-2.1", icc);
var fonts=FontFactory.GetFont(
"./FreeSansBold.ttf",
BaseFont.WINANSI, BaseFont.EMBEDDED, 10);
Font normal9 = FontFactory.GetFont(
"./FreeSans.ttf",
BaseFont.WINANSI, BaseFont.EMBEDDED, 9);
Font bold9 = FontFactory.GetFont(
"./FreeSansBold.ttf",
BaseFont.WINANSI, BaseFont.EMBEDDED, 9);
Font normal8 = FontFactory.GetFont(
"./FreeSans.ttf",
BaseFont.WINANSI, BaseFont.EMBEDDED, 8);
PdfDictionary parameters = new PdfDictionary();
parameters.Put(PdfName.MODDATE, new PdfDate());
PdfFileSpecification fileSpec = PdfFileSpecification.FileEmbedded(
writer, "./invoice.xml",
"invoice.xml", null, "application/xml", parameters, 0);
fileSpec.Put(new PdfName("AFRelationship"), new PdfName("Data"));
writer.AddFileAttachment("invoice.xml", fileSpec);
PdfArray array = new PdfArray();
array.Add(fileSpec.Reference);
writer.ExtraCatalog.Put(new PdfName("AF"), array);
document.Add(new Paragraph("Invoice number: " + 1));
document.Add(new Paragraph("Dear " +"NAMEInvoice"));
document.Add(new Paragraph(
"Thank you "
));
document.Add(new Paragraph("\n"));
document.Close();
writer.Close();
}