Links to an external PDF file from XSL FO

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Links to an external PDF file from XSL FO

Kenbla
Hello, I'm creating a PDF file using XSL FO, this PDF file contains links to other PDF files. I have used a basic-link and external-destination command from XSL FO but I can't get it to work!
It works fine as long as the linked PDF file is in the same folder as the XSL FO created PDF file! This is not the case though, the PDF files I try to link to (open) exists on a different server. Let's call it: DBX\PRODUCTION\MyPDFfile.pdf.
How do I link to that specific server and file? I have tried a number of ways but the file doesn't open!
Any help is greatly appreciated.
Regards,
Kenbla
Reply | Threaded
Open this post in threaded view
|

Re: Links to an external PDF file from XSL FO

G. Ken Holman
At 2011-10-20 23:18 -0700, Kenbla wrote:
>Hello, I'm creating a PDF file using XSL FO, this PDF file contains links to
>other PDF files. I have used a basic-link and external-destination command
>from XSL FO but I can't get it to work!
>It works fine as long as the linked PDF file is in the same folder as the
>XSL FO created PDF file! This is not the case though, the PDF files I try to
>link to (open) exists on a different server. Let's call it:
>DBX\PRODUCTION\MyPDFfile.pdf.
>How do I link to that specific server and file?

By pointing to it precisely.  I suspect you do not have a correct URI
that points to your file.

The following creates a PDF that points to a file on a different
server and creating a PDF opens just fine in a browser window (attached):

<?xml version="1.0" encoding="US-ASCII"?><!--kenbla.fo-->
<root xmlns="http://www.w3.org/1999/XSL/Format"
       font-family="Times" font-size="20pt">

   <layout-master-set>
     <simple-page-master master-name="frame"
                         page-height="297mm" page-width="210mm"
                         margin-top="15mm" margin-bottom="15mm"
                         margin-left="15mm" margin-right="15mm">
       <region-body region-name="frame-body"/>
     </simple-page-master>
   </layout-master-set>

   <page-sequence master-reference="frame">
     <flow flow-name="frame-body">
       <block>
         Click <basic-link
external-destination='url("http://docs.oasis-open.org/ubl/os-UBL-2.0/UBL-2.0.pdf")'
text-decoration="underline">here</basic-link>
       </block>
     </flow>
   </page-sequence>
</root>

>I have tried a number of ways but the file doesn't open!

Addressing a file in your local system will open the file in the PDF
reader.  Pointing to the file using http:// will open the file in the
PDF reader in a browser window.

>Any help is greatly appreciated.

I hope the above helps.

. . . . . . . . . Ken

--
Contact us for world-wide XML consulting and instructor-led training
Crane Softwrights Ltd.            http://www.CraneSoftwrights.com/f/
G. Ken Holman                   mailto:[hidden email]
Google+ profile: https://plus.google.com/116832879756988317389/about
Legal business disclaimers:    http://www.CraneSoftwrights.com/legal

kenbla.pdf (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Links to an external PDF file from XSL FO

Kenbla
Thanks a lot for your reply!
Now I have another question! I need to create the content of the "External-destination" programmatically with information from my XML file! I want to concatenate a couple of node values and some hardocded values as well. Is that possible? I want it to look something like this:
external-destination=Concat(nodevalue1, nodevalue2, '.pdf')
but this doesn't work. How do I achieve what I want?
Thanks!
/Kenbla
G. Ken Holman wrote
At 2011-10-20 23:18 -0700, Kenbla wrote:
>Hello, I'm creating a PDF file using XSL FO, this PDF file contains links to
>other PDF files. I have used a basic-link and external-destination command
>from XSL FO but I can't get it to work!
>It works fine as long as the linked PDF file is in the same folder as the
>XSL FO created PDF file! This is not the case though, the PDF files I try to
>link to (open) exists on a different server. Let's call it:
>DBX\PRODUCTION\MyPDFfile.pdf.
>How do I link to that specific server and file?

By pointing to it precisely.  I suspect you do not have a correct URI
that points to your file.

The following creates a PDF that points to a file on a different
server and creating a PDF opens just fine in a browser window (attached):

<?xml version="1.0" encoding="US-ASCII"?>
<root xmlns="http://www.w3.org/1999/XSL/Format"
       font-family="Times" font-size="20pt">

   <layout-master-set>
     <simple-page-master master-name="frame"
                         page-height="297mm" page-width="210mm"
                         margin-top="15mm" margin-bottom="15mm"
                         margin-left="15mm" margin-right="15mm">
       <region-body region-name="frame-body"/>
     </simple-page-master>
   </layout-master-set>

   <page-sequence master-reference="frame">
     <flow flow-name="frame-body">
       <block>
         Click <basic-link
external-destination='url("http://docs.oasis-open.org/ubl/os-UBL-2.0/UBL-2.0.pdf")' 
text-decoration="underline">here</basic-link>
       </block>
     </flow>
   </page-sequence>
</root>

>I have tried a number of ways but the file doesn't open!

Addressing a file in your local system will open the file in the PDF
reader.  Pointing to the file using http:// will open the file in the
PDF reader in a browser window.

>Any help is greatly appreciated.

I hope the above helps.

. . . . . . . . . Ken
 

--
Contact us for world-wide XML consulting and instructor-led training
Crane Softwrights Ltd.            http://www.CraneSoftwrights.com/f/
G. Ken Holman                   mailto:gkholman@CraneSoftwrights.com
Google+ profile: https://plus.google.com/116832879756988317389/about
Legal business disclaimers:    http://www.CraneSoftwrights.com/legal
Reply | Threaded
Open this post in threaded view
|

Re: Links to an external PDF file from XSL FO

G. Ken Holman
At 2011-10-25 07:18 -0700, Kenbla wrote:

>Thanks a lot for your reply!
>Now I have another question! I need to create the content of the
>"External-destination" programmatically with information from my XML file! I
>want to concatenate a couple of node values and some hardocded values as
>well. Is that possible? I want it to look something like this:
>external-destination=Concat(nodevalue1, nodevalue2, '.pdf')

external-destination="{concat(ndoevalue1, nodevalue2, '.pdf')}"

>but this doesn't work. How do I achieve what I want?

Brace brackets inside of an attribute form an attribute value
template, the contents of which are an XPath expression just like an
<xsl:value-of>.

An equivalent in XSLT 1.0 is:

   <basic-link>
     <xsl:attribute name="external-destination">
       <xsl:value-of select="concat(ndoevalue1, nodevalue2, '.pdf')"/>
     </xsl:attribute>
   </basic-link>

An equivalent in XSLT 2.0 is:

   <basic-link>
     <xsl:attribute name="external-destination"
                    select="concat(ndoevalue1, nodevalue2, '.pdf')"/>
   </basic-link>

I have a book on XSLT (v1.0 and V2.0) and a book on XSL-FO (v1.0 and
v1.1) available for free download trial preview on my web site linked
in my trailer below.  You may find those books helpful.

I hope the above helps as well.

. . . . . . . . . Ken


--
Contact us for world-wide XML consulting and instructor-led training
Crane Softwrights Ltd.            http://www.CraneSoftwrights.com/f/
G. Ken Holman                   mailto:[hidden email]
Google+ profile: https://plus.google.com/116832879756988317389/about
Legal business disclaimers:    http://www.CraneSoftwrights.com/legal