Roger Misteli wrote:
> Hiyas
>
> I have a document with, say, 2000 pages and on each page is a little image.
> The image is the same over all the 2000 pages. Now, if I simply add the
> picture to the document using PdfContentByte and addImage() I get the desired
> result, but the same image is written 2000 times and blows up the
> document size.
> Is there a possibility using Watermarks or Templates how I could add it just
> one time and let the other images simply point to the existing picture?
Yes,
there is a huge difference between:
Image img = new Image("my_image.pdf");
for (int i = 0; i < 2000; i++) {
addImage(img); // your custom method that adds an image
document.newPage();
}
and
for (int i = 0; i < 2000; i++) {
Image img = new Image("my_image.pdf");
addImage(img); // your custom method that adds an image
document.newPage();
}
In the first sample, the image bytes are added only once.
In the second sample, they are added 2000 times.
On page 449-450 of the book you get an idea of the
amount of bytes you can save ;-)
br,
Bruno
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/