title: Apache Camel And Printing Producer
body: <p>This one should be simple but for the life of me I cannot figure out how to get it running. What I want to do is read files from a folder and send them to a printer. </p>
  
  <p>So I had a look at the documentation for the printer component in Camel and it seemed straight forward.</p>
  
  <p>I produced the following DSL route:</p>
  
  <pre><code>  &lt;camelContext trace="false" id="blueprintContext" xmlns="http://camel.apache.org/schema/blueprint"&gt;
    &lt;route id="printSpoolRoute"&gt;
      &lt;from uri="file:d:/printspool?delay=1000&amp;amp;move=.done/printed/${date:now:yyyyMMdd}/${file:onlyname.noext}_DONE_${date:now:yyyyMMddHHmmss}.${file:name.ext}&amp;amp;readLock=changed&amp;quot;"/&gt;
      &lt;to uri="lpr:localhost/default?flavor=DocFlavor.INPUT_STREAM&amp;amp;mimeType=AUTOSENSE&amp;amp;mediaSize=iso-a4"/&gt;
    &lt;/route&gt;
  &lt;/camelContext&gt;
  </code></pre>
  
  <p>When I start it up I get the following exception:</p>
  
  <p><code>[         Blueprint Extender: 1] BlueprintCamelContext          ERROR Error occurred during starting Camel: CamelContext(blueprintContext) due Failed to create Producer for endpoint: Endpoint[lpr://localhost/default?flavor=DocFlavor.INPUT_STREAM&amp;mediaSize=iso-a4&amp;mimeType=AUTOSENSE]. Reason: java.lang.NullPointerException
  org.apache.camel.FailedToCreateProducerException: Failed to create Producer for endpoint: Endpoint[lpr://localhost/default?flavor=DocFlavor.INPUT_STREAM&amp;mediaSize=iso-a4&amp;mimeType=AUTOSENSE]. Reason: java.lang.NullPointerException</code></p>
  
  <p>If the exception had more detail I might be able to look for something so I suspect I made a mistake in the URI of the printing producer. </p>
  
  <p>While I am looking at the URI of the printer producer I just wanted to check if my understanding of the URI is correct when using a network printer.</p>
  
  <p>Let assume I want to produce documents on a network printer connected to a server call SRV-07 with a name of HP LaserJet 4104 will the following URI be correct:</p>
  
  <pre><code>&lt;to uri="lpr:SRV-07/HP LaserJet 4104?flavor=DocFlavor.INPUT_STREAM&amp;amp;mimeType=AUTOSENSE&amp;amp;mediaSize=iso-a4"/&gt;
  </code></pre>
  
  <p>I am worried about dashes and spaces in the name and someone that has worked with this component before could shed some light here.</p>