Skip to main content
Known Participant
September 7, 2011
質問

Can't get a color logo to print in color

  • September 7, 2011
  • 返信数 1.
  • 2226 ビュー

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

このトピックへの返信は締め切られました。

返信数 1

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

bryparks作成者
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.

Participating Frequently
September 8, 2011

That is complete code that just worked with gs and 2 Adobe PostScript printers.