Answers.Body: <h1>Generally</h1>
  <p>Your PDF looks botched. I entirely concur with @JohnO on his initial comment. There's almost zero chance that with any of the current OCR techniques, you'd get a satisfying result. However, given the content you show, I'm pretty sure you can obtain a perfectly searchable PDF copy of this book.</p>
  <h1>Approach 1: Going the 'OCR' way</h1>
  <p>Having said that, you can use <a href="https://github.com/tesseract-ocr/tesseract" rel="nofollow noreferrer"><code>tesseract</code></a> for OCR. Don't forget to specify both the eng and fra language in on invoking <code>tesseract</code>. Or use one of the derived scripts to add a searchable text layer into the PDF:</p>
  <ul>
  <li><a href="https://github.com/ElectricRCAircraftGuy/PDF2SearchablePDF" rel="nofollow noreferrer">PDF2SearchablePDF</a></li>
  <li><a href="https://github.com/ocrmypdf/OCRmyPDF" rel="nofollow noreferrer">OCRmyPDF</a></li>
  <li><a href="https://github.com/LeoFCardoso/pdf2pdfocr" rel="nofollow noreferrer">pdf2pdfocr</a></li>
  </ul>
  <h1>Approach 2: Going the 'Compression' way</h1>
  <p>If you want to go along the path of compressing the PDF, you probably need to play with sampling methods, given that you stated that simply changing DPI didn't necessarily do the trick. One approach using <code>ghostscript</code> is as follows (<em><code>bash</code> needed, works on <code>wsl</code> as well</em>):</p>
  <pre><code>#!/usr/bin/env bash
  
  # Parametrization : https://www.ghostscript.com/doc/current/VectorDevices.htm#distillerparams
  # Display defaults: gs -q -dNODISPLAY -c &quot;.distillersettings /screen get {exch ==only ( ) print ===} forall quit&quot; | sort
  
  input=$1
  output=$2
  : ${QFACTOR:=&quot;0.4&quot;}
  : ${RES:=&quot;150&quot;}
  
  echo &quot;Using QFACTOR=$QFACTOR RES=$RES&quot;
  
  gs \
    -o $output \
    -sDEVICE=pdfwrite \
    -dPDFSETTINGS=/screen \
    -dCompatibilityLevel=1.8 \
    -dDetectDuplicateImages=true \
    -dAutoRotatePages=/None \
    -dEmbedAllFonts=false \
    -dSubsetFonts=true \
    -dConvertCMYKImagesToRGB=true \
    -dCompressFonts=true \
    -dColorImageDownsampleType=/Bicubic \
    -dColorImageResolution=${RES} \
    -dGrayImageDownsampleType=/Bicubic \
    -dGrayImageResolution=${RES} \
    -dMonoImageDownsampleType=/Bicubic \
    -dMonoImageResolution=${RES} \
    -dNOPAUSE \
    -dQUIET \
    -dBATCH \
    -dCompressPages=true \
    -c &quot;&lt;&lt; /ColorImageDict &lt;&lt; /QFactor ${QFACTOR} /Blend 1 /HSamples [1 1 1 1] /VSamples [1 1 1 1] &gt;&gt; &gt;&gt; setdistillerparams&quot; \
    -c '&lt;&lt;/AlwaysEmbed [ ]&gt;&gt; setdistillerparams' \
    -c '&lt;&lt;/NeverEmbed [/Courier /Courier-Bold /Courier-Oblique /Courier-BoldOblique /Helvetica /Helvetica-Bold /Helvetica-Oblique /Helvetica-BoldOblique /Times-Roman /Times-Bold /Times-Italic /Times-BoldItalic /Symbol /ZapfDingbats /Arial]&gt;&gt; setdistillerparams' \
    -f $input
  </code></pre>
  <p>In any case, unless you're ready to delve very deep into the PS/PDF/compression/OCR world, it probably is best to get a better electronic copy of the book, or upload the PDF somewhere for us to look at it.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-01-06T08:47:37.773Z
