REQUIREMENT
You are managing DITA content in AEM, and you want to publish that content to (say) PDF output. But you have metadata for your publication(ditamap) managed as AEM metadata - and you want to pass this metadata to the publishing engine to use it in the output.
Let us understand this with an example. You have some AEM metadata, say "docstate" or "publisher" or "description" in AEM metadata schema, and you want to show this metadata on front page of the PDF output. Where we are:
1. Managing the publication/ditamap metadata in AEM assets
2. And the publication is published to PDF output using DITA-OT (pdf2 plugin)
IMPLEMENTATION
Part 1: Setup metadata in AEM
Add custom metadata fields in AEM as desired (for this example 'docstate', 'description' were available out of the box, we added the 'publisher' field in this case using AEM Metadata Schema)
NOTE: Make sure to point the path for this metadata field to "./jcr:content/metadata/published"
Part 2: Enable metadata fields for DITA publishing
To enable these metadata fields for the users to pick one of these metadata properties (see Part 3 for screenshot) while they are publishing the content to various output formats, the metadata fields needs to be enabled in a configuration. To do so, overlay a file "/libs/fmdita/config/metadataList" in AEM, i.e. create a copy of this file under "/apps/fmdita/config/metadataList". This file lists all the metadata properties that users can use to pass as parameters to DITA-OT plugins.
Add 'publisher' to this list, refer screenshot below:
Part 3: Choose the metadata to pass to DITA-OT
Assuming you have already defined the values in the properties of a ditamap,
In screenshot below, we chose PDF preset, and we intend to add 'publisher' property to the list
Part 4: Enable the DITA-OT plugin to read the metadata and use it
This is the part where you can play with presentation and logic on how you want to use the properties that are passed by AEM.
Once your configurations and content is setup in AEM, you also need to make changes in DITA-OT plugin so that the properties that are passed by AEM can be read and used in the plugin.
The steps for doing so (assuming you have DITA-OT on your file system and you have a "pdf2" plugin in the plugins directory of that)
<?xml version='1.0' encoding='UTF-8'?>
<dummy>
<param name="docstate" expression="${docstate}"/>
<param name="dc_description" expression="${dc:description}"/>
<param name="publisher" expression="${publisher}"/>
</dummy>
<feature extension="dita.conductor.pdf2.param" file="insertParameters.xml"/>
<xsl:param name="docstate"/>
<xsl:param name="dc_description"/>
<xsl:param name="publisher"/>
<xsl:template name="createFrontCoverContents">
<!-- set the title -->
<fo:block xsl:use-attribute-sets="__frontmatter__title">
<xsl:choose><xsl:when test="$map/*[contains(@class,' topic/title ')][1]">
<xsl:apply-templates select="$map/*[contains(@class,' topic/title ')][1]"/>
</xsl:when></xsl:choose>
</fo:block>
<fo:block xsl:use-attribute-sets="metadata" font-weight="" color="blue">
<xsl:choose><xsl:when test="$publisher">
Content Publisher : <xsl:value-of select="$publisher"/>
</xsl:when></xsl:choose>
</fo:block>
<fo:block xsl:use-attribute-sets="metadata" font-weight="" color="blue">
<xsl:choose><xsl:when test="$docstate">
Current Document State : <xsl:value-of select="$docstate"/>
</xsl:when></xsl:choose>
</fo:block>
<fo:block xsl:use-attribute-sets="metadata" font-weight="" color="blue">
<xsl:choose><xsl:when test="$dc_description">
Short description : <xsl:value-of select="$dc_description"/>
</xsl:when></xsl:choose>
</fo:block>
</xsl:template>
Try this out
Through the ditamap dashboard, when you publish the map to PDF output:
You will get the desired metadata printed on front page of PDF output:
How do we use the metadata it in Native PDF publishing? Provide example with a code syntax.
This links https://experienceleague.adobe.com/docs/experience-manager-guides-learn/tutorials/configuring/config... talks about how to create metadata but not how to use them in the .plt file (code syntax to use that metadata)
This article/post is for passing metadata in DITA-OT engine.
Passing metadata to native PDF publishing engine is still in development.
Hi @DivrajSingh ,
I followed the steps which are mentioned in this document. However, the metadata value is not getting displayed in the PDF. Do you have any sample package of the PDF customization, which reads the metadata property?
Thanks,
Swapna
@snakkina : The package would be DITA-OT version dependent - but the steps (files references and changes) should be the same.
Are you getting any error? an you share the DIAT-OT you have constructed with the steps above?
Hi @DivrajSingh ,
As the file type (.zip) is not supported in this chat communication I uploaded the package to https://drive.google.com/file/d/1IOisDVVWH6auA0U9MlKtcxfHX-k44XwC/view?usp=share_link and provided you access.
Kindly review the package.
Thanks,
Swapna
Hi Divraj,
Thanks for this thorough explanation. I want to use AEM metadata in the JSON output but cannot figure out which DITA-OT plugin does the job. As far as I can see from the AEM log, the JSON generation is based on the "dita2dita" transformation from the org.dita.normalize DITA-OT plugin. But how is the conversion to JSON achieved?
Best regards,
Frank
Views
Replies
Total Likes
Hi Frank,
You can achieve by writing the custom dita-ot plugin using XSLT transformation or Java based depending upon your comfort level.
Before this custom step, use the DITA Normalisation step in order to resolve all the references (keys, conkeyrefs etc.) first and then convert a ditamap to JSON
Regards,
Vijendra
Hi @DivrajSingh,
You describe how to make changes to the original PDF2 DITA-OT plugin. However, best coding practices are to never modify any of the core DITA-OT code, but to create a separate PDF plugin instead. I see two options:
Best regards,
Frank
Views
Replies
Total Likes
Hi DivrajSingh
By following the above step we are able to print only map metadata , is there is any way to print topic metadata while generating pdf output?
Views
Replies
Total Likes