LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-19-2006, 09:15 AM   #1
robogymnast
Member
 
Registered: Dec 2005
Location: Boston, USA
Distribution: Kubuntu, Debian
Posts: 78

Rep: Reputation: 16
Need some help with Postscript


I am working on a program in C++ that generates a Postscript file for bills that is sent to a printer. Basically it should print out a bill template with whoevers information put in the correct places on the form. Any help on these problems would be greatly appreciated.

1. The first bill is printed correctly, but a second page is printed out as well, with the correct form template but no information filled in - the name, address, amount owed, etc are empty.

2. The second bill prints one empty form, the correct bill, and then two empty forms.

3. After printing, the printer lcd flashes data recieved and keeps flashing that until you press the "Cancel Job" button

I haven't been able to find a good tutorial or anything online about postscript, all of what I have is from what one of the other employees told me might work and stuff I have managed to find through google, but I am mainly doing guess and check here.

Here is the contents of one of the PS files:
%!PS-Adobe
(PP2ND) run PP2ND
048 33750 2006pp341510 THE ZONE 1 VAN DE GRAAFF DR BURLINGTON MA01803 1 VAN DE GRAAFF DR 04892572006500000001800000107334 04892572006500000001800000107326 502 0000000000 0000000000 0000021960 0000000000 0000021960 0000000000 0000000000 0000000000 0000000000 000000000 000000000000000219600000000000000000038705000000038705000000000000 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000060170000000021465 0000000193530000000193520000000107330000000107320000000000000000000387050000000000000000000000000000 00000000000000000000 000000000 000000000 000000000 000000000 000000000 0003 Machiner 00021960000000000000000000000000000000000000000000TAX PERS.PROP 00000601700000000000000000000000000000000000000000000000000000000006/30/200509/30/200512/30/200503/31/200602/01/2005 00000001000000010733 000000010732 0000336091510 THE ZONE 0000000000000000336091510 THE ZONE 04892572006500000001800000000000 0274000000000000000000000000000000000000193530000000000000000000000000000000000000000000001935200000 0000000000000000000000000000000000000000107330000000000000000000000000000000000000000000001073200000 00000000000000000000000000000000000 000000000000000000000000000000000000 000000038705000000000000000000038705 000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 000000000021465
%%EOF


Any help is appreciated. Thanks!


Edit: If it helps, here is the C++ code generating the file
file << "%!PS-Adobe\n"
<< "(" << psfilename << ") run " << psfilename << "\n"
<< line.c_str() // line is the user's data to go on the bill, all in one line
<< "\n%%EOF\n";

Last edited by robogymnast; 01-19-2006 at 09:40 AM.
 
Old 01-19-2006, 01:31 PM   #2
utopicdog
Member
 
Registered: Aug 2003
Location: france
Distribution: suse/fedora
Posts: 105

Rep: Reputation: 15
if you are trying to print a bill, you really should do it in a device independant way, it is only the printer driver or filter that needs to know how to make postscript.
 
Old 01-19-2006, 02:56 PM   #3
robogymnast
Member
 
Registered: Dec 2005
Location: Boston, USA
Distribution: Kubuntu, Debian
Posts: 78

Original Poster
Rep: Reputation: 16
Think I got it to work, changed the C++ code to:

Code:
file << "%!PS-Adobe\n"
     << "(" << psfilename << ") run " << psfilename << "\n"
     << line.c_str() << "\n"
     << char(27) << "%-12345X" << char(27) << "E";
Used control codes I found here and added both "Universal Exit Language" (char(27) << "%-12345X") and "Reset" (char(27) << "E"). Seems to be working correctly now.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Postscript Files 0roy0m0 Linux - Software 1 01-16-2006 08:31 AM
Oversized Postscript fonts MWtee Mandriva 13 11-25-2004 01:25 PM
Best PDF and PostScript viewers R00ts Linux - Software 13 09-03-2004 06:14 AM
postscript or line printer jmdlcar Slackware 1 06-04-2004 09:08 PM
Postscript Problem E-Oreo Linux - General 0 01-03-2004 06:21 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:29 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration