Jump to content

PDF PRINT: Difference between revisions

From Commander4j
Updated by push_wiki.py
Updated by push_wiki.py
 
Line 1: Line 1:
The PDF_PRINT connector monitors a directory for incoming PDF files and automatically sends them to a printer. It provides a simple way to automate printing of reports, labels, or documents that are generated as PDF files by Commander4j or any other application.
The PDF_PRINT [[Connectors|connector]] watches a folder for PDF files and prints each one on a named printer. It is a simple way to print reports or documents produced as PDF files by Commander4j or any other program, without anyone having to open them.


== How It Works ==
PDF_PRINT is used as a pair: a PDF_PRINT input with a PDF_PRINT output. No stylesheet is involved and the PDF is printed as it is.


When a PDF file appears in the monitored input directory, Middleware4j reads it using Apache PDFBox and sends it to the configured print queue. The file is then moved out of the input directory. No transformation is applied — the PDF is printed as-is.
== Map configuration ==
 
== Input Configuration ==


'''config.xml'''
<syntaxhighlight lang="xml">
<syntaxhighlight lang="xml">
<input>
<map>
  <id>in1</id>
  <id>Map06</id>
  <type>PDF_PRINT</type>
  <enabled>true</enabled>
  <url>
  <description>Print PDF Document</description>
    <path>./interface/input/Map06 PDF to PRINT</path>
  <enableEmailNotifications>true</enableEmailNotifications>
    <mask/>
  <connectors>
    <pollingInterval>1000</pollingInterval>
      <input>
  </url>
        <id>in1</id>
</input>
        <description>Read PDF Document</description>
        <type>PDF_PRINT</type>
        <url>
            <path>./interface/input/Map06 PDF to PRINT</path>
            <mask/>
            <prefix/>
            <pollingInterval>1000</pollingInterval>
        </url>
      </input>
      <output>
        <id>out1</id>
        <enabled>true</enabled>
        <description>Print PDF Document to HP8600</description>
        <type>PDF_PRINT</type>
        <url>
            <path>./interface/output/Map06 PDF to PRINT</path>
            <prefix/>
            <fileExtension/>
            <use83GUID>false</use83GUID>
            <retainOriginalFilename>false</retainOriginalFilename>
        </url>
        <print>
            <queueName>HP8600</queueName>
        </print>
      </output>
  </connectors>
</map>
</syntaxhighlight>
</syntaxhighlight>


== Output Configuration ==
{| class="wikitable"
|-
! Setting !! Description
|-
| '''type''' || <code>PDF_PRINT</code> on both the input and the output.
|-
| '''input mask''' || Leave empty to pick up files ending in <code>.pdf</code>.
|-
| '''output path''' || A working folder. The PDF is held here while it is being printed.
|-
| '''print / queueName''' || The name of the printer, as shown in the list of printers on the computer running Middleware4j. Upper and lower case do not matter. Leave the <code>&lt;print&gt;</code> section out to use the default printer.
|}


<syntaxhighlight lang="xml">
Note that <code>queueName</code> must be inside a <code>&lt;print&gt;</code> element.
<output>
 
  <id>out1</id>
The settings shared by all connectors are described on the [[Maps]] page.
  <type>PDF_PRINT</type>
 
  <url>
== How it works ==
    <path>./interface/output/Map06 PDF to PRINT</path>
  </url>
  <queueName>HP8600</queueName>
</output>
</syntaxhighlight>


The '''queueName''' element specifies the name of the printer or print queue to use. This must match the printer name as it appears in the operating system's printer list. If <code>queueName</code> is omitted, the system default printer is used.
# The input connector finds a PDF file and saves a copy to the log folder.
# The output connector moves the file to the output folder.
# The file is sent to the printer.
# Once it has been sent, the file is deleted from the output folder.


== Use Cases ==
== Use cases ==


