You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Gary Marshall-Stevens <ga...@3six9.com> on 2003/05/09 12:56:38 UTC

newbie querie

I am building an app which needs to convert dwg files to pdf.
I can plot to pdf from autocad but I need to insert some metadata into
the pdf.
Would FOP be of use to insert the metadata into the pdf after it has
been created ?
 
I was considering ploting to svg and then inserting metadata and using
batik to generate the pdf.
 
Any direction for this would be greatly appreciated.
 
Many thanks
 
Gary

Re: PDF metadata

Posted by Jeremias Maerki <de...@greenmail.ch>.
The only thing close to metadata in XSL-FO is fo:title on
fo:page-sequence, I think. We would have to write a FOP extension
(similar to outlines) to bring metadata over to the PDF document. (Maybe
this would also be a job for http://exslfo.sourceforge.net or XSL 1.1.)

At the moment you can only do it with Java (on the PDFRenderer instance)
and only with a small subset of values (setProducer()) if you don't hack
the PDF renderer.

On 09.05.2003 17:18:58 Clay Leeds wrote:
> Jeremias Maerki wrote:
> > Well, I think there's two kinds of metadata available in PDF. The
> > chapter 9.2.1 (PDF spec) "Document Information Dictionary" object
> > (represented by PDFInfo.java) which takes the basic values such as
> > creator, title, keywords, etc. And there are metadata streams (chapter
> > 9.2.2). These have not yet been implemented and I can't tell offhand how
> > much work it would be to implement them. I guess it depends what exactly
> > you need to place in the PDF.
> 
> I've read the chapter 9.2.1 (PDF spec) "Document Information Dictionary" 
>   and still don't know how to leverage this piece of information. Must I 
> use Java to add this meta-data to the PDF file, or can I do it from the 
> command line interface? In other words, can it be done from within 
> xsl-fo? What do the calls look like?



Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


RE: PDF metadata

Posted by Victor Mote <vi...@outfitr.com>.
Clay Leeds wrote:

> Here're the supported PDF meta-data attributes:
>
> Title
> Author
> Subject
> Keywords
> Creator
> Producer
> CreationDate
> ModDate
> Trapped
>
> Here's the PDF Spec Example:
>
> Example 9.1 shows a typical document information dictionary.
> 1 0 obj
>    << /Title (PostScript Language Reference, Third Edition)
>      /Author (Adobe Systems Incorporated)
>      /Creator (Adobe® FrameMaker® 5.5.3 for Power Macintosh)
>      /Producer (Acrobat® Distiller™ 3.01 for Power Macintosh)
>      /CreationDate (D:19970915110347-08'00')
>      /ModDate (D:19990209153925-08'00')
>    >>
> endobj
>
> Unfortunately, I don't know how to add these.
>
> Would I do something like this:
>
> <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"
>                 xmlns:fox="http://xml.apache.org/fop/extensions">
>    <fox:metadata title="Nifty PDF Meta Data">
>    <fox:metadata author="Clay Leeds">
>    <fox:metadata creator="XMLSpy">
>    <fox:metadata producer="Yahoo Serious">
>    <fox:metadata creation-date="2003-05-09">
>    <fox:metadata modification-date="2003-05-09">
> </fo:root>
>
> BTW, just as I was sending this, Jeremias' e-mail came through. I don't
> know if this stuff has any bearing (or might help "make it so"), but
> here it is...

There are two issues. First, you need a way to tell the FOP session what
metadata to embed in the PDF. Second, FOP needs to be able to take that
information and actually embed it. The "fox" code you have written above
would be one way to handle the first issue. The second issue will require
some modifications to FOP (i.e. java programming) which are probably not
terrible difficult.

Victor Mote


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


Re: PDF metadata

Posted by Clay Leeds <cl...@medata.com>.
Victor Mote wrote:
> I think the best way to do this would be with our FO extension mechanism,
> using the "fox" namespace. There are no calls to do this right now, but it
> will be pretty doable after we get the redesign done. (Its actually pretty
> doable now, but the redesign needs to take priority).
> 
> Victor Mote

I've never used FOP's extensions, although I keep threatening to play 
around a bit with Bookmarks. Here's an example from the FOP site:

<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"
                xmlns:fox="http://xml.apache.org/fop/extensions">
   <fox:outline internal-destination="sec3">
     <fox:label>Running FOP</fox:label>

     <fox:outline internal-destination="sec3-1">
       <fox:label>Prerequisites</fox:label>
     </fox:outline>
   <fox:outline>
</fo:root>

Here're the supported PDF meta-data attributes:

Title
Author
Subject
Keywords
Creator
Producer
CreationDate
ModDate
Trapped

Here's the PDF Spec Example:

Example 9.1 shows a typical document information dictionary.
1 0 obj
   << /Title (PostScript Language Reference, Third Edition)
     /Author (Adobe Systems Incorporated)
     /Creator (Adobe® FrameMaker® 5.5.3 for Power Macintosh)
     /Producer (Acrobat® Distiller™ 3.01 for Power Macintosh)
     /CreationDate (D:19970915110347-08'00')
     /ModDate (D:19990209153925-08'00')
   >>
endobj

Unfortunately, I don't know how to add these.

Would I do something like this:

<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"
                xmlns:fox="http://xml.apache.org/fop/extensions">
   <fox:metadata title="Nifty PDF Meta Data">
   <fox:metadata author="Clay Leeds">
   <fox:metadata creator="XMLSpy">
   <fox:metadata producer="Yahoo Serious">
   <fox:metadata creation-date="2003-05-09">
   <fox:metadata modification-date="2003-05-09">
</fo:root>

BTW, just as I was sending this, Jeremias' e-mail came through. I don't 
know if this stuff has any bearing (or might help "make it so"), but 
here it is...
-- 
Clay Leeds - cleeds@medata.com
Web Developer - Medata, Inc. - http://www.medata.com
PGP Public Key: https://mail.medata.com/pgp/cleeds.asc


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


RE: PDF metadata

Posted by Victor Mote <vi...@outfitr.com>.
Clay Leeds wrote:

> I've read the chapter 9.2.1 (PDF spec) "Document Information Dictionary"
>   and still don't know how to leverage this piece of information. Must I
> use Java to add this meta-data to the PDF file, or can I do it from the
> command line interface? In other words, can it be done from within
> xsl-fo? What do the calls look like?

I think the best way to do this would be with our FO extension mechanism,
using the "fox" namespace. There are no calls to do this right now, but it
will be pretty doable after we get the redesign done. (Its actually pretty
doable now, but the redesign needs to take priority).

Victor Mote


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


Re: PDF metadata

Posted by Clay Leeds <cl...@medata.com>.
Jeremias Maerki wrote:
> Well, I think there's two kinds of metadata available in PDF. The
> chapter 9.2.1 (PDF spec) "Document Information Dictionary" object
> (represented by PDFInfo.java) which takes the basic values such as
> creator, title, keywords, etc. And there are metadata streams (chapter
> 9.2.2). These have not yet been implemented and I can't tell offhand how
> much work it would be to implement them. I guess it depends what exactly
> you need to place in the PDF.

I've read the chapter 9.2.1 (PDF spec) "Document Information Dictionary" 
  and still don't know how to leverage this piece of information. Must I 
use Java to add this meta-data to the PDF file, or can I do it from the 
command line interface? In other words, can it be done from within 
xsl-fo? What do the calls look like?

Thanks!
-- 
Clay Leeds - cleeds@medata.com
Web Developer - Medata, Inc. - http://www.medata.com
PGP Public Key: https://mail.medata.com/pgp/cleeds.asc


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


Re: PDF metadata (was: newbie querie)

Posted by Jeremias Maerki <de...@greenmail.ch>.
A step back, first: You want to convert SVG to PDF. The best way to do
that is to use the PDF transcoder (Batik plug-in) from the redesigned
FOP, not from 0.20.5* because it's more advanced. I don't know if you
know that. Easiest way to build it is to download a nightly snapshot and
run the build because we haven't released the transcoder, yet.

So, to fill in the metadata: SVG has a metadata element, but that is
currently unsupported by the transcoder, I think. The only way to set
the subject and keyword fields at the moment is to get at the PDFInfo
instance in PDFDocument (PDFDocument.getInfo()). The PDFDocument is
held in PDFDocumentGraphics2D.java and can be accessed from outside by
the getPDFDocument() method. What could be done now is to put your
metadata in the TranscodingHints of the PDFTranscoder.
PDFTranscoder.java would have to be enhanced for that (method 
transcode()). This could be done with very little effort.

Supporting the svg:metadata element is a bit more complicated but
nothing that cannot be done. There's only the matter of choosing a
metadata flavor. I see that RDF with xmlns="http://purl.org/dc/elements/1.1/"
seems to be quite popular (I've seen it in the SVG specs and a PDF
created by Distiller), though I'm no specialist in that regard.

In the end it simply means that PDFTranscoder.java has to be enhanced a
bit.

Do you feel up to the task to do it yourself? We would help you where we
can.

On 09.05.2003 15:30:36 Gary Marshall-Stevens wrote:
> The "Document Information Dictionary" object should cover what I need.
> 
> I can put the metadata I have into subject and keyword fields.
> 
> Excuse my ignorance but what is the best tool to do this?


Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


RE: PDF metadata (was: newbie querie)

Posted by Gary Marshall-Stevens <ga...@3six9.com>.
The "Document Information Dictionary" object should cover what I need.

I can put the metadata I have into subject and keyword fields.

Excuse my ignorance but what is the best tool to do this?

Thanks

Gary

-----Original Message-----
From: Jeremias Maerki [mailto:dev.jeremias@greenmail.ch] 
Sent: 09 May 2003 12:15
To: fop-user@xml.apache.org
Subject: Re: PDF metadata (was: newbie querie)


Well, I think there's two kinds of metadata available in PDF. The
chapter 9.2.1 (PDF spec) "Document Information Dictionary" object
(represented by PDFInfo.java) which takes the basic values such as
creator, title, keywords, etc. And there are metadata streams (chapter
9.2.2). These have not yet been implemented and I can't tell offhand how
much work it would be to implement them. I guess it depends what exactly
you need to place in the PDF.

On 09.05.2003 12:56:38 Gary Marshall-Stevens wrote:
> I am building an app which needs to convert dwg files to pdf. I can 
> plot to pdf from autocad but I need to insert some metadata into the 
> pdf. Would FOP be of use to insert the metadata into the pdf after it 
> has been created ?
>  
> I was considering ploting to svg and then inserting metadata and using

> batik to generate the pdf.
>  
> Any direction for this would be greatly appreciated.


Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


Re: PDF metadata (was: newbie querie)

Posted by Jeremias Maerki <de...@greenmail.ch>.
Well, I think there's two kinds of metadata available in PDF. The
chapter 9.2.1 (PDF spec) "Document Information Dictionary" object
(represented by PDFInfo.java) which takes the basic values such as
creator, title, keywords, etc. And there are metadata streams (chapter
9.2.2). These have not yet been implemented and I can't tell offhand how
much work it would be to implement them. I guess it depends what exactly
you need to place in the PDF.

On 09.05.2003 12:56:38 Gary Marshall-Stevens wrote:
> I am building an app which needs to convert dwg files to pdf.
> I can plot to pdf from autocad but I need to insert some metadata into
> the pdf.
> Would FOP be of use to insert the metadata into the pdf after it has
> been created ?
>  
> I was considering ploting to svg and then inserting metadata and using
> batik to generate the pdf.
>  
> Any direction for this would be greatly appreciated.


Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org