On Thu, Jul 15, 2010 at 09:06:29AM +0930, Thiele, Nicholas (TA) wrote:
> 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");
with the current CVS things are little bit easier:
boost::shared_ptr<const CDict> trailer = pdf->getTrailer();
boost::shared_ptr<CDict> info = trailer->getProperty<CDict>("Info");
boost::shared_ptr<CString> author = info->getProperty<CString>("Author");
author->setValue("new author");
Basically, you don't have to do the silly casting.
>
> 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.
Just let us know if you need any help.
>
> 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
--
Michal Hocko
------------------------------------------------------------------------------
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