this post was submitted on 27 Jul 2023
41 points (95.6% liked)

Linux

45595 readers
675 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

Could not find how to do it with qpdf or pdftk or even a gui tool.

Edit: Solution pdftk A=oldpdf.pdf cat A output newpdf.pdf This removes all metadata and also the attachments.

top 16 comments
sorted by: hot top controversial new old
[–] [email protected] 6 points 11 months ago

https://stackoverflow.com/questions/20676707/remove-delete-all-images-from-a-pdf-using-ghostscript-or-imagemagick

gs -o noimage.pdf -sDEVICE=pdfwrite -dFILTERIMAGE input.pdf

can't test it right now though.

[–] [email protected] 3 points 11 months ago

Slightly shorter:

pdftk old.pdf cat output new.pdf

[–] [email protected] 3 points 11 months ago (1 children)

I forget exactly what I did, but I think I used okukar. It showed the attachments then it just selected them all and copied them to the desktop.

It might have been one of the web browsers, but I’m pretty sure it was okular as i couldn’t do it on windows.

If you have a better solution, please let me know.

[–] [email protected] 5 points 11 months ago (2 children)

I am talking about removing them from pdf. For extracting them this works pdftk [pdf_file.pdf] unpack_files.

[–] [email protected] 3 points 11 months ago (1 children)

I've used LibreOffice Draw before to remove content from PDF files without reprinting

[–] [email protected] 2 points 11 months ago

Yes but in my case the pdf file is big and I libreoffice draw hangs. Also i found another solution (added that to post).

[–] [email protected] 1 points 11 months ago

Oh in that case. Let me look up an open source tool I’ve used for PDFs before. It might be able to do it.

It’s called pdfsam.

I’m not sure if it can do what you are asking, but I think it will do the trick.

You might be able to use the convert function of ffmpeg to extract the pages as png and then recreate a new pdf from the pngs that were extracted, but this may not work for your specific file.

[–] [email protected] 2 points 11 months ago

Code Industry Master PDF does use open source tools. Sadly source code only available for paid user. 😂

[–] [email protected] 2 points 11 months ago (1 children)

Im interested what people recommend. If you dont find any, what about just printing to another pdf file? Wouldnt that remove attachments?

[–] [email protected] 2 points 11 months ago

I found much easier solution, pdftk A=oldpdf.pdf cat A output newpdf.pdf. This removes all metadata and also the attachments.

[–] [email protected] 1 points 11 months ago (1 children)

Just a guess, but can LibreOffice open, edit, then save as (or at least print to) PDF?

[–] [email protected] 2 points 11 months ago

LibreOffice Draw can do that but you have to make sure the font and margins are right or else the formatting gets messed up.

[–] [email protected] 1 points 11 months ago (1 children)

You might try printing the PDF as a PDF.

[–] [email protected] 1 points 11 months ago

That worked but it removed bookmarks. I added solution to the post.

[–] [email protected] -1 points 11 months ago (1 children)

pdfimages is what you want, I believe. It's in the poppler-utils package in Debian.

[–] [email protected] 4 points 11 months ago

Sorry, but that is for image extraction.