title: How to extract all images from a "read-protected" PDF from Linux command line?
body: <p>I'm trying to extract images from a PDF which is read protected. </p>
  
  <p>With normal PDFs the <a href="http://poppler.freedesktop.org/" rel="nofollow noreferrer">Poppler library</a> extracts images fine, and from read-protected PDFs it can also extract the text just fine. The images are a different story though. It either doesn't extract all images, or extracts all of them in vague grey or black colors.</p>
  
  <p>On the following PDF (<a href="http://www12.zippyshare.com/v/DgtCWgrd/file.html" rel="nofollow noreferrer">original PDF here</a>) which has as you can see in the thumbnail below a lot of images:</p>
  
  <p><img src="https://i.stack.imgur.com/mpxkd.jpg" alt="enter image description here"></p>
  
  <p>I tried the <code>pdfimages</code> command from the <a href="http://poppler.freedesktop.org/" rel="nofollow noreferrer">Poppler library</a>:</p>
  
  <pre><code>$ pdfimages -j ticket.pdf i
  </code></pre>
  
  <p>and the <code>pdftohtml</code> command from <a href="http://mupdf.com/" rel="nofollow noreferrer">mupdf</a>:</p>
  
  <pre><code>$ pdftohtml -nodrm ticket.pdf
  </code></pre>
  
  <p>But both libs only extract one of the many images. That image is extracted correctly though. From other PDFs I get all images, but all of them are grey or black. </p>
  
  <p>Since read-protection is supposedly only a flag in the PDF document, and not an actual scrambling or encryption of the source (in the end your computer can show the images without putting in a password) it should be possible somehow to extract the images individually. I can even create a thumbnail from the whole PDF using <a href="http://imagemagick.org/" rel="nofollow noreferrer">ImageMagick</a> (<code>convert ticket.pdf ticket.jpg</code>), so why not individual images?</p>
  
  <p>Does anybody know how I can extract all images from read-protected PDFs? All tips are welcome!</p>