xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeremias Maerki <dev.jerem...@greenmail.ch>
Subject Re: FO + External bitmap graphics -> FOP -> SVG
Date Thu, 05 May 2005 10:36:38 GMT
Don't be shy! This is actually quite easy. It just took the following
lines to hack that missing feature in. Just place the code snippet below
in SVGRenderer in the method renderImageArea() right after the commented
call to graphics.drawImage().

                    Element imageElement = svgDocument.createElementNS(svgNS, "image");
                    imageElement.setAttribute("x", Integer.toString(startx));
                    imageElement.setAttribute("y", Integer.toString(starty));
                    imageElement.setAttribute("width", Integer.toString(endx - startx));
                    imageElement.setAttribute("height", Integer.toString(starty - endy));
                    imageElement.setAttributeNS(null, "xlink:href", url.toString());
                    currentPageG.appendChild(imageElement);

...and suddenly you have images. Somewhat dirty hack but it works here.
The only problem might be the format of the URLs because a relative URL
in the FO document is automatically expanded based on the baseURL. So
you get an absolute URL in any case.

Your work-around will also work.

Please don't assume just because a feature hasn't been implemented it is
extremely difficult to implement. The SVG renderer is just a nice
addition to FOP. It's not one of our main renderers so it may not be so
well maintained. This is open source. If a feature is missing, implement
it! :-)

On 04.05.2005 01:26:06 Daniel Noll wrote:
> Jeremias Maerki wrote:
> 
> >You're not doing anything wrong. As far as I can tell images are not
> >implemented in the SVG renderer. You'd have to finish that part yourself.
> >See:
> >http://cvs.apache.org/viewcvs.cgi/xml-fop/src/org/apache/fop/render/svg/SVGRenderer.java?hideattic=0&rev=1.3.2.9&only_with_tag=fop-0_20_2-maintain&view=markup
> >  
> >
> Suddenly this seems pretty hard to do.  At first impressions I would use 
> FopImage.getURL(), then try to generate the SVG so that the right 
> attributes are on the image.  That way I'd get an externally linked 
> image in the SVG, but if it were easy it would have been done already.
> 
> I assume there is a workaround for this.  Perhaps I can embed an SVG in 
> my XSL:FO, and have that SVG fragment reference the image?  Then it 
> would presumably get copied verbatim into the SVG version of the document.
> 
> Daniel



Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Mime
View raw message