Re: How to specify userconfig file with Driver

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 UTC