Linux - GeneralThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
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?
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"
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
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?
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.
Distribution: Solaris 9 & 10, Mac OS X, Ubuntu Server
Posts: 1,189
Rep:
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.
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?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.