I'm not sure what you're talking about here, but FOP is not serializable, and 
the input and output is all serializable. 

-----Original Message-----
From: mehdi houshmand [mailto:[email protected]] 
Sent: Thursday, March 10, 2011 10:44 AM
To: [email protected]
Subject: Re: manipulate fop configuration file via java

Hi,

Correct me if I'm wrong but I think you're trying to serialize the data that 
you configure progammatically. If so, but I don't think that feature currently 
exists in FOP (or if it does, I haven't come across it). If you wish to set and 
save config settings, you could use the various XML DOM libraries out there to 
create a custom fop.xconf. That will allow you to serialize any changes you 
make and you can make changes at run-time. There maybe another way of doing 
this, but short of creating your own serialization format (which in fairness 
wouldn't be very difficult), that's the only way I can think of.

I may however have the wrong end of the stick here, if so, my apologies.

Mehdi

On 10 March 2011 15:34, Eric Douglas <[email protected]> wrote:
> What are you trying to save?  What you're talking about here is an 
> either or.  You can load font information using the configuration file 
> or you can load them straight from the ttf with embedded code.
> If you're using the embedded code you don't need the configuration 
> file for fonts.  You also don't need a metrics file anymore.
>
> ________________________________
> From: ingo peter [mailto:[email protected]]
> Sent: Thursday, March 10, 2011 8:13 AM
> To: [email protected]
> Subject: manipulate fop configuration file via java
>
> hi,
>
> i can embed fonts via command-line to the file "fop.xml" and render a 
> pdf with special fonts.
>
> "fop.xml"
> <fop version="1.0">
>   <renderers>
>     <renderer mime="application/pdf">
>       <filterList>
>         <value>null</value>
>       </filterList>
>       <filterList type="image">
>         <value>flate</value>
>         <value>ascii-85</value>
>       </filterList>
>        <font-base>/tmp/</font-base>
>       <fonts>
>         <font metrics-url="testfont.xml" kerning="yes"
> embed-url="testfont.ttf">
>                 <font-triplet name="testfont" style="normal"
> weight="normal"/>
>         </font>
>       </fonts>
>     </renderer>
>   </renderers>
>   <target-resolution>300</target-resolution>
> </fop>
>
>
> is it also via java possible to safe the font-information to "fop.xml" 
> for later use?
>
> i tried this, but i don't know to save my changes back to a xml-file!
> ...
>     String fontname = "test1";
>     String filename = "test1.ttf";i
>     // set own configuation file:
>     try {
>          FontTriplet fontTriplet = new 
> FontTriplet(fontname,Font.STYLE_NORMAL, Font.WEIGHT_NORMAL);
>          List<FontTriplet> fontTriplets = new 
> ArrayList<FontTriplet>();
>          fontTriplets.add(fontTriplet);
>          EmbedFontInfo nfont = new
> EmbedFontInfo(filename.substring(0,datei.length()-3)+"xml", true, 
> fontTriplets, filename, fontname);
>          DefaultConfigurationBuilder cfgBuilder = new 
> DefaultConfigurationBuilder();
>          Configuration cfg = cfgBuilder.buildFromFile(new 
> File("/tmp/fop.xml"));
>          FopFactory fopFactory = FopFactory.newInstance();
>          fopFactory.setUserConfig(cfg);
>          fopFactory.getFontManager().setFontBaseURL"/tmp/");
>          fopFactory.getFontManager().getFontCache().addFont(nfont);
>          fopFactory.getFontManager().getFontCache().save();
>         } catch (Exception ex) {
>         ex.printStackTrace();
>     }
>   }
> }
> ...
>
> how can i save my configuration?
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to