0 Replies Latest reply on Sep 14, 2018 11:34 AM by Anders Bilfeldt

    Example of PDF file printing using Zebra Browser Print SDK

    Anders Bilfeldt

      Hi

       

      Does anyone have an example of how to print a PDF file using the Zebra Browser Print SDK?

       

      We have a simple test that is capable of printing a text using:

      function printTest() {
          BrowserPrint.getDefaultDevice('printer', function(printer)
              {
                  if((typeof printer != "undefined") && (printer.connection == undefined))
                  {
                      alert("No default printer found. " + "Setup a default printer in Zebra Browser Print.");
                          // give option to choose printer
                  }
                  else{
                      alert("Printer name: " + printer.name);
                      printer.send(format_start + txtToPrint + format_end);
                  }
              },
              function(error_response)
              {
                  // This alert doesn't pop either
                  alert("An error occured while attempting to connect to your Zebra Printer. " +
                      "You may not have Zebra Browser Print installed, or it may not be running. " +
                      "Install Zebra Browser Print, or start the Zebra Browser Print Service, and try again.");
              }
          );
          alert("After BrowserPrint"); //This alert pops up immediately instead of waiting
      }
      

       

      But the alert "Ater BrowserPrint" is shown immediately (and then the error), and we have no idea how to print a PDF file instead of raw text.

       

      Thanks.