title: How do I pipe pdf-generating output through pdftk to remove annotations?
body: <p>I want to pipe pdf-generating output through pdftk to remove annotations.</p>
  <p>How can I combine this existing portion of a working AppleScript line:</p>
  <pre><code>do shell script &quot;/usr/local/bin/$pdf-generating-app --page-size=A4 --page-margin=5mm &quot; &amp; (quoted form of POSIX path of filename) &amp; &quot; -o &quot; &amp; (quoted form of POSIX path of outputFilename)
  </code></pre>
  <p>And have that piped through pdftk to remove annotations, as per <a href="https://stackoverflow.com/questions/49598797/remove-pdf-annotations-via-command-line#comment113338121_49614525">this script</a> by <a href="https://stackoverflow.com/users/1407737/farid-cheraghi?tab=profile">Farid Cheraghi</a>?</p>
  <pre><code>sh pdftk in.pdf output - uncompress | sed '/^\/Annots/d' | pdftk - output out.pdf compress
  </code></pre>