PDF Printing

Zebra has regularly heard feedback from the developer community about your mobile and web based applications that output PDF reports, documents and shipping labels for printing. The standard label printer is unable to directly process PDF formatted documents, without requiring middleware software to convert PDFs into formats the printer can understand. This adds additional challenges for developers and customers.

Zebra Development Services provides solutions that enable your business to keep up with the growing demand for devices that are mobile, intelligent and connected to the cloud. We've heard you and we've created an on-printer application that allows Link-OS printers to directly receive and print PDFs without requiring conversion or middleware.

For more information, read the attachment in the linked post to understand how applications are now able to send PDF documents directly to Link-OS printers.  Zebra Technologies - PDF Printing through Link-OS PDF Virtual Device

A full sample code application using PDF Virtual Device for Zebra Printers can be found here.

Comments


Hi Robin,

thanks for your post. I have one question: We have a QLN 220 Printer with Link-OS PDF Virtual Device but we don't know how to send PDF Files to the printer. We can't find any example or usefull SDK Api documentation. We use the native Android SDK. Can you tell we in detail how we have to send a PDF File?

Thanks in advance,

Mirco


Hi Mirco,

I haven't tried it on Android yet, but the way the PDF Virtual device works, you should be able to just send your PDF as a file.  Try something like this code (using the Android SDK)

import com.zebra.sdk.comm.Connection;

import com.zebra.sdk.comm.ConnectionException;

import com.zebra.sdk.comm.TcpConnection;

import com.zebra.sdk.device.ZebraIllegalArgumentException;

import com.zebra.sdk.printer.ZebraPrinter;

import com.zebra.sdk.printer.ZebraPrinterFactory;

import com.zebra.sdk.printer.ZebraPrinterLanguageUnknownException;

public class SendPDFExample {     

     public static void main(String[] args) throws Exception {         

          Connection connection = new TcpConnection("192.168.1.100", TcpConnection.DEFAULT_ZPL_TCP_PORT);         

          try {             

             connection.open();             

             ZebraPrinter printer = ZebraPrinterFactory.getInstance(connection);

             printer.sendFileContents("/sdcard/documents/sample.pdf");         

          } catch (ConnectionException e) {             

             e.printStackTrace();         

          } catch (ZebraPrinterLanguageUnknownException e) {

              e.printStackTrace();

          } catch (ZebraIllegalArgumentException e) {

              e.printStackTrace();

          } finally {

              connection.close();

          }

       }

}


Hi Robin,

thank you very much. It's easy and working. Sometimes we can't see the wood for the trees


Thank you a lot, Robin The guide on PDF printing is of great help to my work. Best regards.


Robin, do we have a sample for IOS?

thanks


Hi Hector, From the developer standpoint it's the same as sending any file.

#import "TcpPrinterConnection.h"

#import <UIKit/UIKit.h>

#import "ZebraPrinter.h"

#import "ZebraPrinterFactory.h"

TcpPrinterConnection *zebraPrinterConnection = [[TcpPrinterConnection alloc] initWithAddress:@"192.168.1.101" andWithPort:6101];

BOOL success = [zebraPrinterConnection open];

NSError *error = nil;

id<ZebraPrinter,NSObject> printer = [ZebraPrinterFactory getInstance:zebraPrinterConnection error:&error];

// Send file to the printer

BOOL sent = [[printer getFileUtil] sendFileContents:@"/Documents/sample.pdf" error:&error];

if (error != nil || printer == nil || success == NO || sent == NO) {

  UIAlertView *errorAlert = [[UIAlertView alloc] initWithTitle:@"Error" message:[error localizedDescription] delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil];

  [errorAlert show];

  [errorAlert release];

}

[zebraPrinterConnection close];

[zebraPrinterConnection release];


Hi Timo,

What you have should work fine.  Are you getting an error? 

The PDF printing is not part of any SDK, but an application you load on the printer to handle PDF documents directly.  PDF Direct - Virtual Device | Zebra

Robin


Hi Timo,

The .NET SDK dll is in the  Link-OS Multiplatform SDK | Zebra download. 

