Re: FO + External bitmap graphics - FOP - SVG
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=0rev=1.3.2.9only_with_tag=fop-0_20_2-maintainview=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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: FO + External bitmap graphics - FOP - SVG
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=0rev=1.3.2.9only_with_tag=fop-0_20_2-maintainview=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 -- Daniel Noll NUIX Pty Ltd Level 8, 143 York Street, Sydney 2000 Phone: (02) 9283 9010 Fax: (02) 9283 9020 This message is intended only for the named recipient. If you are not the intended recipient you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this message or attachment is strictly prohibited. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
FO + External bitmap graphics - FOP - SVG
I have the following FO code (reduced to fit well in the email): fo:root ... fo:layout-master-set ... /fo:layout-master-set fo:page-sequence ... fo:flow ... fo:block fo:external-graphic src=url(embedded.gif) width=120px height=120px content-width=120px content-height=120px/ /fo:block /fo:flow /fo:page-sequence /fo:root When I use FOP to convert this to a PDF, it works perfectly. But when I use the same files and convert it to an SVG, the image is missing. On inspection of the SVG file: svg ... g ... rect width=595.0 x=0.0 height=842.0 y=0.0 style=fill:none;stroke:black/ a xlink:href=#svgView(viewBox(0, 0.0, 595, 842)) xlink:type=simple xlink:actuate=onRequest xlink:show=replace xmlns:xlink=http://www.w3.org/1999/xlink; rect width=297.0 x=0.0 height=842.0 y=0.0 style=fill:blue;visibility:hidden/ /a /g /svg As you can probably see, the image isn't actually linked in the SVG file at all, but replaced with some invisible blue block. Am I doing something wrong? This particular image is in GIF format, if that matters. Daniel -- Daniel Noll NUIX Pty Ltd Level 8, 143 York Street, Sydney 2000 Phone: (02) 9283 9010 Fax: (02) 9283 9020 This message is intended only for the named recipient. If you are not the intended recipient you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this message or attachment is strictly prohibited. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]