質問

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.

So I had a look at the documentation for the printer component in Camel and it seemed straight forward.

I produced the following DSL route:

  <camelContext trace="false" id="blueprintContext" xmlns="http://camel.apache.org/schema/blueprint">
  <route id="printSpoolRoute">
    <from uri="file:d:/printspool?delay=1000&amp;move=.done/printed/${date:now:yyyyMMdd}/${file:onlyname.noext}_DONE_${date:now:yyyyMMddHHmmss}.${file:name.ext}&amp;readLock=changed&quot;"/>
    <to uri="lpr:localhost/default?flavor=DocFlavor.INPUT_STREAM&amp;mimeType=AUTOSENSE&amp;mediaSize=iso-a4"/>
  </route>
</camelContext>

When I start it up I get the following exception:

[ 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&mediaSize=iso-a4&mimeType=AUTOSENSE]. Reason: java.lang.NullPointerException org.apache.camel.FailedToCreateProducerException: Failed to create Producer for endpoint: Endpoint[lpr://localhost/default?flavor=DocFlavor.INPUT_STREAM&mediaSize=iso-a4&mimeType=AUTOSENSE]. Reason: java.lang.NullPointerException

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.

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.

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:

<to uri="lpr:SRV-07/HP LaserJet 4104?flavor=DocFlavor.INPUT_STREAM&amp;mimeType=AUTOSENSE&amp;mediaSize=iso-a4"/>

I am worried about dashes and spaces in the name and someone that has worked with this component before could shed some light here.

役に立ちましたか?

解決

Right leaving this here for reference.

Answer is that the mediaSize parameter must be specified according to the documentation found at this link. I had the parameter as iso-a4 instead of ISO_A4. Maybe the camel developers could give a little more descriptive exception here.

Also the question about the URI for network printers does work as I have specified.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top