[Info-vax] Does anyone know of a PDF writter for OVMS?

Jan-Erik Soderholm jan-erik.soderholm at telia.com
Wed Sep 17 15:00:09 EDT 2014


bdhobbs18 at acm.org wrote 2014-09-17 20:15:
> On Wednesday, August 6, 2014 4:35:50 PM UTC-7, Len Whitwer wrote:
>> Have been able to find reader but no writer.
>
> A few years ago I wrote a TPU script that processes plain text files
> into a PDFs on VMS.  I think any competent programmer should be able to
> do this in most any VMS language.  Get the PDF documentation from Adobe,
> use Ghostscript on a PC to make an uncompressed PDF for reference, use
> Adobe reader to test the results.  A C program would run much faster,
> but I didn't have a VMS C compiler.
>

There are far easier ways that doesn't force you to read
any technical PDF documentation or trying to read a
PDF files to finf the internal format.

I've used ReportLab from Python, http://www.reportlab.com/
available in the prebuilt Python kit:
http://www.vmspython.org/doku.php?id=downloadandinstallationpython

The 27-line script below reads a text file (an old
lineprinter report) and creates a similar PDF file:

---------------------------------------------------------------
$ type TXT2PDF.PY
# -*- coding: latin1 -*-

from reportlab.pdfgen import canvas
from reportlab.lib.pagesizes import A4
from reportlab.lib import units, pagesizes
from reportlab.lib.units import mm

c = canvas.Canvas("mlr07.pdf",pagesizes.landscape(pagesizes.A4))

tpos = 15
start = 200
pline = 0
line_int = 4
Printed = False

c.setFont('Courier', 10)

for line in open('mlr07.lis', "r"):
   if line.startswith("\f"):
      if Printed:
         Printed = False
         c.showPage()
         c.setFont('Courier', 10)
      line = line[1:]
      pline = 0
   if line.endswith("\n"):
      line = line[:-2]
   uniLine = unicode(line, 'latin-1')
   c.drawString(tpos*mm, (start-(pline*line_int))*mm, uniLine)
   pline = pline + 1
   Printed = True

c.showPage()
c.save()
$
---------------------------------------------------------------

Example text file and PDF file are available here:
http://jescab2.dyndns.org/pub_docs/mlr07.lis
http://jescab2.dyndns.org/pub_docs/mlr07.pdf




More information about the Info-vax mailing list