• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

iText merging

 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Fantastic ! Thanks Mark
 
We find this kind of rampant individuality very disturbing. But not this tiny ad:
Garden Master Course kickstarter
https://coderanch.com/t/754577/Garden-Master-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic