• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

iText merging

 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Bruno

I know that merging pdfs is possible using iText, for example using PdfCopy class. However I got 100ish pdfs based on the one template ( they got the same graphics, just different wording )

Is it possible, during merging, to copy images once and then use references to those images later on ?

 
Greenhorn
Posts: 9
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Kuba Zygmunt wrote:Hi Bruno

I know that merging pdfs is possible using iText, for example using PdfCopy class. However I got 100ish pdfs based on the one template ( they got the same graphics, just different wording )

Is it possible, during merging, to copy images once and then use references to those images later on ?



I believe PdfSmartCopy will take care of that for you... let me check. Aha! It does indeed. It builds MD5 hashes of the streams it encounters (fonts, images, content streams) and compares them based on the hash and then the actual bytes.

PdfSmartCopy uses more memory on account of the caching it does for these comparisons, but the resulting PDFs will be smaller... in your case much smaller.
 
Kuba Zygmunt
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Fantastic ! Thanks Mark
 
You can't have everything. Where would you put it?
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!