Answers.LastActivityDate: 2022-01-06T08:47:37.773Z
Answers.UserDisplayName: ikaerom
Answers.Body: <p>Try searching for compressing PDFs in general. I personally use these:</p>
  <p><code>pdftk in.pdf output out.pdf compress</code></p>
  <p>Or:</p>
  <pre><code>pdf-compress-gray () {
      local input=&quot;${1}&quot;
      local out=&quot;${2:-${input:r}_cg.pdf}&quot;
      local dpi=&quot;${pdf_compress_gray_dpi:-150}&quot;
      gs -q -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -sProcessColorModel=DeviceGray -sColorConversionStrategy=Gray -dOverrideICC -dDownsampleColorImages=true -dDownsampleGrayImages=true -dPDFSETTINGS=/screen -dColorImageDownsampleType=/Bicubic -dColorImageResolution=$dpi -dGrayImageDownsampleType=/Bicubic -dGrayImageResolution=$dpi -dMonoImageDownsampleType=/Bicubic -dMonoImageResolution=$dpi -sOutputFile=&quot;$out&quot; &quot;$input&quot;
  }
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-10-11T17:53:06.627Z
Answers.LastActivityDate: 2020-10-11T17:53:06.627Z
Answers.UserDisplayName: HappyFace
Answers.Body: <p>If you want to maintain the content integrity of your document, I advise against OCR. I think most OCR engines would have a lot of trouble vectorizing your content, due to the heavy use of symbols, mixed use of italics, bold and normal fonts, and complex formatting.</p>
  <p>If you simply want to make the final PDF file smaller, you could always compress it using a simple file compression utility available on your computer. For example, within Windows, you could right-click on your file and select &quot;Send to&quot; --&gt; &quot;Compressed (zipped) folder&quot;. I've found that does a fairly good job of compressing PDFs. Of course, the downside is that you'll need to uncompress it when you want to read your PDF.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-11-06T00:43:06.150Z
Answers.Text: In this case zip will not compress it much as the pdf consists of images which format is already compressed
Answers.UserDisplayName: mmmmmm
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-10-10T00:56:37.780Z
Answers.LastActivityDate: 2020-10-10T00:56:37.780Z
Answers.UserDisplayName: Scott Bordelon
Body: <p>I have a large black and white pdf scan of a book. The book is 1700 pages, and is about 300MB. That is about 150-175kb per page. This strikes me as rather large. Two arbitrarily selected pages are attached to illustrate; they are each about 330kb. Running them through ImageMagick's compressor gives pages which are about 240kb, which I think is still too high. The best I've been able to get is about 33% smaller. Very good but still very bad in absolute terms.</p>
  <p>I believe the book is simply a bunch of .png's stitched together with no more information than that. I have tried converting to a lower dpi, but it really decreases readability beyond 300. I am confident there is to be a way to convert these files to some kind of document (either .pdf or .djvu), but I don't know how to do this. I tried converting to .tif and that was very useful.</p>
  <p>I have done some research and it seems that it might be helpful to run these images through some kind of OCR text recognition software, or otherwise construct &quot;vectorized&quot; text. Can anyone help me with a recommendation of an open source tool for this and some instructions on how to get started?</p>
  <p><a href="https://i.sstatic.net/DSCpH.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/DSCpH.png" alt="enter image description here" /></a></p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-07-12T16:59:35.893Z