You can send the file a number of ways, but if you are using a Windows Mobile/CE device, this is probably easiest.  You can send the file to the printer over TCP, Bluetooth, USB, or nearly any other communication method supported by your printer.  You don't have to use our SDK, but we have built in some API's to make it easier.  What kind of documentation are you looking for?

Robin


Hi Timo,

On most OS's there are native APIs for just opening a standard TCP socket, opening and reading a file, and sending it to the socket.  Sending Files using TCP - CodeProject .  The default ports (depending on the printer) are 6101 and 9100. 

If you want to use a standard printer without the virtual device, you have to convert the PDF on the app side. You can convert it to some image types that the printer will take directly.  Most PDF converter libraries we've looked at are either expensive or not very good.  iOS is the only OS we've looked at that has a decent native PDF converter.

Hope this helps,

Robin


Update: for windows .NET:

-link ZSDK_API.dll to project

ZebraPrinterConnection zc = new TcpPrinterConnection("192.168.100.111", TcpPrinterConnection.DEFAULT_CPCL_TCP_PORT);

            zc.Open();

            ZebraPrinter zp = ZebraPrinterFactory.GetInstance(zc);

            FileUtil fu = zp.GetFileUtil();

            fu.SendFileContents(@"C:\SomeFile.pdf");

            zc.Close();

Is there any documentation on this?

Is there a version for .NET printing of PDF to the Virtual Device?


No, it works fine, I just needed the DLL from the SDK to send the PDF to the Virtual Device Equipped printer. Or is there any other way to send the file? I don't have any documentation on the Virtual Device sadly (as I cannot find any)


Besides an installation manual (how to get the virtual device to the printer) I had no other documentation. I have the SDK you mentioned, but it doesn't mention anything on the PDF Virtual Device. But no worries, the functionality I wanted has been achieved, I can print PDF on my Zebra Printer from my program .

Do you have any infos on how I could do it without you API? Not that I want to change my programm, more out of technical curiosity.

Thanks for the support.


Hi,

I need to print PDF generated from a web app (using SSRS and export to PDF) to a S4M printer, but unfortunately I cannot find PDF Virtual Device for this printer.

Can you point me where to find this device?

Otherwise, what other options I have to be able to print labels from a web application.

The web application is hosted in cloud and the users are accessing it over internet.

While the S4M printer is local (either connected through USB or as network printer).

Thank you


Hi, could you help me with the error below?

com.zebra.sdk.comm.ConnectionException: Error writing to connection: ZDesigner ZM600 200 dpi (ZPL).

The error occurs in the line below:

ZebraPrinter printer = ZebraPrinterFactory.getInstance(connection);


Robin, do we have a sample for Xamarin.iOS?

thanks


Robin, do we have a sample for Xamarin.iOS?

thanks


Robin,  Unfortunately, not true. When trying to print it gives the printer a hint that there is something you want to print. But printing is not done. Note that the printer used is IMZ320. And through Bluetooth

I want to help . Thanks


Robin, Unfortunately, not true. When trying to print it gives the printer a hint that there is something you want to print. But printing is not done. Note that the printer used is IMZ320. And through Bluetooth

I want to help . Thanks


Hi Musab, I'll post something a little later today. 


Hi Musab,

My MAC is being finicky today so I can't test, but the following "should" work.

/***********************************************
CONFIDENTIAL AND PROPRIETARY
The source code and other information contained herein is the confidential and the exclusive property of
ZIH Corp. and is subject to the terms and conditions in your end user license agreement.
Copyright ZIH Corp. 2017
ALL RIGHTS RESERVED
***********************************************/
using System;
using LinkOS.Plugin;
using LinkOS.Plugin.Abstractions;
using System.IO;

namespace iOS_PDF_Xamarin
{
    class PrintHelper
    {

        public void Run()
        {
            new System.Threading.Thread(print).Start();
        }

