Re: [xsl] xsl fo - problem opening pdf file

Subject: Re: [xsl] xsl fo - problem opening pdf file
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Wed, 14 May 2003 13:06:53 -0400

Let me reflect back to you what I *think* your situation is, so if I miss the mark you'll understand that (and we can avoid further confusion). If I'm correct, maybe my comments will be helpful....

At 06:48 PM 5/13/2003, you wrote:
I am using saxon and IE6.0

From this I infer you are (a) using Saxon for development and stylesheet-testing purposes, and (b) IE6.0 to process the same source with the same stylesheet in the browser.

    I have a link on my page. When the user clicks on
the link, it is supposed to open a pdf file in a new

Meaning, I take it, that "a pdf file must be generated, and opened in a new window".

What you don't say is whether you expect this pdf file to be created on a web server and delivered, as PDF, to the user (to be opened in a new window), or whether you expect an XML document to be delivered to the user's browser, which will perform the transformation and open the resulting PDF in a new window.

I'm guessing, from the behavior you describe, that you expect the latter -- the web server will deliver XML (what kind of file is named by the link?) and IE will do the transform to create PDF.

If that's the case, you're out of luck. This just isn't the way IE works. It doesn't perform arbitrary transformations into any format you want, then open the appropriate application to handle the result of the transform. The only way to get IE to display anything at all is to use format it knows how to read (it can handle raw XML with CSS, and it can handle and XML->HTML transform and display the resulting HTML); nor does it do any "creating of files" at all when it does this (at least not that the developer has access to). So if given an XML file to transform into something other than HTML, it's going to gag -- which is what it's doing.

Generally speaking, developers who are delivering PDF over the net from XML, are performing their transformations on the server. This process can be engineered to be a black box to the web browser: it asks for PDF and gets back PDF, and never knows that file was generated only when requested. To do this, however, you need not client-side technology (such as IE), but technology on the server (Saxon or Xalan in a Java framework; a .NET framework...), including an XSL-FO implementation (that is, a piece of software that knows how to make PDF files out of the XSL formatting objects that result from your transformation).

This could change if/when browser technology were integrated with an XSL-FO engine. Imagine, if you will, that Adobe Acrobat had XSL support, including not only a transformation engine that knew what to do with XSL stylesheets (analogous to Saxon or MSXML) but also an XSL-FO formatter (which neither Saxon nor MSXML have), which would take the results of an FO transform, map the formatting objects to Acrobat's internals (possibly but not necessarily serializing a PDF "file" along the way) and display the result. In such a case, your user could point Acrobat at an XML file, and assuming it called in an XSL-FO stylesheet, she or he would see "PDF". Currently, AFAIK there are no such browsers available (though one or two of the XSL-FO engines could be coming close).

For now -- again, assuming I'm rightly diagnosing your problem -- you may have to look into how to perform the PDF conversion on the server.

I hope that helps,

    "Thus I make my own use of the telegraph, without consulting
     the directors, like the sparrows, which I perceive use it
     extensively for a perch." -- Thoreau

XSL-List info and archive:

Current Thread