Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Ghostscript : positionning an image on the top

Status
Not open for further replies.

cypressm

Programmer
Jul 24, 2003
18
FR
Hi,

With Linux, I've got a PS file containing an image. You can find it here :


I want to transform this PS file into PCL file (to be printed on laserjet) using GhostScript. I use the following command :

gs -q -dNOPAUSE -dBATCH -sDEVICE=laserjet
-sOutputFile=sky.pcl -c save pop -f sky.ps


The result file is here :


The problem is that the image is printed on the bottom of the page and is not entire !

For you to see the result, I transform the file into pdf doing :

pcl2pdf sky.pcl sky.pdf

you can see the result here :


As you see, the result is not correct.

Question : how can I do to print the image on the top/left at coordinate (0:0) instead of the bottom ? Is there an option in GhostScript ?

Thanks for your help.

Cypressm
--------
 
Where to start... this isn't an error.

Looking at the PostScript code, the bounding box of the image is 0 0 339 179.

Since PostScript uses a measuring system based on the lowerleft hand corner of the page, your image will start there (0,0) and fill a rectangle 339 points wide, 179 points high.

Converting it to PCL doesn't alter that, GhostScript just interprets the PostScript.

I don't know much about Ghostscript, sorry to say, but in PostScript you would use the "translate" and "scale" operators to alter the position and size of the image.



Thomas D. Greer
 
Forbidden
You don't have permission to access /images/sky.pcl on this server.



Could you fix this please. I would like to look at the PCL codes. Thanks eh.
 
Hi,

sky.pcl is now accessible on this server :)

tgreer : thanks for your reply, i'm going to test some manipulations on my PS file tomorrow.

Bye
 
At the very top of the file, do your translate, in the form: x y translate

So to print starting 1 inch up and 1 inch in, realizing there are 72 points to the inch: 72 72 translate

Follow your translate with scale, in the same form: x y scale. Scaling is multiplicative, so to make the image twice as large: 2 2 scale.



Thomas D. Greer
 
cypressm,

If you look in your pcl file near the beginning you will find the number 2683. Change it to 300 and try again.

This is the vertical motion in dots. it is set to 300dpi so a value of 300 should start the image 1 inch down the page.

Make sure you change it in a hex or text editor and not in an application like Word.

good luck and have fun,
 
It looks like a margin/printable area thing to me. I don't use GhostScript but that's where it is being lost.

Good luck and have fun,

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top