        private void print()
        {
            string address = "TCP:10.80.127.56";
            //string zpl = "^XA^LL200^FO30,20^A0N,30,30^FDHello World^FS^XZ";
            IConnection connection = null;
            IZebraPrinter printer = null;

            try
            {
                if ((connection == null) || (!connection.IsConnected))
                {
                    connection = ConnectionBuilder.Current.Build(address);
                    connection.Open();
                    printer = ZebraPrinterFactory.Current.GetInstance(PrinterLanguage.ZPL, connection);
                }
                if (CheckPrinterStatus(printer))
                {
                    var documents = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
                    var filename = Path.Combine(documents, "SAMPLE.PDF");
                    printer.SendFileContents(filename);
                    //connection.Write(Encoding.ASCII.GetBytes(zpl));
                }
            }
            catch (Exception e)
            {
                //if the device is unable to connect, an exception is thrown
                Console.WriteLine(e.ToString());
                if (connection != null)
                    connection.Close();
            }
            finally
            {
            }
        }
        private bool CheckPrinterStatus(IZebraPrinter printer)
        {
            IPrinterStatus status = printer.CurrentStatus;
            if (!status.IsReadyToPrint)
            {
                Console.WriteLine("Printer in Error: " + status.ToString());
            }
            return true;
        }
        /*private bool SetPrintLanguage(IConnection connection)
        {
            string setLanguage = "! U1 setvar \"device.languages\" \"zpl\"\r\n\r\n! U1 getvar \"device.languages\"\r\n\r\n";
            byte[] response = connection.SendAndWaitForResponse(Encoding.ASCII.GetBytes(setLanguage), 500, 500);
            string s = Encoding.ASCII.GetString(response);
            if (!s.Contains("zpl"))
            {
                Console.WriteLine("Not a ZPL printer.");
                return false;
            }
            return true;
        }*/
    }
}


Zebra does offer a PDF Virtual Device for Link-OS printers: PDF Direct - Virtual Device | Zebra


Any information about this problem. Help me


Same problem ..... why ?

There must be a Virtual Device


Should I buy it so we can printing process?


Hi,

We have a QLN420 with Link OS and PDF license.
We are trying to print from SAP but nothing is coming out. It triggers the printer but it just feeds blank pages.

Do we setup the device as a PDF printer in SAP and send the spool to it or are we supposed to send the file direct to it via tcp ?


Hi Daniel, i don't understand if is necessary to buy PDF Virtual Device for print any pdf document in Xamarin.Forms project [for Ios and Android] or if is not necessary (and if is possible by blutooth connection).

Thanks in Advance,

Nicola


Hello Steve,

we use SAP and a lot of ZEBRA printers in our plants in US and have the same problem/Questions similar to yours.

Did you ever got an answer or figured it out yourself ?

Thanks in advance

Hans


I never got a reply that made much sense from Zebra in terms of ABAP/Config.

The Direct PDF add-on for the printer requires that the PDF in base64 to be sent direct to the printer via a TCP port

That can’t be easily done in ABAP, so why they are saying it’s a solution for SAP in a bit confusing.

What you can do, and how we resolved it, was to setup the mobile printers on a print server, not direct from SAP.

When connected directly to a PC, you can send a PDF to it without doing anything special because it has a PCL driver and windows does the rest.

Do not use the ZPL driver, use the PCL driver on the print server.

Setup the printer in SAP as a PDF1 with access type U

Then call FM ADS_CREATE_PDF_SPOOLJOB with the base64 as an xstring.

This does not need the PDF Direct add-on.


Thanks for your quick reply. I have had similar experiences as you.
Your solution with the ADS-function is very interesting, because next in 2018 we start also with mobile label printers.

Our labels are Adobe forms in SAP. The PDF of the ADS is sent to ZT410 printers defined as device type PDF1 with Berkeley protocol. On the Windows print-servers the SAPsprint/SAPPDFprint-Services run. The Zebra printers are connected to the print-servers. But we use the zebra printer driver from Bartender (Seagull). Depending on the orientation, landscape or portrait and the label dimensions must be set. It works, but unfortunately it is not very flexible.

My question: when I would test the ADS-function, which driver should I take for the ZEBRA printer ?


thanks
Hans


That function module only works for SAP printers that have type PDF1


Hi Hans,

In Adobe Forms, you should have the capability to utilize the device types that were created by Adobe, for the Zebra printers.  If I recall correctly, the device types that were created by Adobe are named AZPL200, AZPL300, and AZPL600, with the last 3 numbers referring to the DPI (dots per inch) of the printer.  The device types are used to output the native Zebra programming language called ZPL.  In an ideal Zebra printing application, the printer receives ZPL.  This enables faster processing printer side, better quality barcodes, and lowers the amount of network traffic as the file is more often smaller than when sending an image.

