gettalong / hexapdf

Versatile PDF creation and manipulation for Ruby
https://hexapdf.gettalong.org
Other
1.21k stars 69 forks source link

How to flatten a file with no form #209

Closed brandit-dev closed 1 year ago

brandit-dev commented 1 year ago

Hello,

  1. I have a pdf to which I add text and images.
  2. After saving it, if I open it on Adobe Acrobat, I can edit/delete any of the PDF elements (images, text), etc.
  3. How can I save the file in a way it will be converted to an image as if it was a bitmap?
  4. If it has to be saved as a JPG, that's ok (we'd prefer to keep as PDF, though).

Thanks,

Sergio

gettalong commented 1 year ago

Am I understanding correctly that you want to output a PDF which is not editable in a PDF editor? If so, you would need to render the PDF pages and use the generated images as PDF pages (either in a new PDF or by substituting the contents of the existing pages).

Note that PDF rendering is the one thing HexaPDF is not designed to do! So you will need to use something like pdftocairo to render the pages.

Alternatively, if you just want to make sure that the receiver of a PDF knows that nothing has been changed, you could digitally sign the PDF. It will still be editable but editing it would void the digital signature.