I have a PDF template that uses a custom font let's call it XYZ. Data is being added to this form via the PDF output service. When viewed on a machine that doesn't have XYZ installed, the font is not present. I would like to embed XYZ into the generated PDF document as I do not expect users to have the font installed as a prerequisite of viewing my documents! I think this maybe possible as I can see embed options on the server, but can't find detailed documentation online.
Below is what I have tried so far:
The font is installed on the windows machine the server is running on and is also available in the aem forms/font directory referenced within the settings of adminui.
I have also tried to "always embed" the fonts in a couple of places
Home > Services > PDF forms
Font Embedding Settings
Always Embed Fonts: XYZ
and I also tried adding a configuration under:
Home > Services >PDF Generator > Adobe PDF Settings
Always embed: XYZ
The always embed fonts setting is also check here, and I set this configuration to be the default.
I have restarted the server after making these changes.
Does anyone know the steps to embed a custom font?
Have you definitely got all of the font files you require on the Linux instance? Are they located in a font configuration folder that the JEE instance can access with the correct read perms?
Have you added in the addition RPMs, etc for Linux that are listed here: Installing and configuring AEM 6.1 forms (the link says 6.1 but its actually 6.2)
If all of the fonts contained are client's custom fonts, then PDF/a would achieve what you need. It will be heavier, but you are guaranteed for the PDF to look exactly how you (and the client) want.
Usually its a tradeoff of size vs presentation. If you are producing tens of thousands of pieces of correspondence a day and also archiving them in a document management system, then size might be a factor. Cost per GB is so low now, it doesnt ususally factor too much any more.
Try updating the xci file with embed flag set to 1 as shown below and pass this updated XCI in the XCI URI while you invoke the output service.
sample snippet from the XCI file :
<version>1.7</version> <!-- 1.2=acrobat 3|1.3=acrobat 4 -->
<embed>1</embed> <!-- 0|1 -->
<!-- [0..n] Attributes: from='', to='' [0..n] -->
<equate from='Courier_*_*' to='Courier New_*_*' force="0"/>
<equate from='CourierNew_*_*' to='Courier New_*_*' force="0"/>
<equate from='Courier-New_*_*' to='Courier New_*_*' force="0"/>
<equate from='MyriadPro_*_*' to='Myriad Pro_*_*' force="0"/>
<equate from='MyriadPro-Regular_*_*' to='Myriad Pro_*_*' force="0"/>
<equate from='MyriadPro-It_*_*' to='Myriad Pro_*_italic' force="0"/>
<equate from='MyriadPro-SemiboldSemiCn_*_*' to='Arial Narrow_bold_*' force="0"/>
<equate from='MyriadPro-SemiboldCond_*_*' to='Arial Narrow_bold_*' force="0"/>
<equate from='MinionPro_*_*' to='Minion Pro_*_*' force="0"/>
<equate from='MinionPro-Regular_*_*' to='Minion Pro_*_*' force="0"/>
I looked at this again today, although I was able to embed the fonts using PDFa files on a window server with workbench.
Now that I have tried the same thing in java on the linux server my client is using, I cannot embed fonts.
Instead of PDF/a I am trying Mayank Gandhi suggestion of using an xci file.
I am trying the following:
File xciFile = new File ("/jboss/standalone/svcdata/XMLFormService/default.xci");
Document xci = new Document (xciFile);
generatedDocument = outputService.generatePDFOutput(document,xmlData,pdfOptions);
I get an error, even with an un-modified default.xci:
AEM_OUT_001_003 PAExecute Failure: XFA_RENDER_FAILURE
Any ideas? Do you have a full example xci to use instead of the default.xci? Am I passing the xci file to the output service incorrectly?
Agreed, however the fonts I am dealing with here are the client's custom corporate fonts that I wouldn't expect an end user to have installed, so I have to embed them. That being the case, is using PDF/A effectively the same thing as a PDF where I have hand selected the custom fonts I wish to embed?
If you decide to embed the font into the pdf vis-à-vis a pdf that just refers to font while rendering, the two would have size difference with former being the heavy one.
My client would like the PDFs to look as designed, so currently my thinking is that always embedding the fonts (with PDFa) will be the same as me specifying them manually (if I get that working).
Am I missing something? Will a PDFa be larger in size than a PDF that explicitly states the fonts it embeds?
PDF/A will embed all fonts regardless of whether you want to or not because its an archive format. So your PDFs can end up very large. If it's just one type of font you want to embed then I would stick with PDF and make sure the name of the font is in the Always embed fonts and also available to the server in the fonts directory as you have specified.
I remember having issues with the font name causing the service to not embed the font. I had to use a special font info reader to get the real name of the font that the Output service expects. If I remember the exact details of how I did it, I will post it up. It was a lot of trial and error.