Bug 49379 - [PATCH] Enhancement to the include page segment functionality for AFP rendering
Summary: [PATCH] Enhancement to the include page segment functionality for AFP rendering
Status: CLOSED FIXED
Alias: None
Product: Fop - Now in Jira
Classification: Unclassified
Component: general (show other bugs)
Version: trunk
Hardware: All All
: P2 enhancement
Target Milestone: ---
Assignee: fop-dev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-03 11:46 UTC by Peter Hancock
Modified: 2012-03-28 06:32 UTC (History)
0 users



Attachments
Patch (31.64 KB, patch)
2010-06-03 11:47 UTC, Peter Hancock
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Hancock 2010-06-03 11:46:06 UTC
This patch facilitates the extraction and embedding of a page segment from a resource file into the generated AFP.  The include-page-segment extension element permits the optional attribute 'resource-file' that is the URI to the resource containing the named page segment.
Comment 1 Peter Hancock 2010-06-03 11:47:50 UTC
Created attachment 25519 [details]
Patch
Comment 2 Jeremias Maerki 2010-08-20 03:46:59 UTC
Peter, I've taken a look at your patch. I found that I get an IOException when referencing the page segment "s1islogo.psg" that comes with IBM AFP Workbench:

java.io.IOException: Malformed AFP resource with name 's1islogo':	No Begin structured field
at org.apache.fop.afp.util.AFPResourceUtil.copyNamedResource(AFPResourceUtil.java:123)

I have the impression that the method AFPResourceUtil.findStart() may not be ideal to parse an MO:DCA file. I haven't investigated more closely why the above file fails, but stepping through findStart() feels a bit weird in terms of how that method looks for the requested resource. Some time ago I started a rudimentary AFP parser I used to dump the Type 1 data from an outline font, or to simply dump the basic structure of an AFP file. I could include that in FOP and we build from there. It allows to return an object for each structured field encountered. A generic MO:DCA parser would also allow future functionality that involves parsing an AFP file. WDYT?
Comment 3 Jeremias Maerki 2010-10-07 03:48:24 UTC
Patch applied with modifications as discussed:
http://svn.apache.org/viewvc?rev=1005350&view=rev

Thanks, Peter, and sorry for the long time it took to process your patch!

BTW, while working on this it occurred to me that with the embedding functionality, we're actually making page segment handling overly complicated: we always need a replacement image that the layout image is actually working with. I'm not saying that this addition was a bad one, but we should think about making it easier in the future, namely by supporting AFP page segments directly through fo:external-graphic. The first step here would be native embedding support (just reading the intrinsic size of the page segment). A second step could even be decoding page segments and supporting them for other output formats. Just a thought.