This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Insert PDF file


> > Eric.Reiter@ic.lu wrote:
> > > I have a XML file with a tag <doc>str.pdf</doc>, in which
> > srt.pdf is a file.
> > >
> > > When i transform this XML into PDF (with FOP), i would that the
> > > <doc>str.pdf</doc> would be replaced by the PDF file str.pdf.
> > >
> > > How can i do that?

I think you can do this by converting the PDF into a full-page EPS and
including that, but that would definitely require either an outside
process or an extension function to do it as part of the XSLT process. I
haven't experimented with this, but I'm sure it's possible--worst case
you would use Acrobat to print the pages you want back to Postscript and
then use some utility to make those pages into EPS files--an EPS file is
just normal Postscript with a bit of encapsulation around it so it can
be placed in the context of other Postscript data. The EPS syntax is
well documented in the Acrobat specs (available from the Adobe site).
[For example, it only took me a little while (a couple of hours) to
write Java code that can parse out or add a TIFF image header to an EPS
file (and most of that was remembering how to do byte-stream I/O in Java
:-).]

But it's definitely not possible to simply concatenate PDFs
together--the internal format of PDFs depends entirely on tables of byte
offsets. But, it's not too hard to write code that will combine pages
from different PDFs to make a new one, but that would be after the fact.

I suppose another solution would be to write out place-holder pages in
the main PDF that could be interpreted as references to the included PDF
to be included by a post-process. The post process could then replace
the placeholder pages with the included pages--the only issue there
would be fonts--the included PDFs might require fonts that aren't
required by the main PDF, but that's solvable as well.

See the PJ library (www.etymon.com) for an open-source Java library that
enables this sort of PDF processing. Of course, you can also use the
Adobe PDF library if you have a license for it.

Cheers,

Eliot
-- 
W. Eliot Kimber, eliot@isogen.com
Consultant, ISOGEN International

1016 La Posada Dr., Suite 240
Austin, TX  78752 Phone: 512.656.4139

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]