title: Ghostscript PDF printing
body: <p>I would like to make my own &quot;PDF printer&quot; using Ghostscript.</p>
  <p>Most of solutions I find on the internet involve a 3rd party like Redmon to redirect the PS printer to the Gs executable.</p>
  <p><strong>Is there a way to do the same without a 3rd party (other than Gs) ?</strong></p>
  <p>Here is my 2 ideas:</p>
  <ul>
  <li><p>Bypass the printing driver and generate Postscript directly by software (From GDI to postscript, using maybe a custom device context like the Metafile device context exist)</p>
  </li>
  <li><p>Create programmatically a new local port for each document to convert. Maybe using this technique : <a href="https://stackoverflow.com/a/1331777/99276">https://stackoverflow.com/a/1331777/99276</a></p>
  </li>
  </ul>
  <p>The first solution would be great, but can't find anything about it.</p>
  <p>And I am efraid the second is not efficient at all (and detect when the document is fully printed can be tricky)</p>
  <p>Update: I used print apis to print in a temp file (the print is synchronous) and then convert the PS file with Gs</p>