Commit Graph

45 Commits

Author SHA1 Message Date
Romain Porte b64b534394 Add methods for simpler newlines (#246) 2017-08-01 17:09:24 +02:00
Patrick Kanzler f8a2174108 fix typo 2017-07-27 23:06:59 +02:00
csoft2k 1f57b04974 Paper sensor querying command (#242)
The DLE EOT command allows querying the status of several features of
the printer.
Added to the online/offline status developed in #237, this commit adds a
paper sensor querying.

Tested with an Epson TM-T20II, which only has an end-paper sensor. The
near-end paper sensor should be tested with a compatible printer.
However, the implementation is quite straight-forward.
2017-07-27 23:05:50 +02:00
csoft2k 82c67aa646 Fix tabs behaviour (#238)
The changes done in this commit should help with the open issues:
#5, #27 and #161.
The old implementation lacked the NUL char at the end of the command, as
defined on the Epson ESC/POS Reference Guide (see
https://reference.epson-biz.com/modules/ref_escpos/index.php?content_id=53
). Also, the horizontal tab control character (CTL_HT) shouldn't be
there.

This implementation allows setting up to 32 tabs with a given tab width.
Both values are checked to be in the valid ranges defined on the guide.
Also, the TabPosError exception text has been rewritten to define the
stated above.
2017-07-26 10:01:08 +02:00
Romain Porte 9e47ff2505 Added test for cut without feed, fixed raw code for it 2017-07-26 09:09:32 +02:00
Romain Porte 9bc3b30a60 Optional feed for cut (closes #213) 2017-07-26 09:09:32 +02:00
Romain Porte 5bd6dcf471 Ensure QR codes have a border large enough (#235)
*  Ensure QR codes have a border large enough
(The QR code spec requires a border at least 4*box_size thick but we can't
 just set border=16 because that results in a QR code more than 255px tall
 and I'm not yet ready to use fullimage() as a backend for it)
This fix was originally commited by Stephan Sokolow on 2014-05-22
* Let the user print stuff using qr example
* fix tests
2017-07-24 15:04:54 +02:00
csoft2k 89dfb6cf86 Added the DLE EOT querying command. (#237)
* Added the DLE EOT querying command.
Added a function to check whether the printer is online or not, as well
as a reading method for USB printers.
* Update AUTHORS
* Add entry to .mailmap
* currently USB only
2017-07-24 13:57:02 +02:00
Patrick Kanzler 83b426f5fd Merge pull request #222 from MicroJoe/software-barcode
First implementation of software barcode
2017-06-19 12:57:05 +02:00
Romain Porte c4dd4f2960 Added ImageWidthError and its implementation (#226)
* Added ImageWidthError and its implementation

* Added unit tests for ImageWidthError

* Parse max_width to int before compare
2017-05-23 15:13:28 +02:00
Romain Porte 22cf6ad00b Allow users to change impl for soft_barcode 2017-05-22 20:21:35 +02:00
TAHRI Ahmed 1f427953a8 Preliminary support of pos 'line display' printing 2017-05-22 00:40:40 +02:00
Romain Porte a6e1d0df00 Using booleans for handling text size 2017-05-21 22:50:07 +02:00
Romain Porte c0b4d03692 Updated documentation of set method 2017-05-21 22:50:07 +02:00
Romain Porte a16d6bde06 Refactor of the set method, with tests 2017-05-21 22:50:07 +02:00
Romain Porte 737cc3176e First implementation of software barcode
Actually the hardware barcode implementation is very specific and not
generic enough for just adding a `soft_render=True` argument to it. This
is a first work that can be improved with other commits, maybe for
merging this method in the `barcode` method after some cleanup.

The width, height and text_distance were set using empiric
print-and-retry tests so that the generated barcode looks nice to the
eye (and to the eye of an Android scanner tool.

!WARNING! Printing a barcode that is too large in width will result in
the printer to go crazy trying to print an image that is too large for
it. This may be fixed by raising an exception in the `image` method.
2017-05-16 20:56:27 +02:00
Romain Porte 4b04a5c425 Fixed bad format of :code: in documentation 2017-05-14 21:33:43 +02:00
Dmytro Katyukha a7ee11a78c Bugfix in `control` method. print_and_feed default `n=1` 2017-03-29 15:24:36 +02:00
Dmytro Katyukha abbe32f845 Refactored `cut` method. added `print_and_feed` method 2017-03-29 15:24:25 +02:00
Dmytro Katyukha 29cc8baab7 Handle cases when fullCut or partCut not available 2017-03-29 15:24:25 +02:00
Patrick Kanzler 3ee787e8b1
change license to MIT 2017-01-31 03:55:50 +01:00
Patrick Kanzler fb18bb34cc
normalize imports 2017-01-30 02:15:40 +01:00
Patrick Kanzler 94a0f2b94b
normalize whitespace 2017-01-30 01:57:36 +01:00
Patrick Kanzler ce94a1fc18
normalize whitespace 2017-01-30 01:52:26 +01:00
Patrick Kanzler c2fc464c55
reformat PEP8 and similar issues 2017-01-30 00:10:14 +01:00
Thijs Triemstra 7bf6a1791b Correct fragment_height documentation default (#198) 2017-01-25 23:56:06 +01:00
Michael 10c589ae8d swap default fragment height to 960 2016-10-04 14:01:26 +11:00
Patrick Kanzler cd38cdf74e Merge pull request #170 from miracle2k/text-encoding
Text encoding
2016-09-29 19:23:54 +02:00
belono a82fefb301 Add support for custom cash drawer kick sequence 2016-09-15 22:54:35 +02:00
Michael Elsdörfer b37f4fc8cc Merge branch 'capabilities' into text-encoding 2016-08-30 13:36:53 +02:00
Michael Elsdörfer ea7769f8b2 Merge remote-tracking branch 'origin/development' into capabilities 2016-08-30 13:04:17 +02:00
Michael Elsdörfer 5fa89ff685 Automatically choose correct barcode function.
Tests for barcode function.
2016-08-30 13:02:58 +02:00
Michael Elsdörfer a07f84a5bc Match the current printer-db format. 2016-08-30 12:26:09 +02:00
Michael Elsdörfer c7864fd785 Largely rewrite the magic text encoding feature. 2016-08-27 11:28:52 +02:00
Michael Elsdörfer f6ce7e45da Merge branch 'capabilities' into text-encoding 2016-08-26 15:29:31 +02:00
Michael Elsdörfer 214aa0d363 Fix issue with manually setting the encoding. 2016-08-26 15:14:02 +02:00
Michael Elsdörfer 632a104219 Fix docstring warning. 2016-08-26 11:59:40 +02:00
Michael Elsdörfer 8b5bc9cf8a Make the Escpos class accept a profile.
This is now used for the block_text function.
2016-08-26 10:41:01 +02:00
Michael Elsdörfer 07d47765aa Allow linespacing reset. Make this the default. 2016-08-26 10:38:36 +02:00
Michael Elsdörfer 854b75be30 Support changing the line spacing. 2016-08-26 10:34:52 +02:00
Patrick Kanzler 798893caee
refactor access of private member _img of qrcode
Since version 2.5 python-qrcode allows the direct access of the
PIL-functions. (We require version 4 and above).
Thus, we can simply call qr_img.convert() without accessing the private
member.
This refactoring is identical in functionality.
2016-08-15 23:24:06 +02:00
Patrick Kanzler e8d91a6735
test add type-check for the qr-printing 2016-08-15 23:23:07 +02:00
Patrick Kanzler 0cfedb5706 add automatic codepage-changing
This code is adapted from the works by Frédéric Van der Essen in
pyxmlescpos.
I had to adapt the code completely in order to make it compatible with
modern unicode-handling

Further changes:
* improve text unittests in CLI and MagicEncode with hypothesis
* add feature force_encoding in order to enable old behaviour
* disable cli_text_test (for now)
* fix charcode(): it does now cooperate with the new structure
* remove redundant variable codepage from class Escpos
2016-08-02 04:42:21 +02:00
Patrick Kanzler 2ecf73074c
improve large image printing
images longer than 1024 pixels will be split into multiple fragments.
2016-08-02 00:04:43 +02:00
Patrick Kanzler 87438f9efa
SETUP move code to src
This way we can ensure that the packaged code is tested.
See https://hynek.me/articles/testing-packaging/ or c62a78c015

+ DOC adapt doc to new structure and test doc with travis
2016-06-20 17:48:14 +02:00