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
> 
> ------------------------------------------------------------------------------
> ThinkGeek and WIRED's GeekDad team up for the Ultimate 
> GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
> lucky parental unit.  See the prize list and enter to win: 
> http://p.sf.net/sfu/thinkgeek-promo
> _______________________________________________
> Pdfedit-support mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/pdfedit-support

-- 
Michal Hocko

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Pdfedit-support mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pdfedit-support

Reply via email to