About Arbortext Styler > Document Preview and Publishing > Passing Metadata to PDF Output
  
Passing Metadata to PDF Output
Once defined in the .style stylesheet, metadata is generated when publishing to PDF format with that stylesheet. A single set of metadata will be generated for the whole PDF document, although the metadata can be defined for any context or condition in the stylesheet. The metadata will be displayed in the Document Properties dialog box for the PDF document. The standard metadata items Title, Author, Subject, and Keywords will be displayed in the Description tab of the dialog box, whilst all other items, including user defined metadata types, will be retained in the Custom tab.
The procedure defined below describes how to define metadata for a PDF document published from the transport.xml sample document, located at Arbortext-path/samples/styler.
Example: Creating metadata for a PDF document
1. In Arbortext Editor, click Styler > Edit Stylesheet to open the sample document's associated stylesheet for edit. This is a read only stylesheet so you will need to save a local copy in order to make changes.
2. Select the Print/PDF option in the Outputs to edit field.
3. In the Elements list, select the book everywhere context.
You can select any context or condition here - any metadata defined for the document will be output in the Document Properties dialog box of the final PDF document, regardless of the context or condition for which it is defined in the stylesheet.
4. Navigate to the Generated text category for the element, then click the Edit button next to the Before-text field. The Generated Text Editor opens.
5. In the Generated Text Editor, choose the Insert > Advanced > Metadata menu option to open the Insert Metadata dialog box. Check the Static option and select Author from the list of standard metadata types. Note that you can also type a name of your own in this field.
6. Click OK to exit the dialog box. Arbortext Styler inserts a Meta tag, with MetaName and MetaValue children. The MetaName field contains the name of the metadata type you selected in the previous step.
7. In the MetaValue field, type the value for the Author metadata type.
You can also elect to generate the value of the MetaValue field programmatically. For example, if your book contained keywords, you could create metadata whose value is made up of a list of their values. Enter the Keywords metadata type in the MetaName field, then use the Insert > Element Content menu option in the MetaName field to insert all occurrences of the keyword element from the book into the field. In this instance Arbortext Styler will extract the content of each keyword element and insert them in the MetaValue field wrapped in an _sfe:CollectionItem element, creating a comma separated list of keywords for the book.
8. Place your cursor after the Meta tag, and choose a second Insert > Advanced > Metadata action. This time, check the Dynamic option in the Insert Metadata dialog box and click OK. Arbortext Styler inserts a Meta tag again, this time with both MetaName and MetaValue tags blank.
9. In the MetaName tag, type the metadata type Booktitle. This is not a default or standard metadata type for PDF, but Arbortext Styler permits the inclusion of user-defined metadata types.
10. In the MetaValue tag, choose the Insert > Element Content menu option. In the Insert Element Content dialog box, configure the following settings:
Select the By name and occurrence-within-ancestor option
In the Name field, select the element title
In the Occurrence field, select 1st
In the Within field, select the element book
In the Insert field, select the Only content option
Here you have specified that the value of the Booktitle metadata type will be set to the title of the book element.
Click OK to exit the dialog box - Arbortext Styler enters an ElementContent tag into the MetaValue field.
11. Choose File > Apply and Close to exit the Generated Text Editor. The Before-text field now contains _gte:Meta, _gte:MetaName, and _gte: MetaValue tags defining the metadata settings you made.
12. If your stylesheet is set to publish print or PDF via FOSI, choose the Preview > Print menu option to generate a preview of your final document. This will ensure that Arbortext Styler updates the .genfos file associated with your stylesheet with the changes you have made, thus ensuring that the metadata settings are passed to the publishing engine. See Saving Stylesheets for information on saving a .genfos file.
13. In Arbortext Editor, choose File > Publish > PDF File. In the Stylesheet field of the Publish to PDF File dialog box (see Publish to PDF File dialog box), ensure your stylesheet is selected. Click OK to start the publishing process.
14. Once publishing is complete, open the output PDF file. Access its Document Properties dialog box by clicking File > Document Properties in the Acrobat menu.
15. Click on the Description tab if it not already active, and note that the Author field contains the value you set.
16. Click on the Custom tab, and note that the Custom Properties field contains an entry for Booktitle. The value of the entry is “Welcome to the Wonderful World of Modern Transportation”, which is the title of the original transport.xml document.
Include Custom XMP Metadata in PDF Output
You can reference a custom XMP file from your stylesheet, and specify that its metadata should be included in PDF output. This option is available if you are publishing PDF output with the PTC ALD engine.
To reference a custom XMP metadata file:
1. Confirm that your environment is set to use PTC ALD as the PDF publishing engine. For more information, see Logic for Print/Preview Engine Selection
2. Save your XMP metadata file (.xmp) to a location that can be referenced by your stylesheet.
3. Open the PTC ALD PDF configuration file (.appcf) that you are using to manage your PDF publishing actions.
4. Navigate to this element in the file:
Print > PDFPrinter > DocumentProperties
For more information, see PTC ALD PDF Configuration File (.appcf)
5. Set the value of the xmpMetadata attribute for the element to the path to your custom XMP file, for example xmpMetadata=”D:\test.xmp”. Save the file.
6. Publish your document to PDF output.
7. The metadata defined in the XMP file is included as metadata for the PDF file. For example, you can open the PDF in Adobe Acrobat and navigate to this path to view the XMP metadata:
File > Properties > Document Properties > Additional Metadata > Advanced
* 
Custom XMP metadata is merged with system generated XMP metadata and other document properties configured in the stylesheet. The custom XMP metadata will be overridden if the other two contain the same entries.