<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to Developers:Java_Printing_Notes</title><link>https://sourceforge.net/p/wubiq/wiki/Developers%253AJava_Printing_Notes/</link><description>Recent changes to Developers:Java_Printing_Notes</description><atom:link href="https://sourceforge.net/p/wubiq/wiki/Developers:Java_Printing_Notes/feed" rel="self"/><language>en</language><lastBuildDate>Tue, 24 Nov 2015 17:46:59 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/wubiq/wiki/Developers:Java_Printing_Notes/feed" rel="self" type="application/rss+xml"/><item><title>Developers:Java_Printing_Notes modified by Federico Alcantara</title><link>https://sourceforge.net/p/wubiq/wiki/Developers%253AJava_Printing_Notes/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v22
+++ v23
@@ -36,7 +36,7 @@
     throw new RuntimeException("Oops!, you don´t have any printer");
     }
     // It is a good practice to check if the selected PrintService can handle the document.
-    if (!printService.isDocFlavorSupported(DocFlavor.INPUT_STREAM.PNG) {
+    if (!printService.isDocFlavorSupported(DocFlavor.INPUT_STREAM.PNG)) {

     throw new RuntimeException("Printer can't handle png´s");
     }
@@ -66,14 +66,14 @@
     // Open the PDF document
     InputStream pdfDoc = new FileInputStream("My_Document.pdf");
     // Wubiq can convert PDF to Pageable. This document must be closed after printing.
-    Pageable pageable = PdfUtils.pdfToPageable(pdfDoc);
+    Pageable pageable = PdfUtils.INSTANCE.pdfToPageable(pdfDoc);
     try {

     printerJob.setPageable(pageable);
     printerJob.print(requestAttributes);
     } finally {

-    PdfUtils.closePageable(pageable);
+    PdfUtils.INSTANCE.closePageable(pageable);
     }

 #### _**Pageable / Printable behavior**_
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Federico Alcantara</dc:creator><pubDate>Tue, 24 Nov 2015 17:46:59 -0000</pubDate><guid>https://sourceforge.net446a590faad4264c1391ef86cb89af6871d50e7e</guid></item><item><title>Developers:Java_Printing_Notes modified by Federico Alcantara</title><link>https://sourceforge.net/p/wubiq/wiki/Developers%253AJava_Printing_Notes/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v21
+++ v22
@@ -81,3 +81,7 @@
 As you can see Pageable and Printable interface are treated as DocFlavor.SERVICE_FORMATTED, and this means that the service formats or interprets the document sent to it. So you will see that the same document might look different when printed from different operating system platform or printers (PrintService).

 When printing try to use a PDF renderer if your printer supports PDF documents. Converting PDF to images does not produce good quality output. Converting PDF to Pageable produces the most accepted output, but each implementation of the print service handle it differently thus producing different visible output from the same report and data. 
+
+#### _**Dot Matrix / ESCP/2 Printers**_
+
+Most dot matrix printers can receive print command with Epson ESCP/2 compatible commands. Non-windows drivers outputs the document with acceptable resolution. However is never closed to direct printing as Windows driver does. So if your network includes printing to Dot Matrix connected to non-windows computers, you might want to take a look at wubiq's API to print using TextPageable, which enables clearer and better quality printing. 
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Federico Alcantara</dc:creator><pubDate>Thu, 26 Jun 2014 21:07:05 -0000</pubDate><guid>https://sourceforge.netb6dff1f63e34d2971daa3831baba60716647f047</guid></item><item><title>Developers:Java_Printing_Notes modified by Federico Alcantara</title><link>https://sourceforge.net/p/wubiq/wiki/Developers%253AJava_Printing_Notes/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v20
+++ v21
@@ -78,6 +78,6 @@

 #### _**Pageable / Printable behavior**_

-As you can see Pageable and Printable interface are treated as DocFlavor.SERVICE_FORMATTED, and this means that the service formats or interprets the document sent to it. So you will see that the same document might look different when printer from different operating system platform or printers (PrintService). 
+As you can see Pageable and Printable interface are treated as DocFlavor.SERVICE_FORMATTED, and this means that the service formats or interprets the document sent to it. So you will see that the same document might look different when printed from different operating system platform or printers (PrintService). 

-When printing try to use a PDF renderer if your printer supports PDF documents. Converting PDF to images does not produce good quality output. 
+When printing try to use a PDF renderer if your printer supports PDF documents. Converting PDF to images does not produce good quality output. Converting PDF to Pageable produces the most accepted output, but each implementation of the print service handle it differently thus producing different visible output from the same report and data. 
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Federico Alcantara</dc:creator><pubDate>Thu, 26 Jun 2014 21:07:04 -0000</pubDate><guid>https://sourceforge.net035e3e2cba48f76f9ebc71bc70e446eafcdec5fe</guid></item><item><title>Developers:Java_Printing_Notes modified by Federico Alcantara</title><link>https://sourceforge.net/p/wubiq/wiki/Developers%253AJava_Printing_Notes/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v19
+++ v20
@@ -75,3 +75,9 @@

     PdfUtils.closePageable(pageable);
     }
+
+#### _**Pageable / Printable behavior**_
+
+As you can see Pageable and Printable interface are treated as DocFlavor.SERVICE_FORMATTED, and this means that the service formats or interprets the document sent to it. So you will see that the same document might look different when printer from different operating system platform or printers (PrintService). 
+
+When printing try to use a PDF renderer if your printer supports PDF documents. Converting PDF to images does not produce good quality output. 
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Federico Alcantara</dc:creator><pubDate>Thu, 26 Jun 2014 21:07:04 -0000</pubDate><guid>https://sourceforge.netb33490b9ca9a31fa0a7901b02c3f7bc4c68f8979</guid></item><item><title>Developers:Java_Printing_Notes modified by Federico Alcantara</title><link>https://sourceforge.net/p/wubiq/wiki/Developers%253AJava_Printing_Notes/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v18
+++ v19
@@ -2,7 +2,7 @@

 ## PrintService Attributes DocFlavor DocPrintJob PrinterJob...

-Unfortunately, to take full advantage of Wubiq, you must become familiar with the Java Printing API. While you can dig deep into it, this section will clarify the most relevant topics. 
+To take full advantage of Wubiq, you must become familiar with the Java Printing API. While you can dig deep into it, this section will clarify the most relevant topics. 

 ### **PrintService: Where to print**

@@ -56,7 +56,7 @@
     throw new RuntimeException("Printer not available");
     }
     // Get a new instance of PrinterJob. You must first set it up to let Wubiq handle the printing routing.
