Date: Thu, 17 Jun 2010 10:19:26 +0200
From: Michal Hocko <[email protected]>
Subject: Re: [Pdfedit-support] PDF Metadata support for PDFedit
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii

On Thu, Jun 17, 2010 at 09:26:34AM +0200, Michal Hocko wrote:
> Hi,
> 
> On Thu, Jun 17, 2010 at 09:32:18AM +0930, Thiele, Nicholas (TA) wrote:
> > 
> > I'd like to know if PDFedit (library or GUI) can be used to edit the
> > meta data fields (e.g. Title, Author, Subject, Keywords, Creator) of
> > an existing PDF document and then re-save.  
> 
> Yes, this functionality is implemented in the library. There is no
> GUI/scripting for it though.
> 
> > I've had a look through the documentation and couldn't find any info on 
> > this.
> > 
> > Any assistance would be appreciated,
> 
> CPdf::changeTrailer function is what you are looking for. You simply

I'am sorry, but I have just found out that trailer doesn't contain this
information. It just contains Info entry which is a dictionary which
contains all the information. So you should do something like:

boost::shared_ptr<const CDict> trailer = pdf->getTrailer();
boost::shared_ptr<IProperty> info = trailer->getProperty("Info");
boost::shared_ptr<CDict> infoDict = IProperty::getSmartCObjectPtr<CDict>(info);
boost::shared_ptr<IProperty> a = infoDict->getProperty("Author");
boost::shared_ptr<CString> author = IProperty::getSmartCObjectPtr<CString>(a);
author->setValue("new author");

Unfortunately, this object is reachable only from the trailer and so it
is not accessible from the GUI (property editor) which would be much
easier to work with.

See `10.2.1 Document Information Dictionary' in pdf specification for
more information about metadata.

> need to open a file by CPdf::getInstance and then use the above method
> to add/edit metadata you are mentioning. 
> 
> Please see also README for information about how to use the library or
> feel free to ask if something is not clear.
> 
> > Nic
> > 
> > 
> 
> -- 
> Michal Hocko
> 

Thanks Michal this is very helpful and I am now keen to give it a try.  My 
preference is to use the library function as I am want to update PDF metadata 
as part of my own web GUI (although having it in the property editor would be 
good for testing).  I'll let you know how I go.

Thanks again,
Nic


------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Pdfedit-support mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pdfedit-support

Reply via email to