Tool:
# Convert PDF to images
> pdftoppm -png -r 300 [path to PDF] [output]
# - "300" is the DPI
# Will create output files:
# output-01.png
# output-02.png
# ...
# Convert images back to PDF
> magick convert [png-1] [png-2] [...] output_file.pdf
# - One png per page
# - you can use wildcards, but be aware that the order
# of arguments is determining the page order
# NOTE: Combining a lot of images into a single PDF # might use a lot of RAM.
# If you work with lots of images, consider converting them to
# pdf individually and merging them:
# Convert PNG to PDF individually:
> magick mogrify -format pdf [image_file]
# - You can use wildcards. This will still generate one PDF per image.
# Combine PDFs
> pdfunite [pdf-1] [pdf-2] [...] output_file.pdf