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 Jeremias Maerki <de...@jeremias-maerki.ch> on 2007/04/04 09:45:08 UTC

Destinations (was: Re: svn commit: r525078...)

Great addition, I agree, but is it supposed to work? I tried it out and
although some new elements are generated in the PDF the destinations
don't work. The elements generated also look a little different than in
0.20.5, and I'm not referring to the fact that currently we only
reference pages and not coordinates on pages. Jay, is the feature fully
implemented or are any things missing?

On 03.04.2007 10:41:27 Vincent Hennebert wrote:
> Hi Jay,
> 
> First, congratulations for this new feature! This is a great addition to
> FOP.
> 
> A few remarks about your commit:
> - I suggest you to install and setup checkstyle if you haven't done yet;
> - don't forget to add the ASF headers (checkstyle will notify you about
>   that, BTW) and set the "svn:keywords Id" and "svn:eol-style native" on
>   new files.
> - if your modifications are non-trivial (as is the case here), it's very
>   important to add a note about them in the status.xml file. The content
>   of this file appears on the following web page:
>   http://xmlgraphics.apache.org/fop/changes.html
>   This is a key page for our users to follow FOP's evolutions. If the
>   change is important and deserves to be highlighted in the release
>   notes of the next version (as, again, is the case here), you should
>   add the importance="high" attribute to the entry. See for example
>   here:
>   http://xmlgraphics.apache.org/fop/0.93/releaseNotes_0.93.html
>   I've added an entry for named destinations, feel free to improve it if
>   needed (for example, it might be good to explain the net result for
>   users).
> 
> Thanks,
> Vincent
> 
> 
> > Author: vhennebert
> > Date: Tue Apr  3 01:14:05 2007
> > New Revision: 525078
> > 
> > URL: http://svn.apache.org/viewvc?view=rev&rev=525078
> > Log:
> > - fix minor checkstyle issues
> > - add missing headers
> > - add an entry in status.xml for the new named destinations feature



Jeremias Maerki


Re: Destinations (was: Re: svn commit: r525078...)

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
Paul, thanks for the heads up and the explanation. I'm looking forward
to your patch. This is going to be a very important feature for all the
people doing book-style documents.

On 04.04.2007 18:12:53 Paul Vinkenoog wrote:
> Hi all,
> 
> > Great addition, I agree, but is it supposed to work? I tried it out
> > and although some new elements are generated in the PDF the
> > destinations don't work.
> 
> It's a small error: the PDFDestination class uses the reference to the
> page object as its goToReference. What it should use is a reference to
> a /Goto that jumps to the page in question.
> 
> There's also something wrong with makeLink(Rectangle2D rect, String
> destination, int linkType, float yoffset) in PDFFactory. The following
> line is commented out twice:
> 
>  //String file = destination.substring(0, index + 4);
> 
> Both instances should be uncommented, and in the corresponding calls
> to getGoToPDFAction (2 lines below), "destination" must be replaced
> with "file".
> Otherwise, Jay's destinations (once fixed) will be fine but they won't
> ever be found by FOP-built external links.
> 
> > The elements generated also look a little different than in 0.20.5,
> > and I'm not referring to the fact that currently we only reference
> > pages and not coordinates on pages.
> 
> As to that: I will probably submit my basic-links patch tomorrow. It
> makes links and bookmarks land "on the spot". I'll also hook up the
> named destinations to that mechanism.
> 
> 
> Kind regards,
> Paul Vinkenoog



Jeremias Maerki


Re: Destinations (was: Re: svn commit: r525078...)

Posted by Jay Bryant <ja...@bryantcs.com>.
> Hi all,
>
>> Great addition, I agree, but is it supposed to work? I tried it out
>> and although some new elements are generated in the PDF the
>> destinations don't work.
>
> It's a small error: the PDFDestination class uses the reference to the
> page object as its goToReference. What it should use is a reference to
> a /Goto that jumps to the page in question.
>
> There's also something wrong with makeLink(Rectangle2D rect, String
> destination, int linkType, float yoffset) in PDFFactory. The following
> line is commented out twice:
>
> //String file = destination.substring(0, index + 4);
>
> Both instances should be uncommented, and in the corresponding calls
> to getGoToPDFAction (2 lines below), "destination" must be replaced
> with "file".
> Otherwise, Jay's destinations (once fixed) will be fine but they won't
> ever be found by FOP-built external links.
>
>> The elements generated also look a little different than in 0.20.5,
>> and I'm not referring to the fact that currently we only reference
>> pages and not coordinates on pages.
>
> As to that: I will probably submit my basic-links patch tomorrow. It
> makes links and bookmarks land "on the spot". I'll also hook up the
> named destinations to that mechanism.

I think I mistakenly committed an interim step in the project, but I'll have 
to check.

Also, I meant to mention that I only extended fo:block to recognize a 
destination child object, so destinations only work on blocks (so far). That 
was a limitation that worked for my client, but I should have mentioned it.

Sorry, folks.

Jay Bryant
Bryant Communication Services 



Re: Destinations (was: Re: svn commit: r525078...)

Posted by Paul Vinkenoog <pa...@vinkenoog.nl>.
Hi jay,

> //String file = destination.substring(0, index + 4);
>
> I didn't add or comment out those lines, by the way, so I have no
> idea why those lines might have been commented out.

I know you didn't, because I'd been staring at them lines long before
you committed your destinations code. Sorry, I didn't mean to suggest
that this was your fault.


Kind regards,
Paul Vinkenoog

Re: Destinations (was: Re: svn commit: r525078...)

Posted by Jay Bryant <ja...@bryantcs.com>.
//String file = destination.substring(0, index + 4);


I didn't add or comment out those lines, by the way, so I have no idea why 
those lines might have been commented out.

