New issue
Advanced search Search tips

Issue 734850 link

Starred by 2 users

Issue metadata

Status: Untriaged
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 2
Type: Bug



Sign in to add a comment

Request for printing ZPL codes directly to Generic/Text printer (100.000+ barcode printers use ZPL)

Reported by aladh...@eazyworks.com, Jun 20 2017

Issue description

UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.104 Safari/537.36

Steps to reproduce the problem:
1. Install Generic/Text printer and point driver to TCP/IP address of a ZEBRA label printer.
2. Run script below
3. Select the Generic/Text printer (1) 

What is the expected behavior?
Barcode label is printed by the ZEBRA printer

What went wrong?
Chrome does not support direct printing of text to a printer.  IE, EDGE and FF do. The code below runs perfectly in IE, EDGE and FF but not in Chrome.

Did this work before? No 

Chrome version: 59.0.3071.104  Channel: stable
OS Version: 10.0
Flash Version: 

CAN CHROME PLEASE ADD A FEATURE TO PRINT ZPL DIRECTLY?
ZPL IS USED BY 100.000+ BARCODE LABEL PRINTERS ALL OVER THE WORLD.

HERE IS EXAMPLE OF SIMPLE JAVASCRIPT CODE THAT WORKS PERFECTLY IN IE, EDGE AND FF. BUT NOT IN CHROME.....

==========================================
https://gist.github.com/Lakerfield/1b77b03789525c9d0f13ddfeedee2efa

<!doctype html>
<html lang="en">
<head>
  <title>Print ZPL from browser</title>
</head>
<body>
  <h1>Test page for print ZPL from browser!</h1>

  <script type="text/javascript">
    function printZpl(zpl) {
      var printWindow = window.open();
      printWindow.document.open('text/plain')
      printWindow.document.write(zpl);
      printWindow.document.close();
      printWindow.focus();
      printWindow.print();
      printWindow.close();
    }
  </script>

</body>

<input type="button" value="Print zpl" onclick="printZpl(document.getElementById('zplcode').value)" /><br/>
<textarea id="zplcode" cols="40" rows="20">^XA        
^FXTest ZPL^FS
^FO50,100
^A0N,89^FDHello ZPL^FS
^XZ
</textarea>

<p>Use the build in windows [Generic / Text Only] driver for your Zebra printer. Instead of the zebra driver. </p>

<p>Tested in: <b>Edge, Internet Explorer, Firefox</b></p>

<p>Not working in: Chrome (Chrome prints as image and not in text)</p>

</html>
==========================================

Procedure:

1 - Install in Windows a GENERIC / TEXT PRINTER DRIVER
2 - Point this Driver to TCP/IP adres of your ZEBRA printer
3 - Now in IE, EDGE and FF, you can print ZPL codes to your ZEBRA printer with code above.

BUT NOT IN CHROME....
 
Components: -Blink Internals>Printing
Labels: TE-NeedsTriageHelp
Requesting some one from printing team to look in to this issue.

Thanks. 

We have more and more industrial clients that make a switch from local software to web based cloud software and need printing of Barcodes in ZPL to Zebra printers directly from the browser.

And ZPL from Zebra is used almost everywhere in industrial manufacturing and in pharmacy for printing of barcode labels.

We prefer these clients to use Chrome...(;->).
Cc: rbpotter@chromium.org
Status: Available (was: Unconfirmed)
We have a Zebra label printer now so I was able to test this. Installed the printer via USB rather than TCP/IP since our label printer is USB only. I can verify Edge does seem to understand the ZPL when printing to the generic/text driver and prints it successfully. Actually can't seem to get Chrome to print to the printer with the generic/text printer driver at all - a print job spools and then immediately disappears, but nothing comes out of the printer. It prints successfully when the printer is installed with the Zebra driver, but just prints the text rather than the formatted "Hello ZPL". Will continue investigating.
Thanks for testing with a Zebra printer and confirming this issue.

In fact what Edge, IE and FF do, is just pass on the ZPL codes 1-on-1 to the Zebra printer via the Windows Generic Text printer driver.

Chrome seems to block or parse the ZPL codes or just does not seem to support the Windows Generic Text printer driver.

Zebra printers have been here for a long time and in the old days, RS-232 serial interface was used to send ZPL to the printer to print a batch of barcode labels at great speeds (for that time).

The challenge here now with web based / cloud applications is to generate ZPL codes in Javascript and send these codes 1-on-1 to the Zebra printers via the Windows Generic Text Driver. For our Zebra printer via TCP/IP and in your case via USB.

