Skip to main content
Known Participant
September 12, 2011
Question

Printing image without page eject (a showpage alternative?)

  • September 12, 2011
  • 1 reply
  • 5274 views

This is a conversation carried over from this thread: http://forums.adobe.com/thread/900119?tstart=0.

I am printing a postscript logo image on a certificate that is generated by a C program.  When I call the image in the code, the image will print on a separate page, rather than embed within the certificate.  I've removed the showpage command from the end of the image code, but that just prevented the image from being printed altogether.  I believe what I need is a PostScript command or a string of commands that will print the image without sending a page eject command to the printer.

Does anyone know how this might be accomplished?

This topic has been closed for replies.

1 reply

Mr__Horton
Inspiring
September 13, 2011

One method you could use to overcome unknown or unanticipated showpage calls in EPS or other PostScript files that you may insert into your PostScript file is to "disable" showpage before the file you want to insert and then "enable" showpage afterwards so that all enabled showpage commands are issued by your PostScript file only:

%%begin by storing a copy of the showpage procedure (this can be done once in your beginproc section, or everytime you insert a file.)


/*showpage /showpage load def     % this stores the actual procedure as currently defined in showpage

/showpage {1 pop} def                    % this replaces showpage with a procedure that does nothing to the graphics state

%% your EPS or other PostScript compatible graphics file should be inserted here

%% any occurance of showpage in this file will only do what you have redefined it to do - so it/they will be ignored, practically speaking.

%%

%%

%% End of your EPS or other PostScript compatible graphics file

/showpage /*showpage load def     % this reloads the original definition of showpage as it was when you stored it in *showpage

%% Your PostScript code continues at this point - it is up to you if and when the showpage is called to image the current page

bryparksAuthor
Known Participant
September 13, 2011

No luck using your code verbatim, but I want to make sure I understand what the new def is doing.  The "pop" command is essentially ignoring the topmost item in the stack, yes?  So essentially your redefinition is simply saying ignore showpage whenever it occurs in the code (at least until the original def of showpage is restored).  Is this correct?

If so, then this is essentially the same as removing showpage altogether from the code, and that hasn't worked in the past.  While I definitely do not want a new page generated, I definitely need the logo to print.

Mr__Horton
Inspiring
September 13, 2011

"No luck..." doesn't tell me what output you got, so could you explain what output you got?

Did you place a showpage command in your code after the inserted logo file?

What coding did you use to place the logo file within the bounds of your current page?

"Is this correct?" - Yes you understand what the the redefinition of showpage is supposed to accomplish.

Can you provide the logo file for troubleshooting?