You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by Sergey Simonchik <Se...@borland.com> on 2005/09/28 17:10:23 UTC

rtf-external-graphics

Hi,

After patch of Peter Herweg, adding support of external-graphics in Rtf
(25.09.2005, revision 291449) some problems are still unresolved. 
I'm talking about using url's in src attribute of fo:external-graphic tag.

Take a look at fo-file below:
  ...
  <fo:flow flow-name="xsl-region-body">
    <fo:block start-indent="12pt" space-before="3pt">
      <fo:external-graphic src="url('01.jpg')"/>
    </fo:block>
  </fo:flow>
  ...

Rtf renderer produced file "01a.rtf" (see in attach).

After changing in file RTFHandler.java string
	newGraphic.setURL(eg.getSrc());
to string
	newGraphic.setURL(eg.getURL());
Rtf renderer produced another file "01b.rtf" (in attach too).

File "01b.rtf" seems to be correct whether "01a.rtf" is not.

What do you think about it?


Thanks for attention!

Re: AW: rtf-external-graphics

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
They are in the org.apache.fop.image package. Start by looking at
ImageFactory. They're not in XML Graphics Commons, yet, but will go
there eventually.

On 28.09.2005 23:58:11 Peter Herweg wrote:
> > Jeremias Maerki wrote:
> > I'll look into it tomorrow. Peter's last change for external-graphics in
> > RTF made me wonder if we shouldn't actually change the whole code there
> > and use the image library wrappers the normal renderers use. Like this
> > we could use the image cache, more image formats and URI resolution the
> > same way as for the other output formats.
> 
> I have played around with JAI to support other file formats (e.g. GIF, BMP).
> This
> works good but it's quite slow.
> I did not know that there are image library wrappers. Can you point me to
> them?
> Are they contained in XML Graphics Commons?
> 
> Regards,
> Peter Herweg



Jeremias Maerki


Re: rtf-external-graphics

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
Sorry for the delay. I've had a closer look at this and have a few
observations:

- Simply using getURL() instead of getSrc() doesn't solve the present
problem entirely, IMO.
- The current RtfExternalGraphic class is fine as it is for the people
who use the RTF library stand-alone without FOP. But it should be
renamed to RtfImage or something like that. external-graphic is an FO
term, not an RTF term.
- For FOP use, we should create a different class which creates a
dependency on org.apache.fop.image so we can use the same image access
classes as the rest of FOP does. Like this we we can solve the problem
of relative URLs which currently are resolved differently than for
renderers using the layout engine. After all, the ExternalGraphic FO
class has access to the FopImage instance where the appropriate
InputStream is already available. No need to duplicate this.
- Doing the latter means creating an image wrapper for loading EMF files
much like the JPEG images are currently provided (raw stream).
- RtfHandler should use the image's intrinsic size if the height and
width of the image are set to "auto".
- If the image can't be loaded a message should be sent to the log.
Currently the exception is simply written into the generated RTF file.

In the end doing this right is not a 20 minute job, but not a huge thing
either. I think it would be worth doing this right. Volunteers welcome.
I don't have time right now to do it, but may do it later when I have
some air again.

On 30.09.2005 18:02:20 Sergey Simonchik wrote:
> Did you meet any difficulties?
> 
> 
> -----Original Message-----
> From: Jeremias Maerki [mailto:dev@jeremias-maerki.ch] 
> Sent: Thursday, September 29, 2005 12:33 AM
> To: fop-dev@xmlgraphics.apache.org
> Cc: Danila Ermakov
> Subject: Re: rtf-external-graphics
> 
> > I'll look into it tomorrow. Peter's last change for external-graphics in 
> > RTF made me wonder if we shouldn't actually change the whole code there 
> > and use the image library wrappers the normal renderers use. Like this 
> > we could use the image cache, more image formats and URI resolution the 
> > same way as for the other output formats. 
> > On 28.09.2005 17:10:23 Sergey Simonchik wrote: 
> > > Hi, 
> > > 
> > > After patch of Peter Herweg, adding support of external-graphics in Rtf 
> > > (25.09.2005, revision 291449) some problems are still unresolved. 
> > > I'm talking about using url's in src attribute of fo:external-graphic
> tag. 
> > > 
> > > Take a look at fo-file below: 
> > >   ... 
> > >   <fo:flow flow-name="xsl-region-body"> 
> > >     <fo:block start-indent="12pt" space-before="3pt"> 
> > >       <fo:external-graphic src="url('01.jpg')"/> 
> > >     </fo:block> 
> > >   </fo:flow> 
> > >   ... 
> > > 
> > > Rtf renderer produced file "01a.rtf" (see in attach). 
> > > 
> > > After changing in file RTFHandler.java string 
> > >       newGraphic.setURL(eg.getSrc()); 
> > > to string 
> > >       newGraphic.setURL(eg.getURL()); 
> > > Rtf renderer produced another file "01b.rtf" (in attach too). 
> > > 
> > > File "01b.rtf" seems to be correct whether "01a.rtf" is not. 
> > > 
> > > What do you think about it? 
> > > 
> > > 
> > > Thanks for attention! 
> >
> > Jeremias Maerki 



