Skip to main content

Create PostScript page (including barcodes) using Python objects

Project description

pypostscript

Create A4 Portrait PostScript output with Python Objects

Version 0.1:

Portrait A4 only 4 Font choices TextLines Code39Barcodes Code93Barcodes Circles Rectangles

Usage

Example of usage:

from pypostscript.barcode import Code39Barcode, Code93Barcode
from pypostscript.shapes import Circle, Rectangle
from pypostscript.text import HelveticaBoldFont, TextLine, TimesPlainFont
from pypostscript.page import Page


def sample_page():
    page = Page()
    page.extend(TextLine(x_pts=40,
                         y_pts=740,
                         font=HelveticaBoldFont(size_pts=22),
                         text='A Test Portrait Page'))
    page.extend(TextLine(x_pts=40,
                         y_pts=650,
                         font=TimesPlainFont(size_pts=12),
                         text='PostScript library, test portrait page.'))
    page.extend(Code39Barcode(x_pts=40,
                              y_pts=500,
                              chars='ABC123'))
    page.extend(Code93Barcode(x_pts=40,
                              y_pts=400,
                              chars='ABC987'))
    page.extend(Rectangle(x_pts=30,
                          y_pts=390,
                          width_pts=170,
                          height_pts=185,
                          line_width_pts=2))
    page.extend(Circle(centre_x_pts=80,
                       centre_y_pts=150,
                       radius_pts=72,
                       line_width_pts=1))
    return page

if __name__ == '__main__':
    page = sample_page()
    print page.render()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pypostscript-0.1.7.tar.gz (112.6 kB view details)

Uploaded Source

File details

Details for the file pypostscript-0.1.7.tar.gz.

File metadata

File hashes

Hashes for pypostscript-0.1.7.tar.gz
Algorithm Hash digest
SHA256 4c9f44e9df343361819c925426720071330b6d076aa81f4dbe5821086f8313c4
MD5 c02e65b38324b21d2302e0ed84d1f826
BLAKE2b-256 3a8d28142177b72b6886ab65b002467b57b1ae9d12185756f4aa07705b3aa06e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page