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 Mathieu Malaterre <ma...@gmail.com> on 2010/07/12 14:56:33 UTC
PDF output: fragment identifier working ?
Hi there,
I am trying to link one PDF to another PDF. If I use the following:
$ cat foo.fo
...
<fo:basic-link external-destination="bla.pdf"
show-destination="replace">bla</fo:basic-link>
...
Then I can open the the foo.pdf file and properly click on the 'bla'
link. However if I try to use fragment identifier like this:
<fo:basic-link external-destination="bla.pdf#id"
show-destination="replace">bla at index: id</fo:basic-link>
Then acroread try to open a link from firefox...
Could someone please let me know what is the proper syntax for linking
to specific fragment identifier from pdf to another pdf ?
Thanks !
--
Mathieu
Using: fop 0.95
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
Re: PDF output: fragment identifier working ?
Posted by Andreas Delmelle <an...@telenet.be>.
On 14 Feb 2011, at 08:42, kuma wrote:
Hi
> I am having this problem where I am generating a pdf file with links to specific
> pages of another pdf file using Java FOP. Somehow when i click on the link
> rather than going to that page(lets say page=3), it goes to the next higher
> page(say page 4).
<snip />
>
> Here is the code(not the whole code, but related to the page linking issue) in
> my .xsl:
Sorry, but in order to be able to judge whether this is a FOP issue, we need to see the *FO*. That is, the result of applying this XSL code to the input XML.
Have you verified that the generated link actually points to the correct page?
Regards,
Andreas
---
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
Re: PDF output: fragment identifier working ?
Posted by kuma <ki...@gmail.com>.
Jeremias Maerki <dev <at> jeremias-maerki.ch> writes:
>
> Hi Mathieu
>
> Hmm, that doesn't seem to be well documented.
>
> external-destination="url(my.pdf#dest=chapter1)"
> ...gets you to the named destination "chapter1" in my.pdf.
>
> external-destination="url(my.pdf#page=7)"
> ...gets you to page 7 in my.pdf.
>
> Details in org.apache.fop.pdf.PDFFactory.getExternalAction(String, boolean)
>
> Info on how to create a named destination with FOP:
> http://xmlgraphics.apache.org/fop/latest/extensions.html#named-destinations
>
> On 12.07.2010 14:56:33 Mathieu Malaterre wrote:
> > Hi there,
> >
> > I am trying to link one PDF to another PDF. If I use the following:
> >
> > $ cat foo.fo
> > ...
> > <fo:basic-link external-destination="bla.pdf"
> > show-destination="replace">bla</fo:basic-link>
> > ...
> >
> > Then I can open the the foo.pdf file and properly click on the 'bla'
> > link. However if I try to use fragment identifier like this:
> >
> > <fo:basic-link external-destination="bla.pdf#id"
> > show-destination="replace">bla at index: id</fo:basic-link>
> >
> > Then acroread try to open a link from firefox...
> >
> > Could someone please let me know what is the proper syntax for linking
> > to specific fragment identifier from pdf to another pdf ?
> >
> > Thanks !
> > --
> > Mathieu
> > Using: fop 0.95
> >
>
> Jeremias Maerki
>
Hi,
I am having this problem where I am generating a pdf file with links to specific
pages of another pdf file using Java FOP. Somehow when i click on the link
rather than going to that page(lets say page=3), it goes to the next higher
page(say page 4). Also if i click on a link which takes me to either last or
last-but-one page of the other pdf, the next link is taking me to expected page
+2 pages. After that its taking 1 page higher.
The actual pdf file is being created from an excel file where the key words for
linkign to this pther pdf file are as follows:
CRF Page 3 (for single page linking)
CRF Pages 5, 6, 10 (Multiple page linking)
Here is the code(not the whole code, but related to the page linking issue) in
my .xsl:
First part of code:
<xsl:when test="contains($itemDef/@Origin,'CRF Pages')">
<xsl:value-of select="substring-
before($itemDef/@Origin,'CRF Pages ')"/>
<xsl:text> CRF Pages </xsl:text>
<xsl:call-template name="crfpage">
<xsl:with-param name="pages"
select="concat(substring-after($itemDef/@Origin,'CRF Pages '),',')"/>
</xsl:call-template>
</xsl:when>
<xsl:when
test="contains($itemDef/@Origin,'CRF Page ')">
<xsl:value-of select="substring-
before($itemDef/@Origin,'CRF Page ')"/>
<xsl:text>CRF Page </xsl:text>
<xsl:call-template name="crfpage">
<xsl:with-param name="pages"
select="concat(substring-after($itemDef/@Origin,'CRF Page '),',')"/>
</xsl:call-template>
</xsl:when>
Second part of the code:
<xsl:template name="crfpage">
<xsl:param name="pages"/>
<xsl:variable name="first-page" select="substring-before($pages,',')"/>
<xsl:variable name="rest-of-pages" select="substring-after($pages,',
')"/>
<xsl:if test="/odm:ODM/odm:Study/odm:MetaDataVersion/def:AnnotatedCRF">
<xsl:for-each
select="/odm:ODM/odm:Study/odm:MetaDataVersion/def:AnnotatedCRF/def:DocumentRef"
>
<xsl:variable name="leafIDs" select="@leafID"/>
<xsl:variable name="leaf"
select="../../def:leaf[@ID=$leafIDs]"/>
<fo:inline font-weight="bold">
<xsl:variable name="pdfLink"
select="concat('CRF_PATH','#page=',$first-page)"/>
<fo:basic-link text-decoration="underline" color="blue"
show-destination="new" external-destination="url('CRF_PATH#page={$first-
page}')">
<xsl:value-of select="$first-page"/>
</fo:basic-link>
</fo:inline>
</xsl:for-each>
</xsl:if>
<xsl:if test="$rest-of-pages">
<xsl:text>, </xsl:text>
<xsl:call-template name="crfpage">
<xsl:with-param name="pages" select="$rest-of-pages"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
Thanks
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
Re: PDF output: fragment identifier working ?
Posted by Mathieu Malaterre <ma...@gmail.com>.
Jeremias,
Thanks a bunch !
So just for reference. If you are doing some docbook -> fo
generation. The output fo (from docbook 1.75) is slightly incorrect.
You actually need to add:
<fox:destination
xmlns:fox="http://xmlgraphics.apache.org/fop/extensions"
internal-destination="chapter1"/>
right after a <fo:block/> (anywhere in the document seems to be fine).
And then on the other side, you need to patch the link
<fo:basic-link show-destination="replace"
external-destination="my.pdf#chapter1">Managing
into
<fo:basic-link show-destination="replace"
external-destination="url(my.pdf#dest=chapter1)">Managing
All is left to do...is try to automated that directly within docbook...
Thanks !
Ref:
http://www.mail-archive.com/fop-dev@xmlgraphics.apache.org/msg06568.html
On Mon, Jul 12, 2010 at 4:42 PM, Jeremias Maerki <de...@jeremias-maerki.ch> wrote:
> Hi Mathieu
>
> Hmm, that doesn't seem to be well documented.
>
> external-destination="url(my.pdf#dest=chapter1)"
> ...gets you to the named destination "chapter1" in my.pdf.
>
> external-destination="url(my.pdf#page=7)"
> ...gets you to page 7 in my.pdf.
>
> Details in org.apache.fop.pdf.PDFFactory.getExternalAction(String, boolean)
>
> Info on how to create a named destination with FOP:
> http://xmlgraphics.apache.org/fop/latest/extensions.html#named-destinations
>
> On 12.07.2010 14:56:33 Mathieu Malaterre wrote:
>> Hi there,
>>
>> I am trying to link one PDF to another PDF. If I use the following:
>>
>> $ cat foo.fo
>> ...
>> <fo:basic-link external-destination="bla.pdf"
>> show-destination="replace">bla</fo:basic-link>
>> ...
>>
>> Then I can open the the foo.pdf file and properly click on the 'bla'
>> link. However if I try to use fragment identifier like this:
>>
>> <fo:basic-link external-destination="bla.pdf#id"
>> show-destination="replace">bla at index: id</fo:basic-link>
>>
>> Then acroread try to open a link from firefox...
>>
>> Could someone please let me know what is the proper syntax for linking
>> to specific fragment identifier from pdf to another pdf ?
>>
>> Thanks !
>> --
>> Mathieu
>> Using: fop 0.95
>>
>
>
> Jeremias Maerki
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>
>
--
Mathieu
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
Re: PDF output: fragment identifier working ?
Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
Hi Mathieu
Hmm, that doesn't seem to be well documented.
external-destination="url(my.pdf#dest=chapter1)"
...gets you to the named destination "chapter1" in my.pdf.
external-destination="url(my.pdf#page=7)"
...gets you to page 7 in my.pdf.
Details in org.apache.fop.pdf.PDFFactory.getExternalAction(String, boolean)
Info on how to create a named destination with FOP:
http://xmlgraphics.apache.org/fop/latest/extensions.html#named-destinations
On 12.07.2010 14:56:33 Mathieu Malaterre wrote:
> Hi there,
>
> I am trying to link one PDF to another PDF. If I use the following:
>
> $ cat foo.fo
> ...
> <fo:basic-link external-destination="bla.pdf"
> show-destination="replace">bla</fo:basic-link>
> ...
>
> Then I can open the the foo.pdf file and properly click on the 'bla'
> link. However if I try to use fragment identifier like this:
>
> <fo:basic-link external-destination="bla.pdf#id"
> show-destination="replace">bla at index: id</fo:basic-link>
>
> Then acroread try to open a link from firefox...
>
> Could someone please let me know what is the proper syntax for linking
> to specific fragment identifier from pdf to another pdf ?
>
> Thanks !
> --
> Mathieu
> Using: fop 0.95
>
Jeremias Maerki
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org