* Automatically printing JasperReports output from Commander4j as PDF is delivered to the input folder
* Printing Commander4j reports that have been saved as PDF to a folder.
* Printing documents generated by external systems without manual intervention
* Printing documents produced by another system without manual intervention.
* Centralising print routing — other systems drop PDFs to a network share monitored by Middleware4j, which routes them to the correct printer
* Routing print jobs: other systems drop PDF files into different folders on a share, and a map for each folder sends them to the right printer.


== Notes ==
== Notes ==


* The printer must be accessible from the machine running Middleware4j. For network printers, ensure the service account running Middleware4j has permission to access the print queue.
* If the printer name is not recognised, the error email sent to the '''Error''' list includes the names of all the printers that Middleware4j can see. Copy the correct name from that list into <code>queueName</code>.
* If Middleware4j is running as a Windows service under the System account, network printers may not be accessible. Configure the service to run under a domain account with the necessary permissions. See [[Installation Middleware4j]].
* The printer must be available to the account that Middleware4j runs under. A Windows service running as the Local System account usually cannot see network printers; run the service under an account that can. See [[Installation Middleware4j]].
* No XSLT transformation is applied — the PDF is sent to the printer unchanged.


See also: [[Connectors]], [[Maps]], [[Installation Middleware4j]]
See also: [[Connectors]], [[Maps]], [[Installation Middleware4j]]


[[Category:Middleware4j]]
[[Category:Middleware4j]]

Latest revision as of 21:47, 9 November 2026

The PDF_PRINT connector watches a folder for PDF files and prints each one on a named printer. It is a simple way to print reports or documents produced as PDF files by Commander4j or any other program, without anyone having to open them.

PDF_PRINT is used as a pair: a PDF_PRINT input with a PDF_PRINT output. No stylesheet is involved and the PDF is printed as it is.

Map configuration

config.xml

<map>
   <id>Map06</id>
   <enabled>true</enabled>
   <description>Print PDF Document</description>
   <enableEmailNotifications>true</enableEmailNotifications>
   <connectors>
      <input>
         <id>in1</id>
         <description>Read PDF Document</description>
         <type>PDF_PRINT</type>
         <url>
            <path>./interface/input/Map06 PDF to PRINT</path>
            <mask/>
            <prefix/>
            <pollingInterval>1000</pollingInterval>
         </url>
      </input>
      <output>
         <id>out1</id>
         <enabled>true</enabled>
         <description>Print PDF Document to HP8600</description>
         <type>PDF_PRINT</type>
         <url>
            <path>./interface/output/Map06 PDF to PRINT</path>
            <prefix/>
            <fileExtension/>
            <use83GUID>false</use83GUID>
            <retainOriginalFilename>false</retainOriginalFilename>
         </url>
         <print>
            <queueName>HP8600</queueName>
         </print>
      </output>
   </connectors>
</map>
Setting Description
type PDF_PRINT on both the input and the output.
input mask Leave empty to pick up files ending in .pdf.
output path A working folder. The PDF is held here while it is being printed.
print / queueName The name of the printer, as shown in the list of printers on the computer running Middleware4j. Upper and lower case do not matter. Leave the <print> section out to use the default printer.

Note that queueName must be inside a <print> element.

The settings shared by all connectors are described on the Maps page.

How it works

  1. The input connector finds a PDF file and saves a copy to the log folder.
  2. The output connector moves the file to the output folder.
  3. The file is sent to the printer.
  4. Once it has been sent, the file is deleted from the output folder.

Use cases

  • Printing Commander4j reports that have been saved as PDF to a folder.
  • Printing documents produced by another system without manual intervention.
  • Routing print jobs: other systems drop PDF files into different folders on a share, and a map for each folder sends them to the right printer.

Notes

  • If the printer name is not recognised, the error email sent to the Error list includes the names of all the printers that Middleware4j can see. Copy the correct name from that list into queueName.
  • The printer must be available to the account that Middleware4j runs under. A Windows service running as the Local System account usually cannot see network printers; run the service under an account that can. See Installation Middleware4j.

See also: Connectors, Maps, Installation Middleware4j