Some customers decide that the PDF is their ideal output.  This approach requires that the PDF routes through a driver and converts the PDF to an image that the printer understands.  You mentioned that you are using the Seagull driver.  You can also try using the Zebra Printer drivers (available on the Zebra website) designed to work on Windows.  Zebra also recently introduced a solution called "PDF Direct".  The allows a PDF to bypass a windows driver and be processed directly in the printer.  This solution requires a purchased license per printer. 

My suggestion is that you try to use the IFbA device types.  If you are using the interactive portion of IFbA, then we may need to modify the approach to your printing solution.  If this is the case, please comment so we can discuss further.

Best Regards,

John Ramsey


Hi Hans,

Zebra has only created device types to handle the SAPScript Upload method where the ZPL is wrapped around SAPScript.  This solution is tied to the Zebra Designer for MySAP Business Suite or other tools designed to output ZPL, including manual coded ZPL.  These device types are:

For SAP Release 4.6C and greater.

ZLB_ZEB.PRI, S9162.CPA (for Scalable fonts - IBM™ CP850)

ZLB_ZEBU.PRI (for Andale and Swiss 721 fonts - Unicode UTF-8)

The other device types created by Zebra support Smart Forms.  These are the ZLZEB and YZB named device types.  The IFbA device types are created by Adobe.  Zebra has no device types that work with this solution at this point. 

________________________________________________________________________________

The PDF Direct solution is available through your reseller or purchasing from the Zebra website.  The URL below is where the license can be purchased

https://www.zebra.com/us/en/products/software/barcode-printers/link-os/pdf-virtual-device.html

Please note that the PDF Direct solution is only available on LinkOS printers.  You should be able to use any device type that outputs a PDF, and then route that to the printer directly.

PDF Direct works with LinkOS printers regardless of they are mobile or tabletop.

________________________________________________________________________________

I think that if you use the SAPWIN driver, and you have a windows printer, you should easily be able to load the Zebra Windows Driver and route the job to the printer.

This is an example of how that process would work:

Print Job in SAP >>>

          Routes through SAPWIN device type >>>

                    SAPWIN sends image to WIN Print Server >>>

                              WIN Print Server routes through Zebra Win Driver >>>

                                        Zebra Win Drivers sends to printer / Prints label

This solution should work unless you decide to move away from having a Windows Print Server managing the print solutions.

________________________________________________________________________________

If you need additional information, please send an email to sapinfo@zebra.com and jramsey@zebra.com


Hi Hans,

The process for PDF Direct would be:

Print Job in SAP as PDF >>>

Routes through SAPWIN device type (maybe another PDF Device type) >>>

Win Spooler sends to Zebra printer ZT410 with PDF direct / Prints label

There is no need to pass the PDF to a windows driver.  If you still want to use the Windows Printer Spooler/Server, you can do so but will need to pass the PDF through a raw or generic text driver. The reason for this is you do not want anything to be added to the print output.  The Zebra Windows driver takes the image it receives, converts it to one that the printer understands, and then passes it to the printer.

Best Regards,

John


Hello John,

Thanks for the answer. I will test it as an alternative to our current solution.

There's stiil a question in my mind. How can I turn the output by 90° without a driver ?

All our labels are designed in format landscape, e.g. 4x2inch, 6x4 inch.......

Today we turn the label in the windows driver by 90° and print portrait format with max. 4 inch width.

How can I turn the output without an driver ? In the printer configuration there's no parameters to turn the output.

Hans


Hi Hans,

Rotation can only be performed by a Windows Driver after it is sent from SAP.  The reason for this is that the output file is coming down as an image or ZPL with a specific orientation.  The windows driver can make the rotation modification on the fly.  If ZPL is the output then it is hardcoded with a specific rotation.  The only way to change the rotation in ZPL is to modify it with the correct rotation ZPL. 

Is there a reason why you are not rotating it to portrait directly from SAP?

John


Hello John,

you proposed a raw or generic text driver. I saw that there's a parameter for label orientation !!!