I only tested the javascript above via TCP/IP and works great in IE, Edge and FF. In your case, I understand the via USB works in Edge. Good to know!

Now we need this to work in Chrome...(;->).

It's definitely the driver that's the issue. I set up the generic text printer driver to print to file on Win 10 to take a look at what Chrome is generating, and it is a nearly-empty file each time. None of the page content makes it through, even with the GDI printing flag on. This holds for any page, not just the one in the example above.

Will look into options for getting this driver to work.
Project Member

Comment 6 by bugdroid1@chromium.org, Jul 11 2017

The following revision refers to this bug:
  https://pdfium.googlesource.com/pdfium/+/e8468c43cb3b14f4440456d19cb047150509949d

commit e8468c43cb3b14f4440456d19cb047150509949d
Author: rbpotter <rbpotter@chromium.org>
Date: Tue Jul 11 17:22:12 2017

Add Windows generic / text only printer driver support.

BUG=chromium:734850

Change-Id: Icc0947e2e99e77a36d8963fcf0b6d3deea161d3e
Reviewed-on: https://pdfium-review.googlesource.com/7194
Commit-Queue: Rebekah Potter <rbpotter@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>

[modify] https://crrev.com/e8468c43cb3b14f4440456d19cb047150509949d/core/fxge/cfx_renderdevice.h
[modify] https://crrev.com/e8468c43cb3b14f4440456d19cb047150509949d/core/fxge/win32/fx_win32_print.cpp
[modify] https://crrev.com/e8468c43cb3b14f4440456d19cb047150509949d/core/fpdfapi/render/cpdf_charposlist.cpp
[modify] https://crrev.com/e8468c43cb3b14f4440456d19cb047150509949d/core/fxge/win32/win32_int.h
[modify] https://crrev.com/e8468c43cb3b14f4440456d19cb047150509949d/public/fpdfview.h
[modify] https://crrev.com/e8468c43cb3b14f4440456d19cb047150509949d/public/fpdf_edit.h
[modify] https://crrev.com/e8468c43cb3b14f4440456d19cb047150509949d/core/fxge/win32/fx_win32_device.cpp
[modify] https://crrev.com/e8468c43cb3b14f4440456d19cb047150509949d/samples/pdfium_test.cc
[modify] https://crrev.com/e8468c43cb3b14f4440456d19cb047150509949d/core/fxge/cfx_renderdevice.cpp
[modify] https://crrev.com/e8468c43cb3b14f4440456d19cb047150509949d/core/fxge/cfx_windowsrenderdevice.h
[modify] https://crrev.com/e8468c43cb3b14f4440456d19cb047150509949d/fpdfsdk/fpdfview.cpp

Project Member

Comment 7 by bugdroid1@chromium.org, Jul 13 2017

The following revision refers to this bug:
  https://pdfium.googlesource.com/pdfium/+/38a01b9ceeddbbc73fb1167d30c5aa6994328949

commit 38a01b9ceeddbbc73fb1167d30c5aa6994328949
Author: rbpotter <rbpotter@chromium.org>
Date: Thu Jul 13 19:59:44 2017

Restore FPDF_SetPrintingPostscriptLevel API

Need to restore this API so builds without the chromium text driver CL
do not fail.

BUG=chromium:734850

Change-Id: I320e482a54bf1224817efee8b50113169353f9be
Reviewed-on: https://pdfium-review.googlesource.com/7830
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Rebekah Potter <rbpotter@chromium.org>

[modify] https://crrev.com/38a01b9ceeddbbc73fb1167d30c5aa6994328949/fpdfsdk/fpdfview.cpp
[modify] https://crrev.com/38a01b9ceeddbbc73fb1167d30c5aa6994328949/public/fpdfview.h

Project Member

Comment 8 by bugdroid1@chromium.org, Jul 14 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/bac0bc06a5e657c1899c2e9ba105f16919face2a

commit bac0bc06a5e657c1899c2e9ba105f16919face2a
Author: pdfium-deps-roller@chromium.org <pdfium-deps-roller@chromium.org>
Date: Fri Jul 14 01:09:29 2017

Roll src/third_party/pdfium/ 00c3cfdba..56fc9725f (31 commits)

https://pdfium.googlesource.com/pdfium.git/+log/00c3cfdbae07..56fc9725f05b

