Showing posts with label decrease. Show all posts
Showing posts with label decrease. Show all posts

23 February 2026

How to shrink file size of a pdf file?

sudo apt update
sudo apt install ghostscript

The Compression Command
Use the following command to compress the PDF to a "screen" quality, which is usually sufficient for viewing on monitors or emailing and will easily bring a 3MB file below 2MB:
bash
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf
  • input.pdf: Replace with your original file name.
  • output.pdf: The name of the new compressed file.
Alternative: Better Quality (eBook)
If the /screen setting makes the text look too blurry, try /ebook (150 dpi), which balances good quality with a smaller file size:
bash
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf
Other Options
  • -dPDFSETTINGS=/screen: 72 dpi, lowest quality, smallest size (best for >2MB requirement).
  • -dPDFSETTINGS=/ebook: 150 dpi, medium quality, better for reading.
  • -dPDFSETTINGS=/printer: 300 dpi, high quality, likely to keep the file over 2MB.
Note: If the PDF contains text only, the file size reduction may be limited.


24 March 2021

How can I scale the content of an iFrame?

How can I scale the content of an iFrame?


<iframe src="https://xxx.html" style="border:none; overflow: hidden; position: relative; width: 1044px; height: 1730px; -ms-zoom: 0.5; -moz-transform: scale(0.5); -moz-transform-origin: 0px 0; -o-transform: scale(0.5); -o-transform-origin: 0 0; -webkit-transform: scale(0.5); -webkit-transform-origin: 0 0;" title="xxx"></iframe>