Thanks for your support.

Hans


Hi Hans,

The raw or generic driver will not change the orientation (when sending ZPL) as it is designed as a passthrough.   I am not sure what the results would be if you were sending a PDF.  It may rotate a PDF, so my suggestion would be to try it and let me know the results.

The problem arises when you send a PDF to the printer with the PDF direct solution.  The reason for this is that the PDF has its rotation already set within its code. I am not sure if a raw/generic driver can actually manipulate the PDFcode set.  Again, this is one of those things that is best tested to see the results.

John


Hello John,

the orientation in SAP is part of the Adobe livecycle designer. The orientation depends on the width/length of the label and is set automatically. You can't change it manually.

I tried it with "Form calc" instructions in the XML, but I couldn't change the orientation in SAP..

Our current solution works like this: Landscape in Adobe > portrait orientation in the windows driver >> landscape output on ZEBRA

                                                       Landscape in Adobe > landscape orintation in win driver             >> portrait output on ZEBRA (rotation 90°)

and so on.

Hans


Hi John,

yes I will test it and I'll tell you the results. I have to talk with our dealer to get a test "PDF print".

It will last, and first it is christmas.

best regards, merry christmas and a happy new year

Hans


Hi Hans,

This sounds like an issue within Adobe Livecycle Designer.  Let me ping Adobe to see if there is a solution for rotation.  They sometimes take a long time to respond, but hopefully they will have a solution.

John


Hi Hans,

Maybe your local reseller will have a printer with Direct Print loaded on it so that you can test it before you purchase a license.  If you desire the PDF Direct license immediately, you can purchase it online from Zebra. 

PDF Direct - Virtual Device | Zebra

Merry Christmas and a Happy New Year to you and yours as well!

John


Hello Steve,

I wrote my question wrong, i meant. which printer driver do you use on the print server?

Hans


Hello John,

thanks for your suggestion. In the past I tested different printer types in SAP, the AZPL-drivers, the Zdesigner-driver on the print server.

But at the end I hope to find a Zebra supported solution.

We are using the IFbA only for print output. Adobe livecycle designer is our first choice for all forms, also for bigger forms for thermal printers (min. 1x2inch). For mini forms like part labels (e.g. 0.5x1.5inch) we use the printer programming language.

With the PDF format we are independant of the printer. Laser printers are no problem, but thermal printers. We can't use only 1 brand, because the technical support worldwide is very different. So we have 3 different brands.

I am very interested in the PDF direct. Could you give me concrete instructions how to realize it ? Which SAP printer type, SAP protocol type, do we need SAPsprint, which driver on the print server ?

In 2018 we will start with mobil printers e.g. QLN420 like Steve told it. Will PDF direct work with it ?

I would be grateful for any advice

Hans


Hello John,

thanks for your suggestion. In the past I tested different printer types in SAP, the AZPL-drivers, the Zdesigner-driver on the print server.

But at the end I hope to find a Zebra supported solution.

We are using the IFbA only for print output. Adobe livecycle designer is our first choice for all forms, also for bigger forms for thermal printers (min. 1x2inch). For mini forms like part labels (e.g. 0.5x1.5inch) we use the printer programming language.

With the PDF format we are independant of the printer. Laser printers are no problem, but thermal printers. We can't use only 1 brand, because the technical support worldwide is very different. So we have 3 different brands.

I am very interested in the PDF direct. Could you give me concrete instructions how to realize it ? Which SAP printer type, SAP protocol type, do we need SAPsprint, which driver on the print server ?

In 2018 we will start with mobil printers e.g. QLN420 like Steve told it. Will PDF direct work with it ?

I would be grateful for any advice

Hans


Hi John,

thanks for your detailed explanation. I miss the PDF direkt.

Does this process description - nearly the same like yours - will work with PDF direct ?

Print Job in SAP as PDF >>>

          Routes through SAPWIN device type >>>

                    SAPWIN sends image to WIN Print Server (SApsprint/SAPPDFprint) >>>

                              WIN Print Server routes through Zebra Win Driver (Zdesigner driver) >>>

                                        Zebra Win Drivers sends to Zebra printer ZT410 with PDF direkt / Prints label  ?