4

I need to replace images in a PDFDocument or CGPDFDocument.

I found a way to extract images using the old Core Graphics API (i.e. not PDFKit). Here.

Now I would like to make a copy of a PDF but by replacing the existing images. How can I get the width/height & coordinates of the existing images in the source PDF?

PDF are sooo complicated.

Thanks!

vomi
  • 993
  • 8
  • 18
  • If you are able to extract images, check the image to find out what are their dimensions? – Meep Aug 08 '21 at 12:21
  • Actually I need the dimensions inside the PDF itself, not the image dimensions – vomi Aug 09 '21 at 12:05
  • vomi, did you find a solution? – Daniel Jul 23 '22 at 21:33
  • Unfortunately no, I think I'd have to edit the PDF tree manually... I did not go there yet. – vomi Jul 31 '22 at 07:29
  • Hey @vomi, did you manage to edit the tree? I am trying to do something similar (remove background from the page) I already modified the stream of the page. But I am unable to save it back. Would be so happy if you figured out how to do so :pray: – Jason Krowl Nov 14 '22 at 14:09
  • No I did not, unfortunately. PDF specs are a nightmare. – vomi Nov 14 '22 at 19:28

0 Answers0