Jay Bryant
Bryant Communication Services 



Re: Destinations (was: Re: svn commit: r525078...)

Posted by The Web Maestro <th...@gmail.com>.
Hi All,

On 4/7/07, Andreas L Delmelle <a_...@pandora.be> wrote:
> Could be a problem with either the browser or the plugin. Works fine
> if you use Safari and Adobe Reader 8.
>
> Cheers,
>
> Andreas

Agreed. It works in Safari 2.0.4 (via Adobe Reader Plugin) under Mac
OS X 10.4.9. Thanks for the clarification, Andreas!

However, the fact that it didn't work under Firefox (via Shubert's PDF
Browser plugin 2.0.1). I tried it again after updating to a newer
version of the PDF Browser Plugin (v2.2.3) and it works great!

Nice work, Jay!

Web Maestro Clay

-- 
Regards,

The Web Maestro
-- 
<th...@gmail.com> - <http://homepage.mac.com/webmaestro/>
My religion is simple. My religion is kindness.
- HH The 14th Dalai Lama of Tibet

Re: Destinations (was: Re: svn commit: r525078...)

Posted by Andreas L Delmelle <a_...@pandora.be>.
On Apr 7, 2007, at 08:56, The Web Maestro wrote:

Hi Clay,

> It didn't work for me (Mozilla 2.0.0.3; Mac OS X 10.4.9). I want it  
> to! :-)

Could be a problem with either the browser or the plugin. Works fine  
if you use Safari and Adobe Reader 8.


Cheers,

Andreas


Re: Destinations (was: Re: svn commit: r525078...)

Posted by The Web Maestro <th...@gmail.com>.
It didn't work for me (Mozilla 2.0.0.3; Mac OS X 10.4.9). I want it to! :-)

On 4/6/07, Jay Bryant <ja...@bryantcs.com> wrote:
> That was right. I have corrected it by making the following change to
> org.apache.fop.render.pdf.PDFRenderer: When the renderer processes a
> PDFDestination, it adds a PDFGoTo and makes the PDFDestination refer to the
> GoTo object.
>
> I've tested it on my web site. If you want to see it work, go to
> http://www.bryantcs.com/fop/test, open link-test.pdf, and click "Link test"
> (the only text on the page). It opens test.pdf to the second page because
> the destination named block2 is on the second page.
>
> Jay Bryant
> Bryant Communication Services

-- 
Regards,

The Web Maestro
-- 
<th...@gmail.com> - <http://homepage.mac.com/webmaestro/>
My religion is simple. My religion is kindness.
- HH The 14th Dalai Lama of Tibet

Re: Destinations (was: Re: svn commit: r525078...)

Posted by Paul Vinkenoog <pa...@vinkenoog.nl>.
Hi Jay,

> That was right. I have corrected it by making the following change
> to org.apache.fop.render.pdf.PDFRenderer: When the renderer
> processes a PDFDestination, it adds a PDFGoTo and makes the
> PDFDestination refer to the GoTo object.
>
> I've tested it on my web site. If you want to see it work, go to
> http://www.bryantcs.com/fop/test, open link-test.pdf, and click
> "Link test" (the only text on the page). It opens test.pdf to the
> second page because the destination named block2 is on the second
> page.

It works fine. But there's a problem if the target document contains
multiple fox-destinations and they don't happen to be created in
lexicographical order. If the /Limits are in the wrong order, most of
the destinations don't work.

I suppose this can be solved by making PDFdocument.destinations a
SortedSet instead of a List, and add a compareTo method to
PDFDestination which simply returns the compareTo result on the
respective idRefs.

This will also make sure that the PDFLimit's /Kids are ordered by
destination name (although you don't see those names in the /Kids
array).


Kind regards,
Paul Vinkenoog

Re: Destinations (was: Re: svn commit: r525078...)

Posted by Jay Bryant <ja...@bryantcs.com>.
> It's a small error: the PDFDestination class uses the reference to the
> page object as its goToReference. What it should use is a reference to
> a /Goto that jumps to the page in question.

That was right. I have corrected it by making the following change to 
org.apache.fop.render.pdf.PDFRenderer: When the renderer processes a 
PDFDestination, it adds a PDFGoTo and makes the PDFDestination refer to the 
GoTo object.

I've tested it on my web site. If you want to see it work, go to 
http://www.bryantcs.com/fop/test, open link-test.pdf, and click "Link test" 
(the only text on the page). It opens test.pdf to the second page because 
the destination named block2 is on the second page.

Jay Bryant
Bryant Communication Services 



Re: Destinations (was: Re: svn commit: r525078...)

Posted by Paul Vinkenoog <pa...@vinkenoog.nl>.
Hi all,

> Great addition, I agree, but is it supposed to work? I tried it out
> and although some new elements are generated in the PDF the
> destinations don't work.

It's a small error: the PDFDestination class uses the reference to the
page object as its goToReference. What it should use is a reference to
a /Goto that jumps to the page in question.

There's also something wrong with makeLink(Rectangle2D rect, String
destination, int linkType, float yoffset) in PDFFactory. The following
line is commented out twice:

 //String file = destination.substring(0, index + 4);

Both instances should be uncommented, and in the corresponding calls
to getGoToPDFAction (2 lines below), "destination" must be replaced
with "file".
Otherwise, Jay's destinations (once fixed) will be fine but they won't
ever be found by FOP-built external links.

> The elements generated also look a little different than in 0.20.5,
> and I'm not referring to the fact that currently we only reference
> pages and not coordinates on pages.

As to that: I will probably submit my basic-links patch tomorrow. It
makes links and bookmarks land "on the spot". I'll also hook up the
named destinations to that mechanism.


Kind regards,
Paul Vinkenoog