Home > Software design >  Is there a way to increase the size (from 80 kB to 100 kB) of a pdf file without adding any new text
Is there a way to increase the size (from 80 kB to 100 kB) of a pdf file without adding any new text

Time:11-21

I need to increase the file size of a pdf without adding any new texts or images. I can reduce the file size by compressing it. When I increase the file dimensions from A4 to A3, A2 etc using available online tools, it automatically gets compressed. What I want is to increase its size from 80 kB to 100 kB. Any idea how can it be done in Python or using any tool?

CodePudding user response:

I am answering my own question. I solved it, first by converting the pdf to a postscript (ps) file, then converting the ps file back to a pdf file. One can experiment with different converters. If default values do not work, one may try changing the default values of appropriate parameters. For me, the final file size became ~300 kB with default values.

  1. To convert PDF to PS, one can use gs, pdf2ps or pdftops converter:

pdftops initial.pdf intermediate.ps

  1. To convert PS to PDF, one can use gs or ps2pdf converter:

ps2pdf intermediate.ps final.pdf

USE THIS METHOD
As suggested by K J, it is not a good idea to convert a pdf to a ps format, because this may lead to loss of some source content. The better way to increase the file size would be to decompress the existing contents in the pdf file. One can use mutool for this purpose.

mutool clean -d -a input_file.pdf output_file.pdf

One may as well refer to the following posts https://stackoverflow.com/a/25377929/10802527 and https://stackoverflow.com/a/25377913/10802527

CodePudding user response:

If you have Photoshop, Open the PDF in it and do "save as" and you will see a quality option then just increase it to the max... If it doesn't work with PDFs then take a screenshot of the PDF and do the above suggestion again, it'll work

  • Related