×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Printing a .EPS File from Windows, struggling here a bit

Printing a .EPS File from Windows, struggling here a bit

Printing a .EPS File from Windows, struggling here a bit

(OP)
I've written a program the gets a .eps file and prints via GSPRINT (Ghostscipt). Each time I print the page, it get's cropped. I've used the -dNOEPS and other extentions and no others seem to work. If I use -EPSFitPage this blows up the image and this is no good. I need to keep the original size.

Anyone got any ideas?? This is a project that I need to get working for the week.

Cheers and many many many many and many more thanks in advance!!!

RE: Printing a .EPS File from Windows, struggling here a bit

I'm not really familiar with the GhostScript utility, so I'm afraid I can't help you with those options.

What is the original size of the image, and what size paper are you printing on?

Do you have a PostScript printer?

Thomas D. Greer
http://www.tgreer.com
Providing PostScript & PDF
Training, Development & Consulting

RE: Printing a .EPS File from Windows, struggling here a bit

(OP)
Hi Thomas,

I work for a newspaper so the image sizes are different.
Is it the %%BoundingBox that contains the sizes?

If you can think another way of getting me to print to a postscript printer, would be great.

Cheers..

RE: Printing a .EPS File from Windows, struggling here a bit

The %%BoundingBox is just a comment, but is supposed to contain the image size, yes.

PostScript uses a coordinate system of "points", 72 points to the inch. So a US Letter size page would be "612 792", or 8.5 inches x 11 inches.

I wish I could see your "cropped page" to better understand the problem. But if you have an EPS image, you can print it directly to your printer. Just send it over.

You say you've written a program. It what language? There are a variety of techniques to print directly to a printer, and they vary based on whether you're using a local or a network printer.

EPS images can be scaled, rotated, and positioning anywhere on the page. You do this by adding PostScript langauge program code to handle the EPS image. I can help with that, if you'd like.

Thomas D. Greer
http://www.tgreer.com
Providing PostScript & PDF
Training, Development & Consulting

RE: Printing a .EPS File from Windows, struggling here a bit

(OP)
HI Thomas,
I've sent you an email with the two files.  One is the Original .EPS and the other is the Processed Postscript .PS

If you have any ideas, please email or post.

Thanks

RE: Printing a .EPS File from Windows, struggling here a bit

I got your email and the files. They both look fine. I don't see any cropping.

Maybe the term "cropping" means different things to the two of us. To me, it refers to imaging only a portion of the image. For example, using an EPS of a family portrait but only "showing" one of the children's faces.

Your entire EPS is imaged, in the lower-left corner, which is consistent with the way the PostScript coordinate system works.

Tell me what you are expecting to happen vs. what is actually happening.

Thomas D. Greer
http://www.tgreer.com
Providing PostScript & PDF
Training, Development & Consulting

RE: Printing a .EPS File from Windows, struggling here a bit

(OP)
I want both files to look identical.  But with me, the .PS file has a margin on. I cannot find anyway of setting the margin to 0 (no margin)..

How do you "output" the .EPS to the printer to create postscript?  I'm new to all this postscript thing and would greatly appreciate any help.

As I said earlier, I'm writing the app in Visual Basic, if you have any experience with this, again would be great for any input.

RE: Printing a .EPS File from Windows, struggling here a bit

You don't output EPS to a printer to create PostScript... you ouput the EPS to a printer to create a printed page.

If your printer is a "PostScript printer", by which I mean a printer that has an built-in PostScript interpreter, then it will understand the EPS file. EPS files are essentially PostScript programs.

You never told me if your printer is local or network, so I can't give you specific advice on how to send a file to a printer through VB. But for a local printer you do something like:

CODE

Open "LPT1:" for Output as #1

That gives you access to the Port. Then just loop through your EPS, reading it to a buffer and printing it out to the port.

My point is, you don't have to do anything to the EPS if you just want to print it. Send it to the printer and be done with it.

"Margin" refers to white-space surrounding an image or text block. I don't see any additional margin in the sample you sent me. It prints, full-size, in the lower left corner of an 8.5x11 page. So of course you'll have whitespace on top of and to the right of the image.

I suspect we still aren't communicating well. Can you tell me again what end result your program is trying to achieve?

Thomas D. Greer
http://www.tgreer.com
Providing PostScript & PDF
Training, Development & Consulting

RE: Printing a .EPS File from Windows, struggling here a bit

I've re-read this thread... I can't shake the feeling that I'm not answering the question you're asking.

