Expand my Community achievements bar.

SOLVED

AEM Forms 6.2 JEE - Embedding Fonts

Avatar

Level 7

Hi,

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?

Thanks,

Jim

1 Accepted Solution

Avatar

Correct answer by
Level 7

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)

View solution in original post

13 Replies

Avatar

Employee Advisor

Hi James,

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[0].

<fontInfo>
       <embed>1</embed>
       ...
</fontinfo>

sample snippet from the XCI file :

<PDFDynamic>1</PDFDynamic> -->

<xdc>

<uri>adobepdf.xdc</uri>

</xdc>

<version>1.7</version> <!-- 1.2=acrobat 3|1.3=acrobat 4 -->

                <adobeExtensionLevel>11</adobeExtensionLevel>

                <linearized>0</linearized>

                <fontInfo>

                   <embed>1</embed> <!-- 0|1 -->

                   <map>

                      <!-- [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"/>


Thanks,
Mayank Gandhi

[0] Adobe LiveCycle ES4 * generatePDFOutput operation

Avatar

Level 7

If you are using the Output service then you will need to add the font to the Home > Services > Output configuration as well

Avatar

Level 7

Hi,

My output was set to PDF as opposed to PDF/A. Once I changed this with the font files in the aem_jee/fonts dir it worked.

Thanks,

James

H

Avatar

Level 7

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.

Avatar

Level 7

Also remembered that any changes to Always embed fonts and adding new fonts to the Output service requires a JEE restart. The embed information and fonts are all loaded at server boot time

Avatar

Level 7

DarrenBiz

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?

Avatar

Employee Advisor

Hi James,

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.

Thanks,

Mayank Gandhi

Avatar

Level 7

Mayank Gandhi

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?

Thanks,

Jim

A

Avatar

Level 7

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.

Avatar

Level 7

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);

pdfOptions.serXci(xci);

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?

Avatar

Correct answer by
Level 7

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)

Avatar

Level 7

DarrenBiz

Adding my font folder to CQ-DAM-Handler-Gibson Font Manager Service (mentioned on the install guide you linked to) looks to have resolved my issue - thanks!