$ git log 00c3cfdba..56fc9725f --date=short --no-merges --format='%ad %ae %s'
2017-07-13 npm Add Embeddertest for password after saving
2017-07-13 rharrison Fix build of pdfium_diff when coverage is enabled
2017-07-13 npm Use PartitionAlloc with PartitionAllocReturnNull
2017-07-13 rbpotter Restore FPDF_SetPrintingPostscriptLevel API
2017-07-13 dsinclair Fix invalid write for util.printf
2017-07-13 dsinclair Cleanup CPDF_RenderOptions colour members.
2017-07-13 dsinclair Rename CPWL_Color to CFX_Color
2017-07-13 dsinclair Rename cfx_color to cxfa_color
2017-07-13 dsinclair Move CPWL_Utils::ScaleRect to CFX_FloatRect
2017-07-13 dsinclair Move CPWL_Utils::OverlapWordRange to CPVT_WordRange::Intersect
2017-07-13 dsinclair Move CPWL_Utils::GetCenterSquare to CFX_FloatRect
2017-07-12 dsinclair Use Translate instead of OffsetRect
2017-07-12 dsinclair Remove CPWL_Utils::{In,De}flateRect
2017-07-13 dsinclair Remove unused CPDF_RenderOptions members
2017-07-13 janeliulwq Changed CPDF_FileSpec::GetFileName() to directly return CFX_WideString
2017-07-13 npm Libtiff OOM upstream patch
2017-07-12 caryclark fix skiapaths for sparse type1 on mac
2017-07-11 hnakashima Added Callgrind instrumentation delimiters to pdfium_test.
2017-07-13 npm More unique_ptrs in JBig2 code
2017-07-13 reed Index_8 no longer supported, upscale to N32
2017-07-12 janeliulwq Basic APIs and test for retrieving embedded attachment count and name
2017-07-12 npm Nits in CFX_RenderDevice and CPDF_ContentParser
2017-07-05 caryclark support m_bGlyph_Adjust
2017-07-12 npm Remove unused methods from CPDF_ColorSpace
2017-07-11 janeliulwq Added helper functions in the class CPDF_FileSpec
2017-07-12 npm Move CMYKtoRGB methods to fx_codec and clean them up
2017-07-12 npm Cleanup ICC code part 1
2017-07-11 npm Cleanup CFX_RenderDevice
2017-07-11 janeliulwq Added API for removing objects from annotations
2017-07-11 npm Roll FT to cf8d9b4ce3fa2c6cd9ccb25585bc17a355c987b0
2017-07-11 rbpotter Add Windows generic / text only printer driver support.

Created with:
  roll-dep src/third_party/pdfium
BUG=734850,734850


Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+/master/autoroll/README.md

If the roll is causing failures, see:
http://www.chromium.org/developers/tree-sheriffs/sheriff-details-chromium#TOC-Failures-due-to-DEPS-rolls


TBR=dsinclair@chromium.org

