W3C home > Mailing lists > Public > www-xsl-fo@w3.org > June 2006

Bookmark Problem

From: Kirthi Raman <innovatn@cox.net>
Date: Fri, 9 Jun 2006 18:25:45 -0400
Message-ID: <002301c68c13$a6806f20$0202a8c0@SIDDHIINCLAP2>
To: <www-xsl-fo@w3.org>
Hi,
   I have been using FOP (version 0.20.5) on Windows and the following example does generate PDF but the bookmark looks jibberish.  Can anyone help.

<!-- ------------------------------------- Example  -------------------------------------- --->

<?xml version="1.0" encoding="UTF-8"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"
         xmlns:fox="http://xml.apache.org/fop/extensions"> 
 <fo:layout-master-set>
   <fo:simple-page-master page-width="21cm" page-height="29.7cm" master-name="A4">
     <fo:region-body margin-bottom="1.5cm" margin-right="2cm" margin-left="2cm" margin-top="1.5cm"/>
     <fo:region-before extent="1cm"/>
      <fo:region-after extent="1.5cm"/>
   </fo:simple-page-master>
 </fo:layout-master-set>
 
  <fox:outline internal-destination="sec3">
    <fox:label>Running FOP</fox:label>
    <fox:outline internal-destination="sec3-1">
      <fox:label>Prerequisites</fox:label>
    </fox:outline>
  </fox:outline>

 <fo:page-sequence master-reference="A4">
      <fo:static-content flow-name="xsl-region-before">
      <fo:block line-height="24pt" font-size="10pt"
    text-align="center">National Library Of Medicine Classification  </fo:block>
    </fo:static-content>
    <fo:static-content flow-name="xsl-region-after">
      <fo:block line-height="14pt" font-size="10pt"
    text-align="center"><fo:page-number/></fo:block>
    </fo:static-content>
  <fo:flow flow-name="xsl-region-body">
  <fo:block id="sec3">Begin</fo:block>
  
  <fo:block>
   Deliberately copied something from internet here just to test the content flow.
   
   I have been having a problem in my environment where PDFs generated
dynamically by FOP running in a servlet were not rendered properly in M$ IE
5. It was discovered that large PDFs (> 8k) displayed properly, but small
ones did not display at all. Further discussion on the list suggested that
IE requires that either the content-length be set or the data sent HTTP
chunked. I do not like having to store a potentially quite large PDF just so
that I can find out how big it is to set the header. So I tried implementing
an HTTP Chunked OutputStream. This was not too difficult to do and it kind
of works, except that in my testing I found that even with the chunked
output, small  PDFs STILL DO NOT DISPLAY IN IE5! I then changed the
chunked output stream to use an 8k buffer to build the chunks. If the output
is closed before the buffer is filled the first time then I just set the
content-length header and send the contents of the buffer non-chunked. If
there is more output after the buffer has been filled then the data is sent
chunked. So far this seems to be working, but I have not tested it
rigorously. I also understand that since this requires HTTP 1.1 it may not
work in the general case.

I present this information in the hopes that it will be helpful to someone.
I do not think that FOP should attempt to include chunked output capability.
It should write to a stream - the stream implementation determined by the
external application. For anyone interested in doing the same thing, there
are a few chunked stream implementations out there - or you could write your
own. My implementation is kind of limited and not well tested, so I am not
willing to make it available at this point. Maybe I will reconsider after I
have done more testing - but at the moment I am preoccupied with migrating
my application to XalanJ2 from XalanJ1 and have not been able to look at FOP
or output related things for a while.

  </fo:block>
  <fo:block id="sec3-1">Testing</fo:block>
  </fo:flow>
  </fo:page-sequence>
  
</fo:root>
Received on Saturday, 10 June 2006 05:51:28 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 3 October 2007 16:06:13 GMT