What do you mean by "internal format tree"?

You give FOP an instance of XMLRenderer (with setRendererOverride()) and
if you call the XMLRenderer's getMimeType() method, it will return the
value of MimeConstants.MIME_FOP_AREA_TREE. I suspect that if you specify
a MIME type the override renderer is overlooked and a different
XMLRenderer instance created instead.

On 30.07.2009 14:16:08 Georg Datterl wrote:
> Hi Jeremias, 
> 
> And how does FOP now know I want the area tree and not the internal format 
> tree? 
> 
> Regards,
>  
> Georg Datterl
>  
> ------ Kontakt ------
>  
> Georg Datterl
>  
> Geneon media solutions gmbh
> Gutenstetter Straße 8a
> 90449 Nürnberg
>  
> HRB Nürnberg: 17193
> Geschäftsführer: Yong-Harry Steiert 
> 
> Tel.: 0911/36 78 88 - 26
> Fax: 0911/36 78 88 - 20
>  
> www.geneon.de
>  
> Weitere Mitglieder der Willmy MediaGroup:
>  
> IRS Integrated Realization Services GmbH:    www.irs-nbg.de 
> Willmy PrintMedia GmbH:                            www.willmy.de
> Willmy Consult & Content GmbH:                 www.willmycc.de 
> -----Ursprüngliche Nachricht-----
> Von: Jeremias Maerki [mailto:[email protected]] 
> Gesendet: Donnerstag, 30. Juli 2009 14:12
> An: [email protected]
> Betreff: Re: AW: configuration difference between -pdf and -at?
> 
> Hmm, try
> Fop fop = fopFactory.newFop(foUserAgent); instead of Fop fop = 
> fopFactory.newFop(MimeConstants.MIME_FOP_AREA_TREE, foUserAgent);
> 
> I've got a suspicion that the renderer override doesn't hook in if you 
> specify a MIME type. I'll have to debug that.
> 
> On 30.07.2009 13:31:38 Georg Datterl wrote:
> > Hi Jeremias,
> > 
> > Thanks. Now I'm more confused than before. As you know, I generate an 
> > area tree, then manipulate my fo file and then generate the final PDF. 
> > Now I found a case, where the AT puts four table rows on the second 
> > page but the final PDF has 5 rows. So the values I calculate from the 
> > AT don't work any more. Using the batch file now gives me 5 rows in AT 
> > and PDF. So I guess it's not a fop fault. Checking my code, I see I am 
> > using mimicRenderer(). Can you see any reason why I only get four rows 
> > here
> > 
> >             FopFactory fopFactory = FopFactory.newInstance();
> >             fopFactory.setUserConfig(new File("fonts/fop.xconf"));
> >             FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
> >             SAXTransformerFactory mpFactory = 
> > (SAXTransformerFactory)SAXTransformerFactory.newInstance();
> >             Transformer transformer =  mpFactory.newTransformer();
> >             TransformerHandler handler = mpFactory.newTransformerHandler();
> >             DOMResult domResult = new DOMResult();
> >             handler.setResult(domResult);
> > 
> >             org.apache.fop.render.Renderer targetRenderer =
> >             foUserAgent.getRendererFactory().createRenderer(
> >                             foUserAgent, MimeConstants.MIME_PDF);
> > 
> >             XMLRenderer renderer = new XMLRenderer();
> >             renderer.mimicRenderer(targetRenderer);
> >             renderer.setContentHandler(handler);
> >             renderer.setUserAgent(foUserAgent);
> > 
> >             foUserAgent.setRendererOverride(renderer);
> >             
> >             Fop fop = fopFactory.newFop(MimeConstants.MIME_FOP_AREA_TREE, 
> > foUserAgent);
> >             Result res = new SAXResult(fop.getDefaultHandler());
> >             transformer.transform(source, res);
> >             return  (org.w3c.dom.Document)domResult.getNode();
> > 
> > but five rows here
> > 
> >             FopFactory fopFactory = FopFactory.newInstance();
> >             fopFactory.setUserConfig(new File("fonts/fop.xconf"));
> >             FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
> >             foUserAgent.setAuthor("P3");
> >             foUserAgent.setCreator(pdfTarget.getAbsolutePath());
> >             out = new FileOutputStream(pdfTarget);
> >             out = new BufferedOutputStream(out);
> >             Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, 
> > foUserAgent, out);
> >             TransformerFactory factory = TransformerFactory.newInstance();
> >             Transformer transformer = factory.newTransformer(); // identity 
> > transformer
> >             Source src = new StreamSource(target);
> >             Result res = new SAXResult(fop.getDefaultHandler());
> >             transformer.transform(src, res);
> > 
> > Mit freundlichen Grüßen
> >  
> > Georg Datterl
> >  
> > ------ Kontakt ------
> >  
> > Georg Datterl
> >  
> > Geneon media solutions gmbh
> > Gutenstetter Straße 8a
> > 90449 Nürnberg
> >  
> > HRB Nürnberg: 17193
> > Geschäftsführer: Yong-Harry Steiert
> > 
> > Tel.: 0911/36 78 88 - 26
> > Fax: 0911/36 78 88 - 20
> >  
> > www.geneon.de
> >  
> > Weitere Mitglieder der Willmy MediaGroup:
> >  
> > IRS Integrated Realization Services GmbH:    www.irs-nbg.de 
> > Willmy PrintMedia GmbH:                            www.willmy.de
> > Willmy Consult & Content GmbH:                 www.willmycc.de 
> > -----Ursprüngliche Nachricht-----
> > Von: Jeremias Maerki [mailto:[email protected]]
> > Gesendet: Donnerstag, 30. Juli 2009 13:05
> > An: [email protected]
> > Betreff: Re: configuration difference between -pdf and -at?
> > 
> > Georg,
> > by default, FOP uses the configuration under the area tree renderer's own 
> > MIME type (application/X-fop-areatree). You need to tell the area tree 
> > renderer to mimic the PDF renderer by specifying:
> > -at application/pdf ifbug.xml
> > 
> > Then, it'll take the PDF configuration. Other people may need to produce AT 
> > XML for AFP or for PostScript where the configuration can be different, so 
> > we can't just assume PDF is the right one. It has to be explicit.
> > 
> > This is explained in 
> > http://xmlgraphics.apache.org/fop/0.95/intermediate.html
> > but maybe not well enough.
> > 
> > On 30.07.2009 12:50:04 Georg Datterl wrote:
> > > Hi,
> > > 
> > > When I generate a pdf by calling
> > > 
> > > fop.bat -c conf/fop.xconf -fo ifbug.fo -pdf ifbug.pdf
> > > 
> > > everything works fine. But trying to generate the area tree from a 
> > > similar call
> > > 
> > > fop.bat -c conf/fop.xconf -fo ifbug.fo -at ifbug.xml
> > > 
> > > gives me warnings about fonts not found. Obviously the first call finds 
> > > the configuration file and can read the fonts configured in 
> > > fop/renderers/renderer[mime=application/pdf]/fonts. Do I need a different 
> > > mime type for the area tree? 
> > > 
> > > Regards,
> > >  
> > > Georg Datterl
> 
> 
> Jeremias Maerki
> 
> 
> ---------------------------------------------------------------------
> 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]
> 




Jeremias Maerki


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

Reply via email to