Operating System - OpenVMS
1827894 Members
1518 Online
109969 Solutions
New Discussion

Re: "Printing" reports to PDF file

 
SOLVED
Go to solution

"Printing" reports to PDF file

Hello: You have helped me many times in the past (mostly searching the archives) and I hope you have help me again.

The question: How hard is it to create a print queue that will output PDF files rather than paper reports or to get the print stream output to a text file for conversion.

I am currently maintaining an old system (VAX 7000-630 running OpenVMS V7.1 and DECprint Supervisor V2.4, upgrades currently difficult if not impossible) which generate a large number of reports every night on our LP37 line printer. These reports are generated in a number of ways (COM jobs, cobol applications, APTuser/RTS V4.0 report generator).

We can currently redirect these to our HP9050 laser printers and they format correctly ($ SET ENTRY 'P1'/REQUEUE=LASER$PRINT/PARAM=(PAGE_ORIENT=LANDSCAPE)/FORM=LASER2) on the printer (compressed, page numbers, etc). The thought is to redirect them to a different print queue which would instead convert them to PDF files to be distributed and accessed when needed (and also save several trees a month).

My first thought was to simply use TXT2PDF (which I found reference to here, 2001, VMS mods by Craig Berry) to convert the source file but I ran into a problem. The file was truncated to 94 characters, which could be overcome I am sure, but I am not a C programmer and the obvious change (increasing the float page_width = 594.0; line) did not work. Also, since these are wide reports, getting them turned landscape and compressed would allow them to be printed on standard paper when needed, which is when I started thinking about using a print queue and possibly the stream to the printer as input or emulating the HP printer functions.

Any ideas, hints, or previous discussions pointed to would be greatly appreciated.
29 REPLIES 29
Hoff
Honored Contributor

Re: "Printing" reports to PDF file

Connect the EXECSYMB Freeware "print" symbiont package to Ghostscript or other PDF tools, or to whatever email redistribution process might be required.

Here, I'd probably not concentrate on PDF itself (as I think that conversion is secondary to the real "fun" here), and would initially look to use the provided MIME utility to send the existing text reports via multipart MIME mail messages, or to register the reports in a database.

EXECSYMB does most of what you need here, and the PDF message conversion or MIME mail message creation or the database operations can be conducted using (mostly) DCL.

