Bug 45390 - PDF Extensions - Prototype
Summary: PDF Extensions - Prototype
Status: NEW
Alias: None
Product: Fop - Now in Jira
Classification: Unclassified
Component: general (show other bugs)
Version: trunk
Hardware: All All
: P3 normal
Target Milestone: ---
Assignee: fop-dev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-07-13 14:26 UTC by Andreas L. Delmelle
Modified: 2012-04-07 01:51 UTC (History)
1 user (show)



Attachments
prototype implementation for pdf:dictionary + pdf:entry (19.40 KB, patch)
2008-07-13 14:26 UTC, Andreas L. Delmelle
Details | Diff
Updated patch (22.49 KB, patch)
2008-07-15 14:29 UTC, Andreas L. Delmelle
Details | Diff
updated prototype; some more experimenting... (23.88 KB, patch)
2008-07-20 01:09 UTC, Andreas L. Delmelle
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas L. Delmelle 2008-07-13 14:26:22 UTC
Created attachment 22249 [details]
prototype implementation for pdf:dictionary + pdf:entry

The attached patch contains a working prototype implementation for PDF extension objects, as discussed on http://wiki.apache.org/xmlgraphics-fop/ExtensionsForPdf.

There's still quite some unfinished business there, but it should suffice to give interested parties a starting-point (no idea when I'll be able to spend more time on this).

After applying the patch, Jiri Tyr's requirement can be met by adding:

<pdf:dictionary type="catalog" xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
  <pdf:entry name="PageMode">FullScreen</pdf:entry>
</pdf:dictionary>

basically anywhere in the document (I think; I've only tried specifying it as a descendant of fo:root).
Comment 1 Andreas L. Delmelle 2008-07-15 14:29:23 UTC
Created attachment 22261 [details]
Updated patch


Added minimal support for subdictionaries and boolean entries, so the following now becomes possible:

  <pdf:dictionary type="catalog" xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
    <pdf:entry name="PageMode" type="name">FullScreen</pdf:entry>
    <pdf:dictionary type="normal" name="ViewerPreferences">
      <pdf:entry name="HideToolbar" type="boolean">true</pdf:entry>
      <pdf:entry name="HideWindowUI" type="boolean">true</pdf:entry>
      <pdf:entry name="FitWindow" type="boolean">true</pdf:entry>
      <pdf:entry name="CenterWindow" type="boolean">true</pdf:entry>
      <pdf:entry name="NonFullScreenPageMode" type="name">UseThumbs</pdf:entry>
    </pdf:dictionary>
  </pdf:dictionary>
Comment 2 Andreas L. Delmelle 2008-07-20 01:09:29 UTC
Created attachment 22286 [details]
updated prototype; some more experimenting...


The patch in attach disables processing of the extension in case PDF/A or PDF/X conformance is active. Better safe than sorry. For users that really don't mind the risk, we could still add a config option to override this.

On another note, adding a quick-and-dirty implementation for simple PDF strings already allows adding some JavaScript as an OpenAction...

Most complete example I tested so far:

  <pdf:dictionary type="catalog" xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
    <pdf:name key="PageMode">FullScreen</pdf:name>
    <pdf:dictionary type="normal" key="ViewerPreferences">
      <pdf:boolean key="HideToolbar">true</pdf:boolean>
      <pdf:boolean key="HideWindowUI">true</pdf:boolean>
      <pdf:boolean key="FitWindow">true</pdf:boolean>
      <pdf:boolean key="CenterWindow">true</pdf:boolean>
      <pdf:name key="NonFullScreenPageMode">UseThumbs</pdf:name>
      <pdf:name key="PrintScaling">None</pdf:name>
    </pdf:dictionary>
    <pdf:dictionary type="normal" key="OpenAction">
      <pdf:name key="Type">Action</pdf:name>
      <pdf:name key="S">JavaScript</pdf:name>
      <pdf:string key="JS">this.print(false,0,this.numPages-1);</pdf:string>
    </pdf:dictionary>
  </pdf:dictionary>

The JavaScript was borrowed from Bugzilla #12610, which also attempted to address this.

I'd say it's about time to look into adding some basic validation, shaving off the rough edges (!!serialization!!), and adding some documentation and testcases.
Comment 3 Glenn Adams 2012-04-07 01:42:16 UTC
resetting P2 open bugs to P3 pending further review