LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
LinkBack Search this Thread
Old 11-21-2007, 05:05 AM   #1
RobertoBech
Member
 
Registered: Dec 2003
Location: Rio de Janeiro
Distribution: Debian Squeeze
Posts: 54

Rep: Reputation: 15
Postscript: a few questions


I need to perform a few manipulations with postscript files, but before I dive into it I would like to know if these things are really possible, as I dont want to waste any time.

First of all, can I print to a ps file directly from the command line, or at least have a "postscript printer", so that whenever I send a job to it the printer creates a ps file somewhere?

The postscipt files I want will be the output from DOSEMU, a DOS emulator. It's basically plain text output. Suppose I want to take this output and extract some content from it - like, all lines that contain a certain word. Is it possible, or I won't be able to take content out of it?

The last one: is it possible to add an image to a postscript file?

Thank you all for your help...
 
Old 11-21-2007, 10:20 PM   #2
jschiwal
Moderator
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,263

Rep: Reputation: 562Reputation: 562Reputation: 562Reputation: 562Reputation: 562Reputation: 562
In kprinter, there are a couple options to print to pdf or print to postscript.

At work I use enscript to help convert a directory listing of a DVD backup disk to a postscript file. Then I use ps2pdf to convert in to a pdf. This is using cygwin in windows.
I pipe the output of ls through either sed or awk (I don't remember exactly) to produce a tab separated file. All of the dvd directory csv files are then sorted and enscript adds a nice looking header and page info. There are a number of text tools that can do this.

For example, to produce a postscript version of a manpage (which looks a lot better for reference than straight text) you can use "man -t topic >topic.ps"
 
Old 11-21-2007, 10:21 PM   #3
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 64
Quote:
Originally Posted by RobertoBech View Post
First of all, can I print to a ps file directly from the command line, or at least have a "postscript printer", so that whenever I send a job to it the printer creates a ps file somewhere?
You can print a ps file directly from the command line (in fact aside from plain text and pdf files, this is usually the only thing you might be able to print). Usually it goes like this:
Code:
lp foo.ps
Obviously, to be able to “print to postscript” without a GUI (which is very possible) you need some way for the program which is printing to create the file (usually it is in a GUI and you click a checkbox that says print to file or something). So whether or not the program in question can “print to postscript” without a GUI obviously depends on the program (e.g., I am pretty sure you can not get firefox to print a rendered html page from the command line).
Quote:
Originally Posted by RobertoBech View Post
Suppose I want to take this output and extract some content from it - like, all lines that contain a certain word. Is it possible, or I won't be able to take content out of it?
Look into something like ps2ascii (part of GPL Ghostscript) and pstotext
Quote:
Originally Posted by RobertoBech View Post
The last one: is it possible to add an image to a postscript file?
Of course it’s possible, but the difficulty of doing it (programatically or by hand) depends on many factors including they type of picture (raster or vector), its format, how/where you want to “add” the image, and what kind of existing file you have.
 
Old 11-22-2007, 03:43 AM   #4
billymayday
Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 120Reputation: 120
Look into cups-pdf which enables you to set up a cups printer that creates a pdf directly. Ypu can then print with lpr.

Works a treat for me
 
Old 11-22-2007, 11:01 PM   #5
choogendyk
Senior Member
 
Registered: Aug 2007
Location: Massachusetts, USA
Distribution: Solaris 9 & 10, Mac OS X, Ubuntu Server
Posts: 1,189

Rep: Reputation: 105Reputation: 105
Aside from issues of printing to postscript, configuring print commands, etc., PostScript is just a programming language. The files are ascii text. The language is pretty cool. It's reverse polish. If you have used one of the rpn calculators, you will have a sense for it. So, sure, you can edit PostScript files, modify them, send them to a printer, etc. If you have printed the graphic to PostScript, then you have the text format for that graphic. Editing it and inserting it into the proper place in another PostScript file is just a matter of understanding the language sufficiently to know where to put it. Or some trial and error.

Just as an example, I have a sample print page that I created on my Mac in Adobe Illustrator. I printed it to a file. I had put a line on it with the date and time of the print job and instructions to call me if it printed. Then I scp'd the file to my server. When I am testing a new printer configuration, one of the things I will do is vi this PostScript file, edit the date and time, and then send it to the printer using standard command line printing.
 
Old 11-28-2007, 07:59 AM   #6
RobertoBech
Member
 
Registered: Dec 2003
Location: Rio de Janeiro
Distribution: Debian Squeeze
Posts: 54

Original Poster
Rep: Reputation: 15
Thank you all for your opinions, I`ll check them all. Meanwhile, another question: which one is easier too work with to insert images, extract text etc: postscript or pdf files?
 
Old 11-28-2007, 12:00 PM   #7
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 64
Quote:
Originally Posted by RobertoBech View Post
which one is easier too work with to insert images, extract text etc: postscript or pdf files?
By far postscript is easiest to edit, no matter what type of editing you’re doing.
 
Old 11-28-2007, 01:37 PM   #8
RobertoBech
Member
 
Registered: Dec 2003
Location: Rio de Janeiro
Distribution: Debian Squeeze
Posts: 54

Original Poster
Rep: Reputation: 15
Great, so I`ll go with Postscript files. Now I need to find a way to print from DOSEMU to a postscript file, directly.

Does anybody know hot to redirect the output of a print job directly to a postscript file?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
postscript hyperlinks Tischbein Programming 2 07-10-2011 09:50 AM
Convert docs to postscript? okos Linux - Software 4 10-01-2007 09:17 PM
Need some help with Postscript robogymnast Programming 2 01-19-2006 02:56 PM
Postscript Files 0roy0m0 Linux - Software 1 01-16-2006 08:31 AM
Postscript Problem E-Oreo Linux - General 0 01-03-2004 06:21 PM


All times are GMT -5. The time now is 11:38 PM.

Main Menu
 
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
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration