{"id":1618,"date":"2023-12-31T14:11:03","date_gmt":"2023-12-31T20:11:03","guid":{"rendered":"https:\/\/www.schwie.com\/brad\/?p=1618"},"modified":"2023-12-31T14:13:39","modified_gmt":"2023-12-31T20:13:39","slug":"reducing-pdf-file-size","status":"publish","type":"post","link":"https:\/\/www.schwie.com\/brad\/?p=1618","title":{"rendered":"Reducing PDF File Size"},"content":{"rendered":"<p>I seem to get into this more often than I need to. I was preparing a report this weekend that grew to ~500 pages and 80 MB in size. I wanted to transmit the report as a .pdf via email. Using services like OneDrive work, but they are annoying when they require an external user to verify who they are. I also tried reducing the file size with a few other options, including:<\/p>\n<ol>\n<li>PDFCompress, an old app on my Mac<\/li>\n<li>Preview, using it&#8217;s Export option<\/li>\n<li>Others I&#8217;m forgetting to list here<\/li>\n<\/ol>\n<p>None of the options above produced a small enough .pdf file or at least not one that was less than 50 MB. Finally I turned to Ghostscript, but first I had to install and configure it:<\/p>\n<p>1. Open Terminal.app and enter: <code>brew install ghostscript<\/code><br \/>\n2. After Ghostscript installs, use Terminal to navigate to the folder containing your .pdf, in my case: <code>ls ~Desktop<\/code><br \/>\n3. Insert this command into Terminal, replacing input.pdf and output.pdf with the file names you prefer:<\/p>\n<p><code>gs -sDEVICE=pdfwrite -dPDFSETTINGS=\/ebook -dNOPAUSE -dQUIET -dBATCH -sOutputFile=\"output.pdf\" \"input.pdf\"<\/code><\/p>\n<p>The above-command produced a file about 38 MB and I was able to get it down to 36 MB using the following command:<\/p>\n<p><code>gs -q -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=\/screen -dEmbedAllFonts=true -dSubsetFonts=true -dColorImageDownsampleType=\/Bicubic -dColorImageResolution=144 -dGrayImageDownsampleType=\/Bicubic -dGrayImageResolution=144 -dMonoImageDownsampleType=\/Bicubic -dMonoImageResolution=144 -sOutputFile=\"output.pdf\" \"input.pdf\"<\/code><\/p>\n<p>I found these references helpful in developing this approach:<br \/>\n<a href=\"https:\/\/gist.github.com\/ahmed-musallam\/27de7d7c5ac68ecbd1ed65b6b48416f9\">https:\/\/gist.github.com\/ahmed-musallam\/27de7d7c5ac68ecbd1ed65b6b48416f9<\/a><br \/>\n<a href=\"https:\/\/www.cisdem.com\/resource\/shrink-pdf-file-size-on-mac.html\">https:\/\/www.cisdem.com\/resource\/shrink-pdf-file-size-on-mac.html<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I seem to get into this more often than I need to. I was preparing a report this weekend that grew to ~500 pages and 80 MB in size. I wanted to transmit the report as a .pdf via email. &hellip; <a href=\"https:\/\/www.schwie.com\/brad\/?p=1618\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1618","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.schwie.com\/brad\/index.php?rest_route=\/wp\/v2\/posts\/1618","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.schwie.com\/brad\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.schwie.com\/brad\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.schwie.com\/brad\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.schwie.com\/brad\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1618"}],"version-history":[{"count":4,"href":"https:\/\/www.schwie.com\/brad\/index.php?rest_route=\/wp\/v2\/posts\/1618\/revisions"}],"predecessor-version":[{"id":1622,"href":"https:\/\/www.schwie.com\/brad\/index.php?rest_route=\/wp\/v2\/posts\/1618\/revisions\/1622"}],"wp:attachment":[{"href":"https:\/\/www.schwie.com\/brad\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1618"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.schwie.com\/brad\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1618"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.schwie.com\/brad\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1618"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}