Thanks Glenn, customer is happy :=> I am happy !

---markus---

On 15.03.2011, at 09:46, Glenn Adams wrote:

> Markus et al,
> 
> I have committed the extension described below to the pdf1.7 branch of 
> git://github.com/skynavga/fop.git, which is also up to date with the current 
> trunk.
> 
> This branch adds support for:
> controlling version of output PDF file using new pdf-version element in the 
> FOP configuration file
> augmenting the /Catalog dictionary object of the output PDF file by 
> specifying a pdf:catalog element child on fo:declarations
> augmenting a /Page dictionary object of the output PDF file by specifying one 
> or more pdf:page element children on fo:simple-page-master
> I have tested these to produce PDF files with page transitions, which is 
> accomplished by specifying pdf:page elements in order to define the /Dur 
> (duration) and /Trans (transition) entries of /Page dictionaries. Attached is 
> a test.fo.xml input FO file and the corresponding output PDF file. When 
> running FOP, I added a pdf-version element to the PDF renderer configuration 
> as follows:
> 
> <renderer mime="application/pdf">
>   <pdf-version>1.5</pdf-version>
>   ...
> </renderer>
> 
> The design goal for the pdf:catalog and pdf:page extension elements is to 
> provide a low level interface wherein one can add or replace dictionary 
> entries typed as boolean, dictionary, name, number, or string. Array entries 
> are not yet supported.
> 
> Additional details follow:
> 
> 1. the children of pdf:catalog and pdf:page elements are treated the same as 
> the children of pdf:dictionary;
> 
> 2. the children of pdf:dictionary may be any of the following in any order 
> and any number of instances:
> pdf:dictionary
> pdf:boolean
> pdf:number
> pdf:name
> pdf:string
> Each of these elements must specify a key attribute which determines the key 
> of the child's entry in the dictionary.
> 
> The #PCDATA content of the boolean, number, name, string elements is used to 
> specify the value of the associated entry.
> 
> An example of a dictionary is as follows:
> 
> <pdf:dictionary key="Trans">
>  <pdf:name key="Type">Trans</pdf:name>
>  <pdf:number key="D">1</pdf:number>
>  <pdf:name key="S">Push</pdf:name>
>  <pdf:number key="Di">180</pdf:number>
> </pdf:dictionary>
> 
> 3. the pdf:page element must specify a page-numbers attribute the value of 
> which takes the following syntax:
> 
> page-numbers : "*" | intervals
> intervals    : interval [ "," interval ]*
> interval     : start [end]
> start        : positive-integer
> end          : positive-integer | "LAST"       ; if integer, then end >= 
> start; end is inclusive
> 
> Examples of page number values:
> 
> *
> 2
> 1,3,5
> 1,4-10,13
> 3,5-LAST
> 
> 4. multiple  pdf:page elements may appear as children of 
> fo:simple-page-master, in which case dictionary entries specified in later 
> elements replace or augment those in earlier elements (in pre-traversal 
> order); for example, in the following example, the /Durentry of every page is 
> defined by the first pdf:page element, and the /Trans entry of pages 1 and 3 
> through 5 is defined by the second pdf:page element:
> 
> <pdf:page page-numbers="*" 
> xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf";>
>  <pdf:number key="Dur">5</pdf:number>
> </pdf:page>
> <pdf:page page-numbers="1,3-5" 
> xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf";>
>  <pdf:dictionary key="Trans">
>    <pdf:name key="Type">Trans</pdf:name>
>    <pdf:number key="D">1</pdf:number>     <!-- transition duration -->
>    <pdf:name key="S">Glitter</pdf:name>   <!-- transition style -->
>    <pdf:number key="Di">0</pdf:number>    <!-- transition style parameter -->
>  </pdf:dictionary>
> </pdf:page>
> 
> 5. at this time, no validation checking is done to determine if the entries 
> to be added to PDF catalog or page objects conform to any particular version 
> of the PDF specification; however, attempts to use this mechanism to replace 
> any of the following catalog or page entries is (silently) disallowed:
> /Catalog
> /Pages
> /Type
> /Page
> /Count
> /Kids
> /Type
> 6. attached to this email is an excerpt from ISO/IEC 32000, which defines the 
> /Dur and /Trans entries of a /Page object in PDF 1.7 and prior versions; if a 
> /Trans entry does not specify a version number, then it is (supposedly) 
> supported by PDF 1.1 and later; you can use the information in Table 162 of 
> the attachment to determine the transition dictionary entries of interest, 
> and the necessary version number to specify in the FOP configuration file;
> 
> 7. at this time I have tested the output PDF file with transitions on Adobe 
> Reader 9.4.0 on WinXP and the Preview application on MacOS 10.6.5; it appears 
> to work as expected in the former, when using full screen mode (CTRL-L) from 
> Reader; however, transitions appear to have no effect on the latter 
> (Preview), which makes me wonder if Apple supports page transitions in 
> Preview;
> 
> Regards,
> Glenn
> 
> 
> 
> On Mon, Mar 14, 2011 at 12:09 PM, Glenn Adams <[email protected]> wrote:
> I've been working in the background on a patch that adds support for using 
> newer PDF features, including page transitions and option groups, and in this 
> work defined an new element in the FOP CONF file as follows to specify the 
> PDF output version:
> 
> <?xml version="1.0"?>
> <fop version="1.0">
>   <source-resolution>300</source-resolution>
>   <target-resolution>300</target-resolution>
>   <base14-kerning>true</base14-kerning>
>   <renderers>
>     <renderer mime="application/pdf">
>       <pdf-version>1.5</pdf-version>
>       <filterList>
>       <value>flate</value>
>       </filterList>
>       <fonts>
>       <auto-detect/>
>       </fonts>
>     </renderer>
>     <renderer mime="text/xml">
>       <fonts>
>       <base14-kerning>true</base14-kerning>
>       </fonts>
>     </renderer>
>   </renderers>
> </fop>
> 
> Here is an example of the extensions I used to specify a page transition:
> 
> <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format";>
>   <fo:layout-master-set>
>     <fo:simple-page-master master-name="simple" page-height="3in" 
> page-width="5in" margin-top="1cm" margin-bottom="1cm" margin-left="1cm" 
> margin-right="1cm">
>       <fo:region-body margin-top="1cm"/>
>       <fo:region-before extent="1cm"/>
>       <fo:region-after extent="1cm"/>
>       <pdf:page page-numbers="*" 
> xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf";>
>         <pdf:number key="Dur">5</pdf:number>
>       </pdf:page>
>       <pdf:page page-numbers="1" 
> xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf";>
>       <pdf:dictionary key="Trans">
>           <pdf:name key="Type">Trans</pdf:name>
>           <pdf:number key="D">1</pdf:number>
>           <pdf:name key="S">Glitter</pdf:name>
>           <pdf:number key="Di">0</pdf:number>
>       </pdf:dictionary>
>       </pdf:page>
>       <pdf:page page-numbers="2" 
> xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf";>
>       <pdf:dictionary key="Trans">
>           <pdf:name key="Type">Trans</pdf:name>
>           <pdf:number key="D">1</pdf:number>
>           <pdf:name key="S">Push</pdf:name>
>           <pdf:number key="Di">180</pdf:number>
>       </pdf:dictionary>
>       </pdf:page>
>       <pdf:page page-numbers="3" 
> xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf";>
>       <pdf:dictionary key="Trans">
>           <pdf:name key="Type">Trans</pdf:name>
>           <pdf:number key="D">1</pdf:number>
>           <pdf:name key="S">Cover</pdf:name>
>           <pdf:number key="Di">270</pdf:number>
>       </pdf:dictionary>
>       </pdf:page>
>     </fo:simple-page-master>
>   </fo:layout-master-set>
>   <fo:page-sequence master-reference="simple">
>     <fo:flow flow-name="xsl-region-body">
>     ... 3 pages of content...
>     </fo:flow>
>   </fo:page-sequence>
> </fo:root>
> 
> Basically I use the above to explicitly extend the PDF Page dictionary for 
> indicated pages. I based this work in part on an earlier patch (not yet 
> integrated) that took a similar approach to extending the generated 
> dictionaries.
> 
> I'll try to post a patch for this work in a few days in case someone is 
> interested in trying it out.
> 
> Glenn
> 
> On Mon, Mar 14, 2011 at 8:12 AM, Eric Douglas <[email protected]> wrote:
> PDF readers should be backward compatible.
> AFAIK there's no reason to write a newer version number unless a newer
> version adds a feature you need.
> 
> 
> -----Original Message-----
> From: mehdi houshmand [mailto:[email protected]]
> Sent: Monday, March 14, 2011 10:10 AM
> To: [email protected]
> Subject: Re: PDF version specification
> 
> Hi Markus,
> 
> Unfortunately looking at the code, the PDF version (1.4) is hard-coded.
> This is presumably because FOP doesn't support any of the features of
> subsequent versions, though I'm sure someone in the community will be
> able to tell you the exact reasons for this.
> 
> You may be able to change this to 1.6, but either someone else in the
> community will be able to help you out there, or I'd suggest looking at
> the PDF spec, if PDF is backward compatible you can change the version
> with impunity. The PDF version is set in o.a.f.pdf.PDFDocument line 103.
> You'll probably have to do something to PDFProfile and add an extra case
> in PDFDocument.getPDFVersionString(). But that shouldn't be too
> difficult, that is of-course if there aren't any calamitous affects to
> do with the PDF spec, which I sadly lack knowledge in.
> 
> Hope that helps,
> 
> Mehdi
> 
> On 14 March 2011 13:46, Markus Ruggiero <[email protected]>
> wrote:
> > When I generate a simple PDF from within my Java app the resulting PDF
> file says PDF Version 1.4. My customer talks about going to PDF version
> 1.6 or higher. Is this something I have to explicitly set? Where would I
> do this? My tests are based on FOP 1.0 and the simple embedding examples
> from the xmlgraphics website.
> >
> > Thanks for any enlightening
> > ---markus---
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [email protected]
> > For additional commands, e-mail: [email protected]
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 
> 
> 
> <test.fo.xml><test.pdf><pdf1.7-page-transitions.pdf>

Reply via email to