xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "J. de Hoop" <jos.de.h...@capgemini.com>
Subject How to run (user)config.xml to add Fonts in embedded FOP 020.5 with PDF
Date Wed, 02 Dec 2009 15:04:46 GMT

Hi,

we are having problems with certain characters in PDF, resulting in #
(ÂăãÆæßČč¢ results in Â#ãÆæß##¢).

Within the (user)config.xml you can add Fonts, see code, but how to run it
from the XSQLFOPSerializer ????.
We copied the Arial Window fonts to Linux.

I tried several things but nothing worked, see code:

/**
* Tested with the FOP 0.20.3RC release from 19-Jan-2002
*/
public class XSQLFOPSerializer implements XSQLDocumentSerializer {
private static final String PDFMIME = "application/pdf";

public void serialize(Document doc, XSQLPageRequest env) throws Throwable {
try {

// First make sure we can load the driver
Driver FOPDriver = new Driver();

Logger logger = new ConsoleLogger(ConsoleLogger.LEVEL_DEBUG); // ipv. INFO
MessageHandler.setScreenLogger(logger);
FOPDriver.setLogger(logger);

// Some of FOP's messages appear to still use MessageHandler.
// MessageHandler.setOutputMethod(MessageHandler.NONE);
// Then set the content type before getting the reader/
env.setContentType(PDFMIME);

// Tried the following, but does not work !!!!

// String userConfig = "/u02/gba/tent/userconfig.xml";
// File userConfigFile;
// userConfigFile = new File(userConfig);
// Options options = new Options();
// options.loadUserconfiguration(userConfigFile); 

FOPDriver.setOutputStream(env.getOutputStream());
FOPDriver.setRenderer(FOPDriver.RENDER_PDF);
FOPDriver.render(doc);
} catch (Exception e) {
e.printStackTrace(System.err);
}
}
}


userconfig.xml
 <entry>
 <key>fontBaseDir</key>
 <value>/usr/share/fonts/ttf</value>
 </entry>

<fonts>
 
    <font-triplet name="Arial" style="normal" weight="normal"/>
    <font-triplet name="ArialMT" style="normal" weight="normal"/>
 
 
    <font-triplet name="Arial" style="normal" weight="bold"/>
    <font-triplet name="ArialMT" style="normal" weight="bold"/>
 
 
    <font-triplet name="Arial" style="italic" weight="normal"/>
    <font-triplet name="ArialMT" style="italic" weight="normal"/>
 
 
    <font-triplet name="Arial" style="italic" weight="bold"/>
    <font-triplet name="ArialMT" style="italic" weight="bold"/>
 



Keywords:

FOP 020.5
XML2HTML / PDF
XSQLFOP
Embedded in ADF (fop.jar)
Linux

-- 
View this message in context: http://old.nabble.com/How-to-run-%28user%29config.xml-to-add-Fonts-in-embedded-FOP-020.5-with-PDF-tp26610373p26610373.html
Sent from the FOP - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Mime
View raw message