You aren't "printing" at all, are you? You're using GhostScript to create a PDF, and don't like the fact that the page produced is 8.5x11 with the EPS placed down in the corner, right? You want the final page to be the size of the EPS?

Like I said, I don't know GhostScript, but their should be a command line option, I would hope, that would set the page size to match the EPS bounding box.

A quick web search reveals:

-dDEVICEWIDTHPOINTS and -dDEVICEHEIGHTPOINTS

set these to the values in your EPS Bounding Box comment, and GhostScript will place the image on a page the exact size as the EPS itself.

Hopefully I've addressed your concern. If not, please let me know.

Thomas D. Greer
http://www.tgreer.com
Providing PostScript & PDF
Training, Development & Consulting

RE: Printing a .EPS File from Windows, struggling here a bit

(OP)
Let me start from the top.

We have a new OPI where you throw a Low Res graphic (.eps) and it will subtitute it for a Hi Res.

There is a slight problem with one of the projects that's going on.  Where you cannot setup a printer to pool a folder to do the subtitution.  This is where I come in.

I've created a spooler program that looks for the .eps file and sends to a 'virtual printer' on the OPI, thus creating a page with HI Res graphics on.

The 'virtual printer' is on a server that is on a server, so yes, it is a network printer.

Sorry if I've repeated myself in this post, just trying to make it clear for you.

I will try and output it myself using Open "LPT1:" for Output as #1 and see how I get on.

Thanks once again for your help, i've learned a lot

RE: Printing a .EPS File from Windows, struggling here a bit

Ok, I understand. The problem is your printer driver is reinterpreting and outputting your EPS to create a new PostScript stream that would, ordinarily, print.

The problem with this is that it defaults to a letter size page, and then "places" the EPS on that page.

So you need to "spool" the EPS directly to the virtual printer, instead of printing it through a driver.

In VB, you can open a port directly, as I explained in a prior post. Since it is a network printer, you'll have map to a local port through the appropriate "net use" command.

CODE

NET USE LPT3 \\servername\sharedprinter /PERSISTENT:YES

You would type that into a command prompt on the machine that will run your code. That way your network printer is seen as local port LPT3.

Then in VB, you can

CODE

Open "LPT3:" for Output as #1

Then read in your EPS and write it out to "#1".

That should send the EPS directly to your virtual printer without going through a driver.

Thomas D. Greer
http://www.tgreer.com

Providing PostScript & PDF
Training, Development & Consulting

RE: Printing a .EPS File from Windows, struggling here a bit

(OP)
Here is the program that i've written to send to the OPI.  The OPI rejects it when I look at the file, ghostscript bombs out.  Could you have a look and say if the formatting is wrong?

The file that i'm using is the one that I send to you last week.

Thanks


Dim FileHandle%
    FileHandle% = FreeFile
    
    Dim Spooler As String, N As Long, MaxChr As Long, Div As Long, TmpStep As Long, Crop As String, Port As String, CTempLen As Long, CTemp As String
       
       Port = "LPT2:"

Open Port For Output As #FileHandle%
            Text3.Text = ""
            Text4.Text = ""
            
            CTemp = Text2.Text
            CTempLen = Len(CTemp)
            MaxChr = FileLen(FName)
            Text4.Text = MaxChr
            
    For N = 1 To MaxChr
            Crop = InStr(N, CTemp, "")
            Spooler = Mid$(CTemp, N, 1)
            Text5.Text = N
            Text5.Refresh
           Print #FileHandle%, Spooler;
    Next N
        
Close #FileHandle%

RE: Printing a .EPS File from Windows, struggling here a bit

I don't program in VB. You might be better off posting your program in the VB forum. Would you use "Print"? I think you need to "Write" to Output, instead of printing.

I can troubleshoot the PostScript and EPS stuff, but they both look fine to me (looking at what you emailed me previously).

Thomas D. Greer
http://www.tgreer.com

Providing PostScript & PDF
Training, Development & Consulting

RE: Printing a .EPS File from Windows, struggling here a bit

(OP)
HI Thomas, just to say thanks for helping me.  I've found a way of spooling to the printer and creating the final .PS file.

Cheers!

RE: Printing a .EPS File from Windows, struggling here a bit

(OP)
I used a File System Object to read the file a byte at a time and then write it out to the printer.

This worked a treat, when you look at it, it's quite simple.
But me being new to programming in VB, just took a long time.

It's amazing with a bit of knowledge how far it gets you.

I new know a little bit about postscript and may have a play with some of my own.

Many thanks for the help.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close