The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

emiliai (2) [Avatar] Offline
#1
Hi, all!


iText offers a great feature: generating pdf-documents from XML using a tagmap file. But I got into a problem: how do I set the font from a tagmap.xml for an Element?


Here is the code that I am using:


1. circulation.xml: the XML from which I want to generate my PDF:



<circulation_list>

<line>

<label>

<message key="circulation.list.pdf.title"/>:

</label>

<value>

<title />

(<message key="circulation.list.pdf.issn"/>: <issn />smilie

</value>

</line>



<line>

<label>

<message key="circulation.list.pdf.frequency"/>:

</label>

<value><frequency /></value>

</line>



<line>

<label>

<message key="circulation.list.pdf.issue"/>:

</label>

<value><issue /></value>

</line>



<line>

<label>

<message key="circulation.list.pdf.refs"/>:

</label>

<value><references /></value>

</line>

</circulation_list>



2. the tagmap.xml :

<tagmap>

<tag name="paragraph" alias="label">

<attribute name="leading" value="15" />

<attribute name="align" value="Left" />

</tag>

<tag name="paragraph" alias="value">

<attribute name="leading" value="0" />

<attribute name="align" value="Left" />

<attribute name="indentationleft" value="100"/>

</tag>

<tag name="chunk" alias="message"/>

</tagmap>



In circulation.xml: title, issn, frequency, issue and references are xml nodes that I transform into chunks and populate them with data from the DB.

My problem: I want to make the nodes <label> and <value> bolded and helvetica. I cannot figure out HOW to do this from tagmap.xml.
blowagie (284) [Avatar] Offline
#2
Re: how to set font in tagmap.xml?
As far as I remember, it's something like this:
<attribute name="style" value="font-family: helvetica; font-weight: bold" />
For more info, you can look at the FontFactory and FontFactoryImp.getFont(Properties attributes) method.