-    // The initialization is only required once, calling it multiple times is not harmful.
+    // The initialization is only required once per JVM instance, calling it multiple times is not harmful.
     PrinterJobManager.initializePrinterJobManager();
     PrinterJob printerJob = PrinterJob.getPrinterJob();
     // Sets the print job and print request attributes. Notice that OrientationRequested also implements PrintRequestAttribute
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Federico Alcantara</dc:creator><pubDate>Thu, 26 Jun 2014 21:07:04 -0000</pubDate><guid>https://sourceforge.net04cd7ba2e8c6516eb1eabac3434576c073e22c2c</guid></item><item><title>Developers:Java_Printing_Notes modified by Federico Alcantara</title><link>https://sourceforge.net/p/wubiq/wiki/Developers%253AJava_Printing_Notes/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v17
+++ v18
@@ -57,8 +57,9 @@
     }
     // Get a new instance of PrinterJob. You must first set it up to let Wubiq handle the printing routing.
     // The initialization is only required once, calling it multiple times is not harmful.
-    PrinterJobManager.initialize();
+    PrinterJobManager.initializePrinterJobManager();
     PrinterJob printerJob = PrinterJob.getPrinterJob();
+    // Sets the print job and print request attributes. Notice that OrientationRequested also implements PrintRequestAttribute
     PrintRequestAttributeSet requestAttributes = new HashPrintRequestAttributeSet();
     requestAttributes.add(MediaSizeName.NA_LETTER);
     requestAttributes.add(OrientationRequested.LANDSCAPE);
@@ -68,9 +69,9 @@
     Pageable pageable = PdfUtils.pdfToPageable(pdfDoc);
     try {

-    printerJob.setPageable(pageable)
-    printerJob.print(requestAttributes)
+    printerJob.setPageable(pageable);
+    printerJob.print(requestAttributes);
     } finally {

-    PdfUtils.closePageable(pageable)
+    PdfUtils.closePageable(pageable);
     }
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Federico Alcantara</dc:creator><pubDate>Thu, 26 Jun 2014 21:07:04 -0000</pubDate><guid>https://sourceforge.net3dd317be28e66ace831a167e9ec68e6b79522821</guid></item><item><title>Developers:Java_Printing_Notes modified by Federico Alcantara</title><link>https://sourceforge.net/p/wubiq/wiki/Developers%253AJava_Printing_Notes/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v16
+++ v17
@@ -49,14 +49,28 @@
     // Then set the print job and print request attributes
     PrintRequestAttributeSet requestAttributes = new HashPrintRequestAttributeSet();
     requestAttributes.add(MediaSizeName.NA_LETTER);
