Older multivalue application still print using a page format of either 132 chars by 66 lines or 80 chars by 60 lines. It would be nice if they could be converted to a PDF format for distribution. This is a simple Python script that can convert a .txt file to a PDF using a Python command line. The command line can be executed from a BASIC program. The landscape mode works only on 132×66 and the portrait mode only works with 80×60.
Usage: txt2pdf.py [land|port] inputpath.txt outputpath.pdf
Required: Needs the fpdf package. pip import fpdf
from fpdf import FPDF
orient = sys.argv
infile = sys.argv
outfile = sys.argv
if orient == “land”:
pdf = FPDF(‘L’, ‘in’, ‘Letter’)
font_height = 0.12
pdf = FPDF(‘P’, ‘in’, ‘Letter’)
font_height = 0.16
pdf.set_auto_page_break(True, margin = 0.25)
if orient == ‘land’:
pdf.set_font(‘Courier’, ”, 8)
pdf.set_font(‘Courier’, ”, 10)
f = open(infile)
for line in f:
10671 Techwoods Circle Cincinnati, Ohio 45242
Ashwood Computer, Inc. provides quality products and services that consistently meet our customer’s requirements, while continually searching for ways to improve them.
Our experienced project managers will help you successfully accomplish your goals on time and with optimum results! Our continuing success is attributed to the diverse backgrounds of our technical staff and our overall company drive for Total Customer Satisfaction!
ForeMost ERP is an impressive new ‘Hybrid’ Solution developed utilizing our mvTools.
ForeMost is dramatically improving our customers information systems and business operations. Moreover ForeMost provides our customers a significant competitive advantage!
© 2021 Ashwood Computer, Inc.
Ashwood Computer adheres to ISO 9001:2008 standards, a quality management system recognized around the world for quality design and production.