Change-Id: Ibded48d9ebfdd4b0f23e1a451a5da45a1414e660
Reviewed-on: https://chromium-review.googlesource.com/571180
Reviewed-by: <pdfium-deps-roller@chromium.org>
Commit-Queue: <pdfium-deps-roller@chromium.org>
Cr-Commit-Position: refs/heads/master@{#486579}
[modify] https://crrev.com/bac0bc06a5e657c1899c2e9ba105f16919face2a/DEPS

Project Member

Comment 9 by bugdroid1@chromium.org, Jul 14 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/0437a171a47da67fc40a154dc26bcab9fae8bc25

commit 0437a171a47da67fc40a154dc26bcab9fae8bc25
Author: rbpotter <rbpotter@chromium.org>
Date: Fri Jul 14 21:23:42 2017

Add generic text printing

Depends on https://pdfium-review.googlesource.com/c/7194

BUG=734850

Review-Url: https://codereview.chromium.org/2970473002
Cr-Commit-Position: refs/heads/master@{#486892}

[modify] https://crrev.com/0437a171a47da67fc40a154dc26bcab9fae8bc25/chrome/browser/printing/pdf_to_emf_converter.cc
[modify] https://crrev.com/0437a171a47da67fc40a154dc26bcab9fae8bc25/chrome/browser/printing/print_job.cc
[modify] https://crrev.com/0437a171a47da67fc40a154dc26bcab9fae8bc25/chrome/browser/printing/print_job.h
[modify] https://crrev.com/0437a171a47da67fc40a154dc26bcab9fae8bc25/chrome/browser/printing/print_view_manager_base.cc
[modify] https://crrev.com/0437a171a47da67fc40a154dc26bcab9fae8bc25/chrome/utility/printing_handler.cc
[modify] https://crrev.com/0437a171a47da67fc40a154dc26bcab9fae8bc25/pdf/pdf.cc
[modify] https://crrev.com/0437a171a47da67fc40a154dc26bcab9fae8bc25/pdf/pdf.h
[modify] https://crrev.com/0437a171a47da67fc40a154dc26bcab9fae8bc25/pdf/pdf_engine.h
[modify] https://crrev.com/0437a171a47da67fc40a154dc26bcab9fae8bc25/pdf/pdfium/pdfium_assert_matching_enums.cc
[modify] https://crrev.com/0437a171a47da67fc40a154dc26bcab9fae8bc25/pdf/pdfium/pdfium_engine.cc
[modify] https://crrev.com/0437a171a47da67fc40a154dc26bcab9fae8bc25/pdf/pdfium/pdfium_engine.h
[modify] https://crrev.com/0437a171a47da67fc40a154dc26bcab9fae8bc25/printing/pdf_render_settings.h
[modify] https://crrev.com/0437a171a47da67fc40a154dc26bcab9fae8bc25/printing/print_settings.h
[modify] https://crrev.com/0437a171a47da67fc40a154dc26bcab9fae8bc25/printing/print_settings_initializer_win.cc

Please try this out on the latest Canary and see if this is working any better now. The example you shared above as well as another example from a user in https://crbug.com/381914 comment 2 both work here with a Zebra GK420d using the generic/text only driver on Windows 10. If you find any issues, please update this bug.

Comment 11 by rki...@gmail.com, Jul 24 2017

Hello,

I have the same issue, on IE,EDGE,Firefox, Safari, print to a generic text only printer is working as expected, in chrome 	55.0.2883.87 (Official Build) m (64-bit), the output is only a Form Feed character.

The Chrome Canary, have an different behavior, the output have the characters that I need to send to the printer, but the CRLF character for each line is missing.


Thanks in advance
Project Member

Comment 12 by bugdroid1@chromium.org, Jul 27 2017

The following revision refers to this bug:
  https://pdfium.googlesource.com/pdfium/+/663e02dfadabb0b7e1049cc7a9a8fe11a0f5bed7

commit 663e02dfadabb0b7e1049cc7a9a8fe11a0f5bed7
Author: rbpotter <rbpotter@chromium.org>
Date: Thu Jul 27 00:02:33 2017

Text Driver: add CLRF characters for new lines

CLRF characters seem to still work with label printer drivers, and some
users want to preserve these characters when printing. We cannot
distinguish new lines due to CLRF characters in the original text from
new lines created during layout, so just add the characters to all new
lines.

Bug: chromium:734850
Change-Id: I4d032a311c33e20a27b2cc1d5d0ba3eb9ef2fd41
Reviewed-on: https://pdfium-review.googlesource.com/9110
Commit-Queue: Rebekah Potter <rbpotter@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>

[modify] https://crrev.com/663e02dfadabb0b7e1049cc7a9a8fe11a0f5bed7/core/fxge/win32/fx_win32_print.cpp

RE: comment 11, can you try the latest Canary (62.0.3169.0) and see if it is any better? There should be CLRF characters for each line break now.
Hi! if Generic/Text Only will allow to pass RAW ASCI data to printer, 
then it will be also possible to print ESC/POS commands ( whole POS industry uses ESCPOS format )
p.s wiki info about RAW Printing found here ... https://github.com/qzind/tray/wiki/What-is-Raw-Printing
Labels: Needs-Feedback
For Chrome 62.0.3169.0 or above (so currently Dev or Canary), does the ZPL example above (or others) work in Chrome? If not, please share examples that do not work so we can see if there is a way to fix them.

RE: comment 14, do you have any example webpages that use these commands that we could look into? It may also make sense to open a new bug, since this one is specifically about ZPL codes.
rbpotter@chromium.org,
As you suggested i've opened new issue here with example and info
https://bugs.chromium.org/p/chromium/issues/detail?id=764669
Project Member

Comment 17 by sheriffbot@chromium.org, Sep 13

Labels: Hotlist-Recharge-Cold
Status: Untriaged (was: Available)
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue.

Sorry for the inconvenience if the bug really should have been left as Available.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot

Sign in to add a comment