Comments.Text: It should be noted that OCR is flaky at the best of times, and that it will fail badly on the example image. Some OCR programs might try to preserve bold styles and indenting, and others might try to preserve the 2-column, but none I've had experience with will manage to get all the styles... which are fundamental to the nature of a dictionary. One misplaced pronunciation character, and that's useless. Without the formatting, you can't even distinguish entries from definitions. If this is ever published digitally, it will need the publisher's original electronic files or to be transcribed.
Comments.UserDisplayName: John O
Tags: <pdf>
Title: How can I compress this pdf file without losing readability?
UserDisplayName: Patrick Nicodemus
ThreadText: # How can I compress this pdf file without losing readability?
  
  (Asked by: username_0 on 2020-10-03)
  
  I have a large black and white pdf scan of a book. The book is 1700 pages, and is about 300MB. That is about 150-175kb per page. This strikes me as rather large. Two arbitrarily selected pages are attached to illustrate; they are each about 330kb. Running them through ImageMagick's compressor gives pages which are about 240kb, which I think is still too high. The best I've been able to get is about 33% smaller. Very good but still very bad in absolute terms.
  
  I believe the book is simply a bunch of .png's stitched together with no more information than that. I have tried converting to a lower dpi, but it really decreases readability beyond 300. I am confident there is to be a way to convert these files to some kind of document (either .pdf or .djvu), but I don't know how to do this. I tried converting to .tif and that was very useful.
  
  I have done some research and it seems that it might be helpful to run these images through some kind of OCR text recognition software, or otherwise construct "vectorized" text. Can anyone help me with a recommendation of an open source tool for this and some instructions on how to get started?
  
  [![enter image description here](https://i.sstatic.net/DSCpH.png)](https://i.sstatic.net/DSCpH.png)
  
  **Tags:** pdf
  
  > **Comments:**
  > **username_1**: It should be noted that OCR is flaky at the best of times, and that it will fail badly on the example image. Some OCR programs might try to preserve bold styles and indenting, and others might try to preserve the 2-column, but none I've had experience with will manage to get all the styles... which are fundamental to the nature of a dictionary. One misplaced pronunciation character, and that's useless. Without the formatting, you can't even distinguish entries from definitions. If this is ever published digitally, it will need the publisher's original electronic files or to be transcribed.  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_2 on 2022-01-06. Score: 1
  
  # Generally
  
  Your PDF looks botched. I entirely concur with @username_1 on his initial comment. There's almost zero chance that with any of the current OCR techniques, you'd get a satisfying result. However, given the content you show, I'm pretty sure you can obtain a perfectly searchable PDF copy of this book.
  
  # Approach 1: Going the 'OCR' way
  
  Having said that, you can use [`tesseract`](https://github.com/tesseract-ocr/tesseract) for OCR. Don't forget to specify both the eng and fra language in on invoking `tesseract`. Or use one of the derived scripts to add a searchable text layer into the PDF:
  
  * [PDF2SearchablePDF](https://github.com/ElectricRCAircraftGuy/PDF2SearchablePDF)
  * [OCRmyPDF](https://github.com/ocrmypdf/OCRmyPDF)
  * [pdf2pdfocr](https://github.com/LeoFCardoso/pdf2pdfocr)
  
  # Approach 2: Going the 'Compression' way
  
  If you want to go along the path of compressing the PDF, you probably need to play with sampling methods, given that you stated that simply changing DPI didn't necessarily do the trick. One approach using `ghostscript` is as follows (*`bash` needed, works on `wsl` as well*):
  
  ```
  #!/usr/bin/env bash
  
  # Parametrization : https://www.ghostscript.com/doc/current/VectorDevices.htm#distillerparams
  # Display defaults: gs -q -dNODISPLAY -c ".distillersettings /screen get {exch ==only ( ) print ===} forall quit" | sort
  
  input=$1
  output=$2
  : ${QFACTOR:="0.4"}
  : ${RES:="150"}
  
  echo "Using QFACTOR=$QFACTOR RES=$RES"
  
  gs \
    -o $output \
    -sDEVICE=pdfwrite \
    -dPDFSETTINGS=/screen \
    -dCompatibilityLevel=1.8 \
    -dDetectDuplicateImages=true \
    -dAutoRotatePages=/None \
    -dEmbedAllFonts=false \
    -dSubsetFonts=true \
    -dConvertCMYKImagesToRGB=true \
    -dCompressFonts=true \
    -dColorImageDownsampleType=/Bicubic \
    -dColorImageResolution=${RES} \
    -dGrayImageDownsampleType=/Bicubic \
    -dGrayImageResolution=${RES} \
    -dMonoImageDownsampleType=/Bicubic \
    -dMonoImageResolution=${RES} \
    -dNOPAUSE \
    -dQUIET \
    -dBATCH \
    -dCompressPages=true \
    -c "<< /ColorImageDict << /QFactor ${QFACTOR} /Blend 1 /HSamples [1 1 1 1] /VSamples [1 1 1 1] >> >> setdistillerparams" \
    -c '<</AlwaysEmbed [ ]>> setdistillerparams' \
    -c '<</NeverEmbed [/Courier /Courier-Bold /Courier-Oblique /Courier-BoldOblique /Helvetica /Helvetica-Bold /Helvetica-Oblique /Helvetica-BoldOblique /Times-Roman /Times-Bold /Times-Italic /Times-BoldItalic /Symbol /ZapfDingbats /Arial]>> setdistillerparams' \
    -f $input
  
  ```
  
  In any case, unless you're ready to delve very deep into the PS/PDF/compression/OCR world, it probably is best to get a better electronic copy of the book, or upload the PDF somewhere for us to look at it.
  
  
  ---
  
  ### Answer by username_3 on 2020-10-11. Score: 1
  
  Try searching for compressing PDFs in general. I personally use these:
  
  `pdftk in.pdf output out.pdf compress`
  
  Or:
  
  ```
  pdf-compress-gray () {
      local input="${1}"
      local out="${2:-${input:r}_cg.pdf}"
      local dpi="${pdf_compress_gray_dpi:-150}"
      gs -q -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -sProcessColorModel=DeviceGray -sColorConversionStrategy=Gray -dOverrideICC -dDownsampleColorImages=true -dDownsampleGrayImages=true -dPDFSETTINGS=/screen -dColorImageDownsampleType=/Bicubic -dColorImageResolution=$dpi -dGrayImageDownsampleType=/Bicubic -dGrayImageResolution=$dpi -dMonoImageDownsampleType=/Bicubic -dMonoImageResolution=$dpi -sOutputFile="$out" "$input"
  }
  
  ```
  
  
  ---
  
  ### Answer by username_4 on 2020-10-10. Score: 0
  
  If you want to maintain the content integrity of your document, I advise against OCR. I think most OCR engines would have a lot of trouble vectorizing your content, due to the heavy use of symbols, mixed use of italics, bold and normal fonts, and complex formatting.
  
  If you simply want to make the final PDF file smaller, you could always compress it using a simple file compression utility available on your computer. For example, within Windows, you could right-click on your file and select "Send to" --> "Compressed (zipped) folder". I've found that does a fairly good job of compressing PDFs. Of course, the downside is that you'll need to uncompress it when you want to read your PDF.
  
  > **Comments:**
  > **username_5**: In this case zip will not compress it much as the pdf consists of images which format is already compressed  
  
  ---
  
  