Jeremias Maerki


AW: rtf-external-graphics

Posted by Peter Herweg <ph...@web.de>.
> Jeremias Maerki wrote:
> I'll look into it tomorrow. Peter's last change for external-graphics in
> RTF made me wonder if we shouldn't actually change the whole code there
> and use the image library wrappers the normal renderers use. Like this
> we could use the image cache, more image formats and URI resolution the
> same way as for the other output formats.

I have played around with JAI to support other file formats (e.g. GIF, BMP).
This
works good but it's quite slow.
I did not know that there are image library wrappers. Can you point me to
them?
Are they contained in XML Graphics Commons?

Regards,
Peter Herweg


RE: rtf-external-graphics

Posted by Sergey Simonchik <Se...@borland.com>.
Did you meet any difficulties?


-----Original Message-----
From: Jeremias Maerki [mailto:dev@jeremias-maerki.ch] 
Sent: Thursday, September 29, 2005 12:33 AM
To: fop-dev@xmlgraphics.apache.org
Cc: Danila Ermakov
Subject: Re: rtf-external-graphics

> I'll look into it tomorrow. Peter's last change for external-graphics in 
> RTF made me wonder if we shouldn't actually change the whole code there 
> and use the image library wrappers the normal renderers use. Like this 
> we could use the image cache, more image formats and URI resolution the 
> same way as for the other output formats. 
> On 28.09.2005 17:10:23 Sergey Simonchik wrote: 
> > Hi, 
> > 
> > After patch of Peter Herweg, adding support of external-graphics in Rtf 
> > (25.09.2005, revision 291449) some problems are still unresolved. 
> > I'm talking about using url's in src attribute of fo:external-graphic
tag. 
> > 
> > Take a look at fo-file below: 
> >   ... 
> >   <fo:flow flow-name="xsl-region-body"> 
> >     <fo:block start-indent="12pt" space-before="3pt"> 
> >       <fo:external-graphic src="url('01.jpg')"/> 
> >     </fo:block> 
> >   </fo:flow> 
> >   ... 
> > 
> > Rtf renderer produced file "01a.rtf" (see in attach). 
> > 
> > After changing in file RTFHandler.java string 
> >       newGraphic.setURL(eg.getSrc()); 
> > to string 
> >       newGraphic.setURL(eg.getURL()); 
> > Rtf renderer produced another file "01b.rtf" (in attach too). 
> > 
> > File "01b.rtf" seems to be correct whether "01a.rtf" is not. 
> > 
> > What do you think about it? 
> > 
> > 
> > Thanks for attention! 
>
> Jeremias Maerki 


Re: rtf-external-graphics

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
I'll look into it tomorrow. Peter's last change for external-graphics in
RTF made me wonder if we shouldn't actually change the whole code there
and use the image library wrappers the normal renderers use. Like this
we could use the image cache, more image formats and URI resolution the
same way as for the other output formats.

On 28.09.2005 17:10:23 Sergey Simonchik wrote:
> Hi,
> 
> After patch of Peter Herweg, adding support of external-graphics in Rtf
> (25.09.2005, revision 291449) some problems are still unresolved. 
> I'm talking about using url's in src attribute of fo:external-graphic tag.
> 
> Take a look at fo-file below:
>   ...
>   <fo:flow flow-name="xsl-region-body">
>     <fo:block start-indent="12pt" space-before="3pt">
>       <fo:external-graphic src="url('01.jpg')"/>
>     </fo:block>
>   </fo:flow>
>   ...
> 
> Rtf renderer produced file "01a.rtf" (see in attach).
> 
> After changing in file RTFHandler.java string
> 	newGraphic.setURL(eg.getSrc());
> to string
> 	newGraphic.setURL(eg.getURL());
> Rtf renderer produced another file "01b.rtf" (in attach too).
> 
> File "01b.rtf" seems to be correct whether "01a.rtf" is not.
> 
> What do you think about it?
> 
> 
> Thanks for attention!



Jeremias Maerki