Skip to content

Commit

Permalink
1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ikvk committed Dec 22, 2022
1 parent 8907c27 commit 70183c0
Show file tree
Hide file tree
Showing 9 changed files with 71 additions and 18 deletions.
22 changes: 16 additions & 6 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
pdf417as_str
============

Create pdf417 barcode without using images.
Create pdf417 barcode by special font without using images.

.. image:: https://img.shields.io/pypi/dm/pdf417as_str.svg?style=social

=================== ===========================================
Python version 3.3+
Expand All @@ -18,16 +20,24 @@ How it works

.. code-block:: python
pdf417_encoded_text = pdf417as_str.encode('https://github.com')
pdf417_encoded_text = pdf417as_str.encode417('https://github.com', columns=5)
3. Paste encoded text into any text editor.

::

+*xfs*prA*kuk*iDo*ixA*sxn*xdw*-
+*yog*slv*Arv*Fyg*tgE*fwg*zew*-
+*uny*BCj*iaw*jcE*AxD*ykx*pDw*-
+*ftw*sgf*AoC*dAc*ajb*ofA*yrx*-

3. Paste encoded text into any text editor and choose "Code PDF417" font. You will receive pdf417 barcode.
4. Choose "Code PDF417" font for text and adjust line spacing. You will receive pdf417 barcode.

.. image:: https://github.com/ikvk/pdf417as_str/blob/master/test/barcode.png

NOTE: With some font sizes there will be empty space between rows.
It will not affect to reading barcode, but you can find suited size anyway.
NOTE: Small empty space between rows not affects to reading barcode. Anyway you can find suited size.

Actually you can make png barcode, using pdf417as_str.convert.to_png, but this function not efficient.
Also you can make .png barcode using pdf417as_str.convert.to_png, but this function for tests and not efficient.

Installation
------------
Expand Down
4 changes: 4 additions & 0 deletions _docs/build-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
pip
setuptools
twine
wheel
23 changes: 23 additions & 0 deletions _docs/packaging_notes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Packaging
=========

https://packaging.python.org/tutorials/packaging-projects/

* Иногда для применения некоторых настроек билда нужно удалить старые папки билдов

1. Create .pypirc
C:\Users\v.kaukin\.pypirc
https://docs.python.org/3/distutils/packageindex.html#pypirc

2. Install/update build libs:
C:\python\venv\pdf417as_str\Scripts\pip install --upgrade -r C:\kvk\develop\Python\pdf417as_str\_docs\build-requirements.txt

3. Generating distribution archives
cd C:\kvk\develop\Python\pdf417as_str\
C:\python\venv\pdf417as_str\Scripts\python.exe C:\kvk\develop\Python\pdf417as_str\setup.py sdist

4. Check the distribution archives:
C:\python\venv\pdf417as_str\Scripts\python.exe -m twine check dist/*

5. Uploading the distribution archives:
C:\python\venv\pdf417as_str\Scripts\python.exe -m twine upload dist/*
12 changes: 12 additions & 0 deletions _docs/release_notes.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
1.0.0
=====
* encode fn renamed to encode417

0.4.1
=====
* License changed to LGPL-3.0
* The license change is agreed with Bazin Jean-Marie. PDF417 font.ttf is re-created.

0.2
=====
* First stable version: 7 Oct 2017
2 changes: 1 addition & 1 deletion pdf417as_str/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from .main import encode
from .main import encode417
6 changes: 3 additions & 3 deletions pdf417as_str/main.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import math


def encode(string, columns=-1, security=-1):
def encode417(string, columns=-1, security=-1):
"""
:param string: str, string to encode
:param columns: int, number of data columns, (columns < 1 - auto)
Expand Down Expand Up @@ -446,7 +446,7 @@ def modulo():
total = 0
for k in range(length):
total += (
ord(string[chain_index + j + k - 1: chain_index + j + k]) * 256 ** (length - 1 - k))
ord(string[chain_index + j + k - 1: chain_index + j + k]) * 256 ** (length - 1 - k))
# at Visual Basic 6 was this strange code:
# chain_mod = Format(total, "general number")
# I don't know what's this mean...
Expand Down Expand Up @@ -555,7 +555,7 @@ def modulo():
mc_correction[j] = (929 - (total * int(coef_rs[security][j * 3: j * 3 + 3])) % 929) % 929
else:
mc_correction[j] = (mc_correction[j - 1] + 929 - (
total * int(coef_rs[security][j * 3:j * 3 + 3])) % 929) % 929
total * int(coef_rs[security][j * 3:j * 3 + 3])) % 929) % 929
for j in range(k):
if mc_correction[j] != 0:
mc_correction[j] = 929 - mc_correction[j]
Expand Down
1 change: 0 additions & 1 deletion runtime.txt

This file was deleted.

17 changes: 11 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
from distutils.core import setup

with open("README.rst", "r", encoding='utf-8') as fh:
long_description = fh.read()

setup(
name='pdf417as_str',
version='0.4.1',
name='pdf417as-str',
version='1.0.0',
packages=['pdf417as_str'],
url='https://github.com/ikvk/pdf417as_str',
license='LGPLv3',
long_description=open("README.rst").read(),
author='v.kaukin',
author_email='[email protected]',
description='Create pdf417 barcode without using images.',
long_description=long_description,
long_description_content_type="text/x-rst",
author='Vladimir Kaukin',
author_email='[email protected]',
keywords=['pdf417', 'font', 'barcode', 'generate', 'noimage', 'python'],
description='Create pdf417 barcode by special font without using images',
)
2 changes: 1 addition & 1 deletion test/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
for test_i, test_value in enumerate(test_data):
test_text = test_value[0]
# make text code
code = main.encode(test_value[0], test_value[1])
code = main.encode417(test_value[0], test_value[1])
# make png
img_name = 'barcode' + str(test_i)
image = convert.to_png(code)
Expand Down

0 comments on commit 70183c0

Please sign in to comment.