You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Xavier Loiseau <xl...@yahoo.fr> on 2009/08/10 11:54:12 UTC

How to keep hyperlinks when transforming an SVG into a PDF ?

Hi,


Here is a simple SVG file containing a rectangle with a hyperlink:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
     xmlns:svg="http://www.w3.org/2000/svg"
     xmlns="http://www.w3.org/2000/svg"
     xmlns:xlink="http://www.w3.org/1999/xlink"
     version="1.0"
     width="1000"
     height="1000">
     <g>
         <a xlink:href="http://www.google.com">
             <rect width="100" height="100" x="100" y="100"/>
         </a>
     </g>
</svg>


This SVG file is transformed into a PDF file as follows:
java -jar batik-1.7/batik-rasterizer.jar -m application/pdf sample.svg


When the resulting PDF file is viewed, the hyperlink does not work !


How to keep hyperlinks when transforming an SVG into a PDF ?


Thank you very much for your help.


Xav


Re: How to keep hyperlinks when transforming an SVG into a PDF ?

Posted by Helder Magalhães <he...@gmail.com>.
Hi Xav,


> This SVG file is transformed into a PDF file as follows:

The PDF output functionality of Batik comes from FOP, a separate
project. Although a few (most notably Jeremias Maerki) are usually
also aware of what's happening here (follow the Batik mailing lists),
it may be good to redirect PDF related questions there (specially if
you receive no interesting feedback here). ;-)


> When the resulting PDF file is viewed, the hyperlink does not work !

This seems to be not yet supported by FOP [1], but I may be
misinterpreting the issue...


> How to keep hyperlinks when transforming an SVG into a PDF ?

I really don't know. PDF supports hyperlinks, so you may need to
rework that particular part of PDF output. I'd suggest you started by
attempting with the most updated (unreleased) versions of Batik and/or
FOP in order to check if the problem was already fixed in the meantime
(since the latest official release, that is). If that doesn't help,
than one may need to debug to see what's happening and/or try to check
how's FOP doing with hyperlink handling. :-)


> Thank you very much for your help.

Hope this helps,
 Helder


[1] http://thread.gmane.org/gmane.text.xml.fop.user/1483/focus=1549

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


Re: How to keep hyperlinks when transforming an SVG into a PDF ?

Posted by th...@kodak.com.
Hi Xavier,

Xavier Loiseau <xl...@yahoo.fr> wrote on 08/10/2009 05:54:12 AM:

> When the resulting PDF file is viewed, the hyperlink does not work !
> 
> How to keep hyperlinks when transforming an SVG into a PDF ?

   Write code to add support for hyperlinks to Batik/FOP
(we use the FOP PDF Graphics2D to convert the SVG to PDF). The 
FOP PDF Graphics2D would need to ability to identify blocks of 
graphics that need to be wrapped as a hyperlink, and then the 
SVG Graphics tree would need to call methods on an extended 
interface when appropriate.

   The second part is fairly simple, I don't have a clue how
hyperlinks are implemented in PDF.