Coding a custom print symbiont is easy (in the odd case that EXECSYMB isn't able to do or be extended to do what you need), and it would not surprise me to find a print-to-mail symbiont around. And if there is not such a symbiont around, again, a semi-custom print symbiont is (in the absence of unusual requirements) an easy project for sending mail or writing print files to a database or such.

If you're rolling your own, I've posted code to send mail using documented APIs, and there are other examples of that around.

Stephen Hoffman
HoffmanLabs LLC

Robert Gezelter
Honored Contributor

Re: "Printing" reports to PDF file

Steven,

I would suggest getting in touch with someone who is familiar with programming in C and PostScript and the related OpenVMS components for queue processing [disclosure: My firm does provide services in this area, as does Hoff's, Hein's, and several other regular contributors).

I recommend caution, and a [careful] review of the relevant print streams.

- Bob Gezelter, http://www.rlgsc.com
Oswald Knoppers_1
Valued Contributor
Solution

Re: "Printing" reports to PDF file

The mailsymbiont also supports converting ascii to pdf (based on the text2pdf tool by Phil Smith).

See http://oswald.knoppers.googlepages.com/mailsymhome
Jon Pinkley
Honored Contributor

Re: "Printing" reports to PDF file

Oswald Knoppers,

Thanks for the pointer to your mailsym. I will be trying it out.

Jon
it depends

Re: "Printing" reports to PDF file

Thank you all... That last entry may allow me a new direction to follow...
Craig A Berry
Honored Contributor

Re: "Printing" reports to PDF file

I have a revised version of Phil Smith's text2pdf.c, which I would like to attach here, but after literally dozens of failed attempts to do so over the last three days (using different browsers, different login sessions, and other variations), I'll see if I can post without an attachment.

In any case, text2pdf is a very different beast from the txt2pdf referenced in the original query. This one does landscape and has various other features. I've added command-line redirection for VMS (with code lifted from something Martin Vorlaender wrote a long time ago), left and top margin settings via command-line options, and I fixed a bug that caused it to blow up when converting a report in the hundreds of pages. If there is interest, I'll come up with a way of getting this to you, though likely not via the hateful, steaming pile of broken software known as the HP ITRC forums.

Re: "Printing" reports to PDF file

Craig: Thank you. That would be great. I don't know if you can figure out email addresses from this forum but you can send it to: sunderwood[at]sbsb.com

The first one I mentioned earlier is working for landscape (with a small change) but is currently chopping off the first line of every page so if I can get a working version rather than snooping through that one, all the better.

There is also a version of Phil's work inside Oswald's mailsym application. I am working on getting that working now as well but the more choices, the better.

Jon Pinkley
Honored Contributor

Re: "Printing" reports to PDF file

Craig,

Have you considered submitting your enhanced text2pdf to Hunter Goatley's Fileserv?

That is a better repository than ITRC, and there are mirrors, so it is highly available.

Jon
it depends
Craig A Berry
Honored Contributor

Re: "Printing" reports to PDF file

Hmm. What about a zipped copy of the .c file?
Craig A Berry
Honored Contributor

Re: "Printing" reports to PDF file

A miracle! All I had to do was zip the little 18K source file and the forum software accepted it. Wish I"d thought of that days ago. I also wish I knew what exactly it was about a very modest-sized .c file that it doesn't like. And while I'm wishing, what if it actually TOLD me my attachment didn't comply with some guideline or other and helpfully directed me to where those guidelines are posted rather than disappearing into the ether and giving me a completely blank page or the dreaded but frequent "Service unavailable" message?

OK, back to reality. I corresponded with Phil Smith a couple years ago and he was receptive to my changes and indicated he would be putting up a revised version including them on his new web site:

http://www.bagobytes.co.uk/

But there's still nothing there. I will construe his promise to include my changes in the next version as permission to redistribute my revised version, which the copyright in the file otherwise forbids.

I hadn't really thought about other places to distribute this -- it still seems like the best solution would be for the author to maintain it and provide the authoritative source.
Craig A Berry
Honored Contributor

Re: "Printing" reports to PDF file

And just as an example of how to use it:

$ text2pdf :== $dka0:[dir]text2pdf.exe
$ text2pdf -"L" -"mt20" -"ml20" -"s9" -"y1008" -"c175" < bigreport.txt > bigreport.pdf

That sets it to landscape with a top margin of 20 points, left margin 20 pixels, 9-point font, vertical page size of 1008 points (72 points per inch times 14 inches for legal size paper [default is letter size]), and lines up to 175 characters long (defaults to 80-character limit).
Dennis Handly
Acclaimed Contributor

Re: "Printing" reports to PDF file

>Craig: what if it actually TOLD me my attachment didn't comply with some guideline

Possibly the word "copyright" in the source?

>frequent "Service unavailable" message

I assume you couldn't do anything if you get these, except switch between forums12 to forums11 and vs.
Craig A Berry
Honored Contributor

Re: "Printing" reports to PDF file

Dennis, heck if I know whether it's looking at content, file extension, miscalculating file size and thinking it's too big when it's not, or any number of other rejection criteria that are, as far as I can find, completely opaque to the users of the site, undocumented in site policies, and unreported by the software generating the error conditions.

And if it is looking at content, it's anyone's guess what content is acceptable content and what's not. I'm certainly not going to illegally omit copyright notices when posting open source software just because the ITRC forum software incorrectly believes that to be a problem but doesn't have the backbone to tell me what it's rejecting and why. Oh, and if there's a good reason for rejecting content, then it should be smart enough to recognize such content inside a zip file.

I did try forums11 and forums12 and a few other names I guessed at. Of course, a working web site does not require me to guess at its internal architecture to work around its bugs. I also tried both standard and secure sessions and different browsers (Safari and Firefox), and I repeated attempts over a three-day period in case there was a traffic problem. None of this made any difference. Of course, numerous HP users over a period of years pointing out the serious defects in the forum software has not made the slightest bit of difference either.
Jon Pinkley
Honored Contributor

Re: "Printing" reports to PDF file

RE:"if there's a good reason for rejecting content, then it should be smart enough to recognize such content inside a zip file."

Perhaps it does, since I can't download the attachment.

Jon
it depends

Re: "Printing" reports to PDF file

I could not download using IE7 either but once I used FireFox and told it to download rather than open in IE (don't know why it would try that) I was able to save it and access it.

One question... both versions use the "< input > output" format. Why? I have never seen that format before now.
Craig A Berry
Honored Contributor

Re: "Printing" reports to PDF file

Steven,

The command-line redirection using angle brackets is a unixism that has become ubiquitous -- even DOS has it for goodness' sake. You can get it on VMS v7.0 and later using the PIPE command. But these utilities roll their own so you don't need the PIPE command. This means your I/O is not going through a pipe or a mailbox, which is probably not something you need to care about.

The other unixism is reading from standard input and writing to standard output with no options for specifying the input and output files as parameters. Whatever advantages and disadvantages there are to doing things this way, it's what the utilities did when I found them and I did not seek to change that. It does keep things simple - there is no filename processing, for example.

You can certainly get the same effect by redefining SYS$INPUT and SYS$OUTPUT before running the program.
Jon Pinkley
Honored Contributor

Re: "Printing" reports to PDF file

Steven,

Thanks for the tip, I was able to download with firefox. What is odd is that I was able to download a zip file I uploaded using IE7, but not this one.

This worked too, if you have wget on your VMS system.

$ wget --output-document=text2pdf.zip "http://forums.itrc.hp.com/service/forums/getattachment.do?attachmentId=310224&ext=.zip"

Jon

Jon
it depends
Craig A Berry
Honored Contributor

Re: "Printing" reports to PDF file

I've put it up here too if that's easier for anybody:

http://eisner.decus.org/~berry_c/text2pdf.zip
Wim Van den Wyngaert
Honored Contributor

Re: "Printing" reports to PDF file

http://forums12.itrc.hp.com/service/forums/questionanswer.do?threadId=1053459
contains a corrected version for wide files.

We use 1 script to convert the listings to pdf and mail it to a list of users.

Wim
Wim
Wim Van den Wyngaert
Honored Contributor

Re: "Printing" reports to PDF file

Enclosed the script to mail files. Could be of use too.
Note that this requires modification to run on your site (logicals ops&, txt2pdf in my version and BNT stuff replaced, ...).

Wim
Wim
Jan van den Ende
Honored Contributor

Re: "Printing" reports to PDF file

@Craig:

My guess about your difficulty uploading (and other's downloading) is that it might be to do with the file TYPE.

Most browsers try to make conclusions about the way to handle specific downloads by their file type.

USUALLY (but without guarantee!) a source file can better be renamed to .TXT, and than renamed back on VMS.
This certainly also applies for .COM files.

hoping to have been of some help,

Proost.

Have one on me.

jpe
Don't rust yours pelled jacker to fine doll missed aches.

Re: "Printing" reports to PDF file

Thank you all again... Oswald's solution is not building correctly on my VAX, probably more to do with my environment that the code itself...

Going to next try Wim's and Craig's solutions to see if I can get either one working... Trick is, I have the next 2 days off before the kids start school on Wednesday, so may not get to try them til them.

Re: "Printing" reports to PDF file

OK, I got Craig's version (of Phil Smith's) TEXT2PDF working and properly creating a working PDF file.

I am currently working with Wim's script but just found out mime.exe was released with V7.2. I, of course, am stuck on v7.1 for the forseeable future. I am currently working on this (found a few different possible applications) to see which will work here.

Thank you all once again.
Hoff
Honored Contributor

Re: "Printing" reports to PDF file

Look to mpack and munpack or such; the standard MIME tools are an option (where available), but various folks can find these and other similar MIME tools a better choice. Yes, even when the MIME tool is available.

Here's one port:

http://mvb.saic.com/freeware/freewarev50/mpack15/

There may be a newer port around.