include PDF file in Docbook 5 print output

Oxygen general issues.
typesetcmb
Posts: 2
Joined: Thu Jul 11, 2013 11:54 am

include PDF file in Docbook 5 print output

Post by typesetcmb »

I am working on a handbook, and I want to include some forms. The forms are PDF files.

I've been able to import images (jpg) files into the handbook, but have not been able to find how to import/include an existing PDF file into the process, so that it appears in the print version of the file.

I've searched the help and forums, but haven't found an answer to this. I'm sure it is possible, and probably quite simple, if one knows the correct command/syntax.

One idea I tried was to convert the PDF to a jpg, then import it as I did the other images. This worked, but it seemed there must be an easier way to handle PDFs.

Thanks.

Brian

<oXygen/> XML Editor 15.0, build 2013060616
Mac OS X 10.8.4
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: include PDF file in Docbook 5 print output

Post by sorin_ristache »

Hi,

An external PDF file can be included in a Docbook 5 XML document as a link, for example:

Code: Select all

<link xlink:href="forms-directory/form.pdf" xmlns:xlink="http://www.w3.org/1999/xlink">external PDF form</link>
but when you print out on paper the PDF result of transforming the Docbook XML document to the PDF format the external PDF file form.pdf will not be expanded inline at the location of the <link> element. Only the name form.pdf will be inserted in the PDF transformation result at the location of the link. Is that what you want, to expand the content of form.pdf inline at the location of the link? I don't know any FO processor (the module that is responsible with the final step of the Docbook PDF transformation and that actually creates the output PDF file) that is capable of doing that.

There are some third-party applications like Adobe Acrobat XI Professional that can do that, but they don't start with an XML file in which an external resource of type PDF is inserted.

I think there is no better solution for inserting the content of an external PDF file into a Docbook XML document than what you already found: insert an image (JPEG, SVG, GIF, etc) of the external form in the Docbook XML document.


Regards,
Sorin
Radu
Posts: 9434
Joined: Fri Jul 09, 2004 5:18 pm

Re: include PDF file in Docbook 5 print output

Post by Radu »

Hi,

An alternative which could be explored would be to reference in the Docbook document the PDF as an image, something like:

Code: Select all

<inlinemediaobject>
<imageobject>
<imagedata
fileref="path/to/my.pdf"
/>
</imageobject>
</inlinemediaobject>
In order to have the PDF image appear in the PDF the Apache FOP needs to be enhanced with a plugin which supports PDF images:

http://xmlgraphics.apache.org/fop/fop-p ... l#download

You can download a binary distribution of the plugin which contains a set of JAR libraries.

In the OXYGEN_INSTALL_DIR\lib you should create another folder called fop in which you should copy those additional plugin JAR libraries.

This seemed to work for me, the first page of the referenced PDF appears as an image embedded in the master PDF.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
typesetcmb
Posts: 2
Joined: Thu Jul 11, 2013 11:54 am

Re: include PDF file in Docbook 5 print output

Post by typesetcmb »

Hello Radu,

Thank you for that information. I think this will do what I want, and it is easier than converting the files to JPG.

After I inserted the information in text mode, the well-formedness test and validation test worked. When I switched to Author mode, it gave an error, saying the image file type was unknown, and to check the Help files for a workaround. I looked in the Help files, but didn't see anything relating to that. I used the standard Docbook PDF transformation, and the resulting PDF file included the imported file information as I wanted.

Brian
Radu
Posts: 9434
Joined: Fri Jul 09, 2004 5:18 pm

Re: include PDF file in Docbook 5 print output

Post by Radu »

Hi Brian,

Our Author visual editing mode cannot yet display referenced PDF images. We have an improvement request already logged in for this so it is possible that in the future we'll remove this limitation.But as
But as you saw the Apache FOP processor which builds the PDF should generate the proper PDF if the plugin is correctly installed.

Visual XML editing is never a what-you-see-is-what-you-get (WYSIWYG) experience, it is more a what-you-see-is-one-option (WYSIOO). Output from XML is controlled entirely by stylesheets and other processors which may have better or worse support for certain features than the visual editor itself.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply