signintech / pdft

Creating PDF using existing PDF as template for GO (golang).
MIT License
264 stars 44 forks source link

Fix image index conflict and support cache for inserting image #18

Closed hanFengSan closed 4 years ago

hanFengSan commented 4 years ago

Hi, I fix a bug about image index conflict. When I use pdft to edit a merged pdf, it is very weird. The images in different pages were changed. I didn't do anything about them. So, I fixed the bug. When saving to pdf file, pdft will get all XObject in all pages, and save to XObject of each page. In a merged pdf, it maybe has same image index but different object ID in different pages. I add some codes to avoid that the XObject get many same image indexes but different object ID.

In addition, I add a new API for inserting image to avoid redundant data when inserting same images many times

oneplus1000 commented 4 years ago

thank you