-    printJob.print(doc, requestAttributes);// Open the PDF document
-    InputStream pdfDoc = new FileInputStream("My_Document.pdf");
-    // Wubiq can convert PDF to Pageable. This document must be closed.
-    Pageable pageable = PdfUtils.pdfToPageable(pdfDoc);
-    try {
+    printJob.print(doc, requestAttributes);// Let's gather the PrintService first
+    PrintService printService = PrintServiceLookup.lookupDefaultPrintService()
+    if (printService == null) {

+    throw new RuntimeException("Printer not available");
+    }
     // Get a new instance of PrinterJob. You must first set it up to let Wubiq handle the printing routing.
     // The initialization is only required once, calling it multiple times is not harmful.
     PrinterJobManager.initialize();
     PrinterJob printerJob = PrinterJob.getPrinterJob();
+    PrintRequestAttributeSet requestAttributes = new HashPrintRequestAttributeSet();
+    requestAttributes.add(MediaSizeName.NA_LETTER);
+    requestAttributes.add(OrientationRequested.LANDSCAPE);
+    // Open the PDF document
+    InputStream pdfDoc = new FileInputStream("My_Document.pdf");
+    // Wubiq can convert PDF to Pageable. This document must be closed after printing.
+    Pageable pageable = PdfUtils.pdfToPageable(pdfDoc);
+    try {
+
     printerJob.setPageable(pageable)
+    printerJob.print(requestAttributes)
+    } finally {
+
+    PdfUtils.closePageable(pageable)
+    }
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Federico Alcantara</dc:creator><pubDate>Thu, 26 Jun 2014 21:07:04 -0000</pubDate><guid>https://sourceforge.net00213f352fa192e9a3a26ea82e42b723e876aa4a</guid></item><item><title>Developers:Java_Printing_Notes modified by Federico Alcantara</title><link>https://sourceforge.net/p/wubiq/wiki/Developers%253AJava_Printing_Notes/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v15
+++ v16
@@ -55,4 +55,8 @@
     Pageable pageable = PdfUtils.pdfToPageable(pdfDoc);
     try {

-    PrinterJob printerJob = PrinterJob.
+    // Get a new instance of PrinterJob. You must first set it up to let Wubiq handle the printing routing.
+    // The initialization is only required once, calling it multiple times is not harmful.
+    PrinterJobManager.initialize();
+    PrinterJob printerJob = PrinterJob.getPrinterJob();
+    printerJob.setPageable(pageable)
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Federico Alcantara</dc:creator><pubDate>Thu, 26 Jun 2014 21:07:04 -0000</pubDate><guid>https://sourceforge.net03da286eba586c8fdba776d72620d968ba8071e5</guid></item><item><title>Developers:Java_Printing_Notes modified by Federico Alcantara</title><link>https://sourceforge.net/p/wubiq/wiki/Developers%253AJava_Printing_Notes/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v14
+++ v15
@@ -49,4 +49,10 @@
     // Then set the print job and print request attributes
     PrintRequestAttributeSet requestAttributes = new HashPrintRequestAttributeSet();
     requestAttributes.add(MediaSizeName.NA_LETTER);
-    printJob.print(doc, requestAttributes);
+    printJob.print(doc, requestAttributes);// Open the PDF document
+    InputStream pdfDoc = new FileInputStream("My_Document.pdf");
+    // Wubiq can convert PDF to Pageable. This document must be closed.
+    Pageable pageable = PdfUtils.pdfToPageable(pdfDoc);
+    try {
+
+    PrinterJob printerJob = PrinterJob.
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Federico Alcantara</dc:creator><pubDate>Thu, 26 Jun 2014 21:07:04 -0000</pubDate><guid>https://sourceforge.net3f8ad3ddba93f2124608ac25c596d29caf3e6ee3</guid></item><item><title>Developers:Java_Printing_Notes modified by Federico Alcantara</title><link>https://sourceforge.net/p/wubiq/wiki/Developers%253AJava_Printing_Notes/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Federico Alcantara</dc:creator><pubDate>Thu, 26 Jun 2014 21:07:04 -0000</pubDate><guid>https://sourceforge.net840c2d7c7225617e4efc54235645bbaa8a20df31</guid></item></channel></rss>