Results 1 to 2 of 2
- 07-22-2010, 12:55 PM #1
Member
- Join Date
- Jul 2010
- Posts
- 2
- Rep Power
- 0
pdfbox to overwrite image on a pdf
Hello,
I’ve been trying to make some changes on the size of pdfs.
My first step on my strategy was to extract all images from the pdf and compact them.
I made it successfully.
Now, What I need to do is to replace the image ‘I’ with the compressedImage ‘CI’ using the same graphicstate (coordinates and scale basically), so visually the pdf would be the same(or almost), the difference: with lower quality images.
the thing is that I could not replace the image on the pdfstream.
what I've tried already:
to createOutputStream() on the image and read the stream of the compacted one putting it on the image.
to drawImage() with the contentStream, but it seemed that it printed both images. And besides, I didn’t manage a way to get the graphicstate of the “old” image.
to set a new Image, which obviously would not work, but I had to try, just in case.
Now What I’m trying to do:
Pass the dictionary tree for a new PDDocument and when the COSBase is an image, replace with acompacted one. At the end save this new document.
I know how I can iterate over each element of this tree, however I could not create a new dictionary and put each new element on it.
So I was wondering if you guys can give me some light on my strategy or maybe to advice about another way of doing it.
Thank you.
- 03-09-2012, 03:54 PM #2
Member
- Join Date
- Mar 2012
- Posts
- 1
- Rep Power
- 0
Similar Threads
-
PdfBox and barcode fonts
By alexre2005 in forum New To JavaReplies: 5Last Post: 12-03-2009, 02:59 PM -
import XFDF using PDFBOX
By jkrishnanvenkat in forum Advanced JavaReplies: 1Last Post: 10-28-2009, 12:13 PM -
[SOLVED] Overwrite text file line with output stream loop
By jenni in forum New To JavaReplies: 3Last Post: 02-16-2009, 09:20 PM -
file overwrite method
By nanaji in forum Advanced JavaReplies: 5Last Post: 11-14-2008, 09:19 AM -
Create and overwrite files
By wmrwl in forum New To JavaReplies: 7Last Post: 10-01-2008, 04:16 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks