Hi,

1) You can indeed replace images. Just set the new image data as the "stream" 
of the old image object and replace all keys in the image dictionary such as 
width, height, colorspace ....

A problem could be that images are usually drawn with a command like this (see 
PdfPainter::DrawImage for an example):

q WIDTH HEIGHT 0 0 XPOSITION YPOSITION cm /Image Do Q

Which means that before the image is drawn (/Image Do), a transformation 
matrix is set using the cm command which includes the width and height of the 
image, to which it is scaled. So you might need to change these values to, 
which could involve parsing the content stream of a page or xobjects.

2) No, there is no simple way to copy text objects. I am sorry. But, as you 
can see at the text extract example, which is far from complete, text 
extraction is already very complicated and this is the base for copying text.

Best regards,
        Dominik

Am Monday 29 August 2011 schrieb Christof Weniger:
> Hi,
>      first of all great library with some very cool tools/examples.
> 
> What I'm trying to do: Take an existing pdf with image over text and
> replace the images with smaller black-and-white versions.
> What I have: I have the pdf with the text, I have the smaller (filesize)
> versions of the images.
> 
> To get there I figure there are two ways:
> 
> 1. Load the pdf, delete all the image-objects, add the new Images.
> 2. Create with the images a new pdf and copy the underlying text from
> the pdf into the new one.
> 
> ad 1.) is it possible to "replace" an image with a new one? As far as I
> saw, I can only delete the reference to an object, but not the object
> itself, which would make the filesize even larger
> 
> ad2.) is there a simple way, of copying text objects from one page to
> another? I tried starting with the text-extract example, but didn't get
> anywhere so far. Redrawing a text that already exists with the correct
> font and all seems so redundant.
> 
> If anyone has an idea, or could shove me into the right direction it'd
> be greatly appreciated.
> 
> all the best,
> Christof
> 
> ---------------------------------------------------------------------------
> --- EMC VNX: the world's simplest storage, starting under $10K
> The only unified storage solution that offers unified management
> Up to 160% more powerful than alternatives and 25% more efficient.
> Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev
> _______________________________________________
> Podofo-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/podofo-users


-- 
Dominik Seichter - [email protected] - http://domseichter.blogspot.com
KRename  - http://www.krename.net  - Powerful batch renamer for KDE
KBarcode - http://www.kbarcode.net - Barcode and label printing
PoDoFo - http://podofo.sf.net - PDF generation and parsing library

Attachment: signature.asc
Description: This is a digitally signed message part.

------------------------------------------------------------------------------
Special Offer -- Download ArcSight Logger for FREE!
Finally, a world-class log management solution at an even better 
price-free! And you'll get a free "Love Thy Logs" t-shirt when you
download Logger. Secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsisghtdev2dev
_______________________________________________
Podofo-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/podofo-users

Reply via email to