W3C home > Mailing lists > Public > www-xsl-fo@w3.org > October 2001

Re: How to specify userconfig file with Driver

From: Erik Melkersson <melker@unit.liu.se>
Date: Thu, 04 Oct 2001 11:17:24 +0200
To: Rohit <rsharma@nicusa.com>
Cc: www-xsl-fo@w3.org
Message-id: <3BBC2924.4D4E2591@unit.liu.se>
This example works fine for me:
Although I newer tell the Driver what Options object to use it actually
works.


---
import ...
import org.apache.fop.apps.Driver;
import org.apache.fop.apps.Options;

public class ... {
    public static void main(String args[]) {
	try {
	    File userConfigFile = new File("lib/userconfig.xml");
	    Options options = new Options(userConfigFile);

	    Driver driver = new Driver();
	    driver.setRenderer(Driver.RENDER_PDF);
	    driver.setInputSource(new InputSource(new
FileInputStream(args[0])));
	    driver.setOutputStream(new FileOutputStream(args[1]));
	    driver.run();
	} catch (FileNotFoundException e) {
	    e.printStackTrace();
        } catch (Exception e) {
	    e.printStackTrace();
        }
   }
}

---
/Erik Melkersson


> Rohit wrote:
> 
> Hi,
> 
> When one uses additional true type fonts with Fop, one has to generate
> the font matrix file from the .ttf file and make an entry for it in
> the conf/userconfig.xml file. Then, one has to start Fop with "-c
> conf/userconfig.xml" option and it works. So far so good and it works.
> However, I am not clear as to how one achieves the same result when
> one is embedding Fop in another application. In other words, how does
> one specify the userconfig.xml to the Driver class, so that Driver can
> recognize the additional fonts?
> 
> Any pointers are welcome,
> 
> Thanks in advance,
> 
> Rohit

-- 
__________________________
Erik Melkersson, UNIT
melker@unit.liu.se, 013-285794
http://www.unit.liu.se/
Received on Thursday, 4 October 2001 05:17:59 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 3 October 2007 16:06:08 GMT