LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   lpr command to scale a postscript to A3 paper (https://www.linuxquestions.org/questions/linux-general-1/lpr-command-to-scale-a-postscript-to-a3-paper-567841/)

n34tsd 07-09-2007 10:13 AM

lpr command to scale a postscript to A3 paper
 
Hi all, I've got this problem that I've been trying to solve for some time but nothing so far seems to work. Basically I need to print a postscript file (which is actually a screenshot of a program) to A3 paper, using the lpr command if possible. The problem now is that when I print it to an A3 paper, the screenshot only fills up around 1/4 of the paper, which is like an A4 size. I need to scale it to fill the whole A3 paper.

I've tried searching around and have tried different commands like
lpr -Zmedia=A3 -Zscaling=100 snapshot.ps
lp -omedia=A3 -oscaling=100 snapshot.ps
lpr -ZPageSize=A3 -Zscale=10 snapshot.ps

things like that. But none of them seems works. The only time I got it to fill the whole paper was when I used GIMP to scale and print it...but that's not what I want. I want to use command line only, if possible. Does anyone have any solutions or suggestions? I'm currently using Redhat 7.1, with LPRng 3.7.4-22 installed. I can't change my redhat or LPRng version due to some restrictions.

Any suggestions would be greatly appreciated. Thanks in adv.

tredegar 07-09-2007 12:16 PM

There's a program/script called poster that will do all sorts of things from the CL
It can scale, rotate, and even print an image across multiple pages. Perhaps it will help you.
See this thread, from last month:
http://www.linuxquestions.org/questi...14#post2798514
D/L the program from the link in (my) post #4 and take a look at its manual.ps

& welcome to LQ!

n34tsd 07-10-2007 04:31 AM

Thanks a lot! I'll try it tomorrow in the office and will let you know the results.

Tinkster 07-10-2007 05:00 AM

And there's psresize

Code:

psresize -PA3 infile outfile

Cheers,
Tink

n34tsd 07-10-2007 07:59 PM

OK, here's the update. When i execute this command
poster -mA3 -pA3 snapshot.ps -o outfile

the postscript file did get resized to fit an A3 paper nicely. I haven't tested printing it yet, I only did a gv outfile to see a preview. The problem is, some parts that was in my original postscript file didn't get converted and saved into the outfile.

I'm not sure whether there's such a thing as layers for postscript file, because the "background" portion of my ps file got converted but not the "foreground" portion. So now all I see in the outfile is the background of my original ps file in A3 size. Any idea? In the meantime I'll try to see if I can like...compress the ps file and convert it again.

Thanks a lot of your help!

Tinkster 07-10-2007 08:08 PM

No idea about poster, but did you try psresize?



Cheers,
Tink

n34tsd 07-10-2007 08:40 PM

Quote:

Originally Posted by Tinkster
And there's psresize

Code:

psresize -PA3 infile outfile

Cheers,
Tink


Hey, it works! Executed psresize -pA3 infile outfile though and it resized just the way I wanted. Thanks a lot Tinkster & tredegar for your help!

n34tsd 07-10-2007 10:25 PM

Hi, having a small problem again. The psresize commands works beautifully on my machine. However, if I were to execute the same command on another machine, or even on a postscript file that is on a network-mounted directory, the output file will be exactly the same as the original file. But when I resize it on my own machine (local directory), it works just fine. I can resize an A4 postscript to A3. Any idea what could be the problem? All the machines are on redhat 7.1

The only difference is that mine is on VMware.

Tinkster 07-11-2007 02:10 AM

The first thing that springs to mind would be permission
problems ... what happens if you create the resized file
on the local filesystem when the original resides on the
network? e.g.

psresize -PA3 /path/to/share/file.ps ~/new_files.ps



Cheers,
Tink

n34tsd 07-11-2007 03:33 AM

Yup, I initially thought that it was a permission problem. But the output file can be written to the network-mounted drive, so it's unlikely to be permission problem.

I kinda found out the cause of problem already, though I don't really know why. Apparently, I have to execute ps2ps on the original postscript file and then run psresize on the output file. For example, the program that generates the original postscript file is called screenshot.ps

So I have to run:
ps2ps screenshot.ps outfile.ps
psresize -pA3 outfile.ps final_outfile.ps

If I were to simply run psresize on screenshot.ps, nothing would change. But if I were to execute ps2ps or maybe open it in Gimp and save it, psresize will work. I guess some formatting is lacking in the original postscript file, thus psresize wouldn't work. At least I learn something new today, and I got my problem solved =D

Thumbs up for LQ, wouldn't have done it without the help of you guys!


All times are GMT -5. The time now is 10:32 AM.