Skip to main content
Known Participant
September 7, 2011
Question

Can't get a color logo to print in color

  • September 7, 2011
  • 1 reply
  • 2226 views

PostScript newbie here... I have two issues with a postscript image I'm trying to print.

I have a green logo .eps file that I print to an HP color laserjet printer via a Linux server, but the logo only prints in greyscale.  I have reviewed the image code, and tweaked the code to specify color (e.g. changed the "image" command to "colorimage"), to no avail.  Can anyone assist me in getting a color printout?  Here's the main part of the code (specific image bits removed):

%!PS-Adobe-3.0 EPSF-3.0
%%TemplateBox:0 0 188 78
%%BoundingBox: 0 0 235 97
%%PageOrigin:0 0
/width 188 def
/height 78 def
/pixwidth 235 def
/pixheight 97 def
/picstr width string def
/dopic {
gsave
width height 8
[width 0 0 height neg 0 height]
{currentfile picstr readhexstring pop}
image
grestore
} def
pixwidth pixheight scale
dopic

.

.

(image bits here)

.

.

%%Trailer
showpage

The second issue is that I can't get the image to embed in another page - that is, when I call the image to print in a C program, the printer spits out the logo on a separate page.  The goal here is to embed a color logo (the .eps file) into a certificate, where the rest of the certificate contents are generated by PCL commands.  I've been able to embed a PCL image (too much aliasing) and an HPGL image (plotter print dulls sharp corners), but the .eps file doesn't want to play on the same page as the certificate.  Any ideas?

Any help is appreciated!

- Bry

This topic has been closed for replies.

1 reply

Participating Frequently
September 8, 2011

EPS files should not have a showpage which is why it comes on it's own page.

To go from the 5 operand image to the 7 operand colorimage you need 2 more arguments

plus image data for each color. Image dictionaries are easier to work with such as

%!PS
10 10 scale
36 36 translate
/temp 4 string def
/DeviceCMYK setcolorspace
<<
  /ImageType 1
  /Width 8
  /Height 12
  /BitsPerComponent 1
  /Decode [ 0 1 0 1 0 1 0 1 ]
  /ImageMatrix [1 0 0 1 0 0]
  /DataSource { currentfile temp readhexstring pop }
>>
image
AA77A7C7F770AAC7EDEDEDED
AA77A7C7F770AAC7EDEDEDED
AA77A7C7F770AAC7EDEDEDED
AA77A7C7F770AAC7EDEDEDED
showpage

bryparksAuthor
Known Participant
September 8, 2011

Thanks, abeddie.

I tried your code header with my image code, to no avail (wouldn't print).  I tried your code exactly as you posted it and that didn't print either, so I'm not sure if you're just providing a snippet of larger code, or if I need to add your code somewhere into mine.  Can you elaborate?

I removed "showpage" from my code and inserted it into the overall print job, and it just doesn't print.  So, I'm still at square one.  Hopefully you or another user can help me connect the dots.

In the meantime, I'm going to try some different combinations of what you posted with my code to make sure I'm not missing something obvious.

bryparksAuthor
Known Participant
September 12, 2011

My guess is something may have changed when you cut and pasted or typed the code into a file.

Here is an online PostScript to PDF converter which also worked on the simple color image.

http://www.ps2pdf.com/


I found a resolution for the color issue.  As I mentioned before, I am trying to print an .eps image - out of frustration, I converted the image to .ps on the off chance that the printer would read the image differently.  Sure enough, the printer liked the .ps format and printed a color image.  Go figure.

Still can't get the logo to print in the body of the certificate, though.  I removed the showpage command from the end of the file and tried to reprint, but that just prevented the image from printing at all.  Some PostScript code investigation suggested that replacing showpage with the command show might do the trick - but no luck.

Still digging - I'll post the solution if and when I find it.  And as always, if you have other suggestions please post them.