You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by sareth <gw...@hotmail.com> on 2012/12/03 22:11:14 UTC

embedd SVG graphics and navigate between them

Hello, I use OpenJDK 7 and Apache FOP 1.1

I tried to embedd two simple SVG graphics in a .fo file (a square on page
one and a circle on page two, for example) in order to navigate between
them: clicking on square page 1 would lead to circle on page 2.

But unfortunately, I failed always and it had never worked for me.

Do you have any example, or any way to do this please to help me ?

thank you by advance,
best regards



--
View this message in context: http://apache-fop.1065347.n5.nabble.com/embedd-SVG-graphics-and-navigate-between-them-tp37447.html
Sent from the FOP - Users mailing list archive at Nabble.com.

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


RE: embedd SVG graphics and navigate between them

Posted by sareth <gw...@hotmail.com>.
Hi, thank you very much for your help.

I use Docx4j 2.8.1 which has dependency FOP 1.0, so I currently embedd FOP
0.95 patched and FOP 1.0 in my application, and it's not very good to work
with...
I think I will try to work on it again in order to include this patch even
if I failed first time I tried...

If it works, I will post result on this tread.

with regards,
Sareth



--
View this message in context: http://apache-fop.1065347.n5.nabble.com/embedd-SVG-graphics-and-navigate-between-them-tp37447p37463.html
Sent from the FOP - Users mailing list archive at Nabble.com.

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


RE: embedd SVG graphics and navigate between them

Posted by Robert Meyer <rm...@hotmail.co.uk>.
Hi Sareth,

I spent a bit of time trying to get this patch working with trunk today with not much luck unfortunately. The change in structure resulted in the methods to get the necessary PDFAction object now existing in the IFRenderer class. In order to make a link you either either need that or give the target page reference and object co-ordinates (which we don't have), otherwise it just doesn't want to know. The current set of PDFFactory.makeLink() methods don't accept object id references either. I tried hacking around a bit by modifying the PDFDocument class and passing each end of the link from both the IFRenderer and PDFGraphics2D objects until a match was found , but even when I did create the link with no warnings, it wasn't clickable.

If you or someone else does manage to get it working, I would be interested to see how it was implemented. I'll keep my code for the time being in case I have time to have another go at it.

Regards,

Robert

> Date: Tue, 4 Dec 2012 06:29:09 -0800
> From: gwen89perso@hotmail.com
> To: fop-users@xmlgraphics.apache.org
> Subject: RE: embedd SVG graphics and navigate between them
> 
> Hi,
> 
> I tried to compile FOP 0.95 with fix from 
> https://issues.apache.org/bugzilla/show_bug.cgi?id=45759
> <https://issues.apache.org/bugzilla/show_bug.cgi?id=45759>  
> It worked, and I succeed to have a link inside SVG graphic that leads to
> another place in document, so I'm very happy with this !
> 
> but unfortunately, FOP 1.1 has its structure changed and it's difficult for
> me to include it in this version.
> 
> I'm going to open a new thread on it.
> 
> Your knowledge about FOP seems to be very good so you are welcome if you
> want to help me. 
> 
> regards,
> sareth
> 
> 
> 
> --
> View this message in context: http://apache-fop.1065347.n5.nabble.com/embedd-SVG-graphics-and-navigate-between-them-tp37447p37457.html
> Sent from the FOP - Users mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
> 
 		 	   		  

RE: embedd SVG graphics and navigate between them

Posted by sareth <gw...@hotmail.com>.
Hi,

I tried to compile FOP 0.95 with fix from 
https://issues.apache.org/bugzilla/show_bug.cgi?id=45759
<https://issues.apache.org/bugzilla/show_bug.cgi?id=45759>  
It worked, and I succeed to have a link inside SVG graphic that leads to
another place in document, so I'm very happy with this !

but unfortunately, FOP 1.1 has its structure changed and it's difficult for
me to include it in this version.

I'm going to open a new thread on it.

Your knowledge about FOP seems to be very good so you are welcome if you
want to help me. 

regards,
sareth



--
View this message in context: http://apache-fop.1065347.n5.nabble.com/embedd-SVG-graphics-and-navigate-between-them-tp37447p37457.html
Sent from the FOP - Users mailing list archive at Nabble.com.

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


RE: embedd SVG graphics and navigate between them

Posted by sareth <gw...@hotmail.com>.
Hello Robert, thank you for your help.

Your example works well. But unfortunately, my request was not precise
enough.

In fact, I tried to make only tiger eye clickable for example, not all
graphic...

I tried <svg:a xlink:href="#testlink"/>...</svg:a>, I tried <fo:basic-link
internal-destination="testlink"> too, but it didn't work.

In fact, I would like to have only part of SVG to be clickeable (for example
an eye), and when I click on it I would be redirected to matching place in
.fo file, such as the link you created. The link is inside SVG graphic.

Please can you help me with that ?

best regards,
sareth



--
View this message in context: http://apache-fop.1065347.n5.nabble.com/embedd-SVG-graphics-and-navigate-between-them-tp37447p37455.html
Sent from the FOP - Users mailing list archive at Nabble.com.

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


RE: embedd SVG graphics and navigate between them

Posted by Robert Meyer <rm...@hotmail.co.uk>.
Hi,

I have attached the following example, but it is not ideal as there is a lot of content in the example. It was taken from the ./examples/fo/svg/ directory. If you click on the big tiger head on the first page it will take you to the target SVG image on another page. To do this I did the following:

1) Around the <fo:instream-foreign-object> tags surrounding the SVG I placed an fo:basic link with an internal-destination attribute saying where I want it to link to e.g.

<fo:basic-link internal-destination="testlink">
<fo:instream-foreign-object>
<svg:svg xmlns:svg="http://www.w3.org/2000/svg" width = "542px" height="505px">
<svg:title>A less cute tiger</svg:title>
...
</svg:svg>
</fo:instream-foreign-object>
</fo:basic-link>

2) Then, all I needed to do was give the parent block of the second SVG image a matching link ID e.g.

 <fo:block font-size="8pt" white-space-collapse="false" space-before.optimum="5pt" id="testlink">
<![CDATA[
<fo:instream-foreign-object>
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20">
...
</svg>
</fo:instrea-foreign-object>
</fo:block>

And thats pretty much it. Let me know if you're still having issues and I will try and create a smaller example.

Regards,

Robert Meyer