Skip navigation
bryparks
Currently Being Moderated

Printing image without page eject (a showpage alternative?)

Sep 12, 2011 10:58 AM

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?

 
Replies
  • Currently Being Moderated
    Sep 13, 2011 9:16 AM   in reply to bryparks

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 13, 2011 2:11 PM   in reply to bryparks

    "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?

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 13, 2011 3:46 PM   in reply to bryparks

    I have included a section of your file with some additional code I wrote and comments that I think will be helpful.

     

    %%Page: 1 1
    %%BeginPageSetup
    %%PageBoundingBox: 0 0 183 90
    %%EndPageSetup
    q
    Q q
    -187.645 439.654 m 424.355 439.654 l 424.355 -352.346 l -187.645
    -352.346 l -187.645 439.654 l h
    -187.645 439.654 m W n
    q 0 0 183 90 rectclip
    [ 1 0 0 1 0 -0.252296 ] concat
      q
      0 0 183 90 rectclip
    Q q
    0.941176 0.301961 0.262745 rg

     

    % The storage of showpage into *showpage belongs here or above.
    /*showpage /showpage load def

     

    % The redefinition of showpage belongs here.
    /showpage {1 pop} def

     

    % This demonstrates where the current origin (x=0, y=0) on the page is.
    % Not that directly before the %%EndProlog comment line above scales the graphics state to 40%.
    /Helvetica findfont 12 scalefont setfont 0 0 moveto ( LOGO origin is here) show

    % the following code draws lines in 5 degree increments to show what parts of the page are within the current clipping path.
    0 0 moveto gsave 2.5 2.5 scale .25 setlinewidth 0 setgray 72 {5 rotate gsave 800 0 lineto stroke grestore} repeat grestore

    % I suspect your logo file is outside of the current clipping path and that is why it doesn't appear on the page.

    /showpage /*showpage load def

     

      Q
    Q
    Q q
    Q
    showpage
    %%Trailer
    %%EOF

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 15, 2011 6:24 PM   in reply to bryparks

    Without your complete files (certificate and logo) I can't determine what is causing the second page to be generated.

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 27, 2011 3:53 PM   in reply to bryparks

    Go ahead!

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points