PS code

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • D_L_P
    Self Employed

    1,000+ Posts
    • Oct 2009
    • 1196

    #1

    PS code

    I have a customer printing from a Unix mainframe. He is looking for the specific pop codes for duplex and which # goes with which tray.


    Here is the example he gave me:
    LANGUAGE "PS2"

    MACROS "OFF"

    // Define the Color Palette

    PALETTE "~pal/tektronix840.pal"

    FEEDER "Upper", "<</MediaPosition currentpagedevice /InputAttributes get dup 2 known {pop 1} {1 known {1} {0} ifelse} ifelse/MediaClass null/TraySwitch false/ManualFeed false>> setpagedevice"
    FEEDER "Middle", "<</MediaPosition currentpagedevice /InputAttributes get dup 2 known {pop 2} {1 known {1} {0} ifelse} ifelse/MediaClass null/TraySwitch false/ManualFeed false>> setpagedevice"
    FEEDER "Lower", "<</MediaPosition currentpagedevice /InputAttributes get dup 2 known {pop 3} {1 known {1} {0} ifelse} ifelse/MediaClass null/TraySwitch false/ManualFeed false>> setpagedevice"
    FEEDER "Lower5", "<</MediaPosition currentpagedevice /InputAttributes get dup 2 known {pop 5} {1 known {1} {0} ifelse} ifelse/MediaClass null/TraySwitch false/ManualFeed false>> setpagedevice"


    STACKER "Upper", "1 statusdict /setoutputtray get exec"
    STACKER "Side", "2 statusdict /setoutputtray get exec"

    UNITS "DPI300"
  • unisys12
    Trusted Tech

    250+ Posts
    • Jul 2007
    • 490

    #2
    I would point him to these two links...

    (III.) Theoretical Background: CUPS, PPDs, PostScript & GhostScript

    &

    OpenPrinting database - Printer Listings
    sigpic
    The first law states that energy is conserved: The change in the internal energy is equal to the amount added by heating minus the amount lost by doing work on the environment.

    Comment

    • blackcat4866
      Master Of The Obvious

      Site Contributor
      10,000+ Posts
      • Jul 2007
      • 22996

      #3
      Here's the easy way.

      Pick out a small sample document. Send it to print from your PostScript driver and check "Print to File". You will be prompted to name the file (I usually use a .prn or .txt extension for these), and a location (the desktop is convenient).

      Open the resulting file with an application like TextPad. You'll be able to identify the exact command (and it's exact syntax). The benefit of TextPad is that it can display non-ASCII characters. Then you can copy/paste it to another file for delivery to your customer.

      If you intend these scripts to be prepended to a PostScript print job, keep in mind that only the last similar command will be executed. For example, if you prepend a 'ledger page size' command and there is a 'letter page size' command in the print job, only the last command will be executed.

      Headers are not necessarily a simple task. This PostScript header specific to only three models of Copystar/Kyocera, specifies letter pagesize and duplex. I have stripped out hundreds of lines of code to minimize this header:


      !R! SEM 9;EXIT;
      %-12345X@PJL JOB NAME="AutoCad A Size Duplex Long Edge"
      @PJL SET ECONOMODE=OFF
      @PJL SET JOBNAME="AutoCad A Size Duplex Long Edge"
      @PJL ENTER LANGUAGE=POSTSCRIPT
      M%!PS-Adobe-3.0
      %%BeginProlog
      %%BeginResource: Macro_Basic
      /KPDLBASE 100 dict dup begin
      /d/def load def/l/load load d/a/add l d/al/aload l d/Q/array l d/`/begin l d/b
      /bind l d/q/cleartomark l d/C/closepath l d/+/concat l d/c/copy l d/cd
      /currentdict l d/cf/currentfile l d/cm/currentmatrix l d/~/curveto l d/cN/cvn l
      d/c$/cvs l d/dfK/definefont l d/#/dict l d/@/dup l d/e/exec l d/E/end l d/O
      /eofill l d/ex/exch l d/f/false l d/F/fill l d/ft/filter l d/ff/findfont l d/*
      /for l d/** /forall l d/g/get l d/gi/getinterval l d/H/grestore l d/G/gsave l d
      /?/ifelse l d/i/image l d/I/imagemask l d/^/index l d/L/length l d/-/lineto l d
      /mf/makefont l d/mp/makepattern l d/m/matrix l d/M/moveto l d/!/neg l d/N
      /newpath l d/n/null l d/rc/rectclip l d/rf/rectfill l d/rs/rectstroke l d/r-
      /rlineto l d/:/roll l d/S/scale l d/SC/setcachedevice l d/scs/setcolorspace l d
      /sD/setdash l d/sf/setfont l d/sg/setgray l d/sC/setlinecap l d/sJ/setlinejoin
      l d/sW/setlinewidth l d/sm/setmatrix l d/sM/setmiterlimit l d/SP/setpagedevice
      l d/sp/setpattern l d/&/statusdict l d/$/string l d/K/stroke l d/T/translate l
      d/t/true l d/bd{b d}b d/xd{ex d}bd
      userdict ` /lucas 21690 d/BF{countdictstack lucas[}bd/EF{stopped{cleartomark @
      lucas eq{pop exit}if}loop countdictstack ex sub @ 0 gt{{E}repeat}{pop}?}bd E/EA
      {1 ^ 0/G0 put 4 $ 1 1 4 -1 :{3 c ! ex c$ @ 0 71 put cN 3 -1 : ex put}* pop}bd/s
      /sub l d /r~/rcurveto l d/ic/initclip l d/uf/undefinefont l d
      end def
      %%EndResource
      %%EndProlog
      %%BeginSetup
      KPDLBASE begin
      %%BeginFeature: *Resolution 600dpi
      BF{
      <</HWResolution [600 600]>> SP
      <</PreRenderingEnhance t>> SP
      }EF
      %%EndFeature
      %%BeginFeature: *InputSlot (Auto Tray Select)
      BF{
      <</DeferredMediaSelection t>> SP
      }EF
      %%EndFeature
      %%BeginFeature: *PageSize (Letter (8 1/2 x 11))
      BF{
      <</Policies <</PageSize 7>> /PageSize [612 792] /ImagingBBox n>> SP
      }EF
      %%EndFeature
      %%BeginFeature: *MediaType (Auto media selection)
      BF{
      }EF
      %%EndFeature
      %%BeginFeature: *Duplex DuplexNoTumble
      BF{
      & ` t setduplexmode f settumble E
      }EF
      %%EndFeature
      /DTM [0.12000 0.0 0.0 -0.12000 12.00 784.00] d
      %%EndSetup

      Note that in Kyoceras KPDL (emulating PostScript) the job starts out in PreScribe (Kyocera's native language), then changes to PJL (Printer Job Language), then changes to PostScript.

      Too much information? Ask lot's of questions. =^..^=
      If you'd like a serious answer to your request:
      1) demonstrate that you've read the manual
      2) demonstrate that you made some attempt to fix it.
      3) if you're going to ask about jams include the jam code.
      4) if you're going to ask about an error code include the error code.
      5) You are the person onsite. Only you can make observations.

      blackcat: Master Of The Obvious =^..^=

      Comment

      • OMD-227

        #4
        Originally posted by blackcat4866
        Here's the easy way.

        Pick out a small sample document. Send it to print from your PostScript driver and check "Print to File". You will be prompted to name the file (I usually use a .prn or .txt extension for these), and a location (the desktop is convenient).

        Open the resulting file with an application like TextPad. You'll be able to identify the exact command (and it's exact syntax). The benefit of TextPad is that it can display non-ASCII characters. Then you can copy/paste it to another file for delivery to your customer.

        If you intend these scripts to be prepended to a PostScript print job, keep in mind that only the last similar command will be executed. For example, if you prepend a 'ledger page size' command and there is a 'letter page size' command in the print job, only the last command will be executed.

        Headers are not necessarily a simple task. This PostScript header specific to only three models of Copystar/Kyocera, specifies letter pagesize and duplex. I have stripped out hundreds of lines of code to minimize this header:


        !R! SEM 9;EXIT;
        %-12345X@PJL JOB NAME="AutoCad A Size Duplex Long Edge"
        @PJL SET ECONOMODE=OFF
        @PJL SET JOBNAME="AutoCad A Size Duplex Long Edge"
        @PJL ENTER LANGUAGE=POSTSCRIPT
        M%!PS-Adobe-3.0
        %%BeginProlog
        %%BeginResource: Macro_Basic
        /KPDLBASE 100 dict dup begin
        /d/def load def/l/load load d/a/add l d/al/aload l d/Q/array l d/`/begin l d/b
        /bind l d/q/cleartomark l d/C/closepath l d/+/concat l d/c/copy l d/cd
        /currentdict l d/cf/currentfile l d/cm/currentmatrix l d/~/curveto l d/cN/cvn l
        d/c$/cvs l d/dfK/definefont l d/#/dict l d/@/dup l d/e/exec l d/E/end l d/O
        /eofill l d/ex/exch l d/f/false l d/F/fill l d/ft/filter l d/ff/findfont l d/*
        /for l d/** /forall l d/g/get l d/gi/getinterval l d/H/grestore l d/G/gsave l d
        /?/ifelse l d/i/image l d/I/imagemask l d/^/index l d/L/length l d/-/lineto l d
        /mf/makefont l d/mp/makepattern l d/m/matrix l d/M/moveto l d/!/neg l d/N
        /newpath l d/n/null l d/rc/rectclip l d/rf/rectfill l d/rs/rectstroke l d/r-
        /rlineto l d/:/roll l d/S/scale l d/SC/setcachedevice l d/scs/setcolorspace l d
        /sD/setdash l d/sf/setfont l d/sg/setgray l d/sC/setlinecap l d/sJ/setlinejoin
        l d/sW/setlinewidth l d/sm/setmatrix l d/sM/setmiterlimit l d/SP/setpagedevice
        l d/sp/setpattern l d/&/statusdict l d/$/string l d/K/stroke l d/T/translate l
        d/t/true l d/bd{b d}b d/xd{ex d}bd
        userdict ` /lucas 21690 d/BF{countdictstack lucas[}bd/EF{stopped{cleartomark @
        lucas eq{pop exit}if}loop countdictstack ex sub @ 0 gt{{E}repeat}{pop}?}bd E/EA
        {1 ^ 0/G0 put 4 $ 1 1 4 -1 :{3 c ! ex c$ @ 0 71 put cN 3 -1 : ex put}* pop}bd/s
        /sub l d /r~/rcurveto l d/ic/initclip l d/uf/undefinefont l d
        end def
        %%EndResource
        %%EndProlog
        %%BeginSetup
        KPDLBASE begin
        %%BeginFeature: *Resolution 600dpi
        BF{
        <</HWResolution [600 600]>> SP
        <</PreRenderingEnhance t>> SP
        }EF
        %%EndFeature
        %%BeginFeature: *InputSlot (Auto Tray Select)
        BF{
        <</DeferredMediaSelection t>> SP
        }EF
        %%EndFeature
        %%BeginFeature: *PageSize (Letter (8 1/2 x 11))
        BF{
        <</Policies <</PageSize 7>> /PageSize [612 792] /ImagingBBox n>> SP
        }EF
        %%EndFeature
        %%BeginFeature: *MediaType (Auto media selection)
        BF{
        }EF
        %%EndFeature
        %%BeginFeature: *Duplex DuplexNoTumble
        BF{
        & ` t setduplexmode f settumble E
        }EF
        %%EndFeature
        /DTM [0.12000 0.0 0.0 -0.12000 12.00 784.00] d
        %%EndSetup

        Note that in Kyoceras KPDL (emulating PostScript) the job starts out in PreScribe (Kyocera's native language), then changes to PJL (Printer Job Language), then changes to PostScript.

        Too much information? Ask lot's of questions. =^..^=

        Damn Blackcat....... you're good!

        I've always wondered about this. Never been asked, but was fearing the day I was.
        Its actually common sense when looking at it the way you've said. Thank you.

        Still in awe of the master!

        Comment

        • D_L_P
          Self Employed

          1,000+ Posts
          • Oct 2009
          • 1196

          #5
          Black Cat and Unisys, Thank you! Thank you! Thank you!
          I will give him this info tomorrow. This site has been able to do what Ricoh tech support and in-house support can't. You guys are awesome!

          Comment

          • blackcat4866
            Master Of The Obvious

            Site Contributor
            10,000+ Posts
            • Jul 2007
            • 22996

            #6
            I had to field a similar request from a large customer of ours. Fortunately for me a very generous Kyocera programmer took pity on me. He did not have time to do the task, but explained it to me in terms that I could understand.

            There's a simple way to test out your header results. Place your header file and your sample capture without page commands in the root drive of your PC (C:\). Open up a command line and enter the following command:

            C:\Documents and Settings\jsmith>copy Kyo_a.hdr + PlotESD.txt \\server\KyoceraC then Enter

            where:
            Kyo_a.hdr is your header file
            PlotESD.txt is your sample capture
            server is your servers full computer name less domain
            KyoceraC is your printers share name

            Only load a dozen sheets of paper in the tray. If you delete out too many of the header commands you can get a PostScript error (print out hundreds of pages with a single line of command each) or get a wide variety of interesting print error codes, or just totally unrecognizable results. Have fun. =^..^=
            If you'd like a serious answer to your request:
            1) demonstrate that you've read the manual
            2) demonstrate that you made some attempt to fix it.
            3) if you're going to ask about jams include the jam code.
            4) if you're going to ask about an error code include the error code.
            5) You are the person onsite. Only you can make observations.

            blackcat: Master Of The Obvious =^..^=

            Comment

            • unisys12
              Trusted Tech

              250+ Posts
              • Jul 2007
              • 490

              #7
              Originally posted by D_L_P
              Black Cat and Unisys, Thank you! Thank you! Thank you!
              I will give him this info tomorrow. This site has been able to do what Ricoh tech support and in-house support can't. You guys are awesome!
              No worrys! That's what we're here for. And Black cat is on the right track there, so... follow what he says.

              Also, Downloader 2006 is a great utility that can be used in most cases... News I'm not totally sure if it supports PS as well, but it has saved me a time or two.
              sigpic
              The first law states that energy is conserved: The change in the internal energy is equal to the amount added by heating minus the amount lost by doing work on the environment.

              Comment

              • tmaged
                Owner/Service Manager

                Site Contributor
                1,000+ Posts
                • Oct 2008
                • 1867

                #8
                "Also, Downloader 2006 is a great utility that can be used in most cases... News I'm not totally sure if it supports PS as well, but it has saved me a time or two."

                It looks like this utility will only work with Ricoh machines ?
                Hope that helps !
                -Tony
                www.dtios.com
                Become a fan on Facebook

                Comment

                • blackcat4866
                  Master Of The Obvious

                  Site Contributor
                  10,000+ Posts
                  • Jul 2007
                  • 22996

                  #9
                  You think that we did something nice for you now.

                  It will take you hours of trial and error to arrive at an elegant, functional header, then it will only work for certain machines. Each print driver is written for a specific machine for a reason. The headers you create will not be universal.

                  It took me nearly a week to create (4) functional variations for four models of Copystar MFPs. It does get easier with experience, but it's tedious. You'll hate me soon enough. =^..^=
                  If you'd like a serious answer to your request:
                  1) demonstrate that you've read the manual
                  2) demonstrate that you made some attempt to fix it.
                  3) if you're going to ask about jams include the jam code.
                  4) if you're going to ask about an error code include the error code.
                  5) You are the person onsite. Only you can make observations.

                  blackcat: Master Of The Obvious =^..^=

                  Comment

                  • D_L_P
                    Self Employed

                    1,000+ Posts
                    • Oct 2009
                    • 1196

                    #10
                    I sent him all the info, but I'm curious about this. Are the commands specific to each manufacturers driver? For example, a print to file with a Canon PS driver, will be different then, say, the print to file of a Minolta PS driver?

                    Would he be able to cut and paste right out of the print to file for his syntax? Or would he use it to just edit the syntax he sent me?

                    Comment

                    • blackcat4866
                      Master Of The Obvious

                      Site Contributor
                      10,000+ Posts
                      • Jul 2007
                      • 22996

                      #11
                      Originally posted by D_L_P
                      I sent him all the info, but I'm curious about this. Are the commands specific to each manufacturers driver? For example, a print to file with a Canon PS driver, will be different then, say, the print to file of a Minolta PS driver?

                      Would he be able to cut and paste right out of the print to file for his syntax? Or would he use it to just edit the syntax he sent me?
                      The command syntax will be consistent for PS2 machines, and for PS3 machines respectively.

                      But the large block of unreadable code beginning with line 9 and ending with line 28 has many small and large variations, even between two PS3 machines of the same manufacturer. I've got no idea what is happening there, but it's crucial for the functionality of the header.

                      It's quite a bit easier with PS2 machines. There is no large block of code, and the commands are consistent, at least on the Copystar/Kyocera drivers that I looked at. Too bad that there aren't many PS2 machines left.

                      The sample commands that you referenced are PS2, but slightly different syntax than the commands I've seen. I can't speak to whether they are universal or not.

                      Sorry I can't give you anything more specific. =^..^=
                      If you'd like a serious answer to your request:
                      1) demonstrate that you've read the manual
                      2) demonstrate that you made some attempt to fix it.
                      3) if you're going to ask about jams include the jam code.
                      4) if you're going to ask about an error code include the error code.
                      5) You are the person onsite. Only you can make observations.

                      blackcat: Master Of The Obvious =^..^=

                      Comment

                      • unisys12
                        Trusted Tech

                        250+ Posts
                        • Jul 2007
                        • 490

                        #12
                        Since your client is using Unix, I would also suggest another link... if he continues to have a lot problems.

                        Developing PostScript Printer Drivers - Documentation - CUPS

                        The link above outlines PS drivers and how they work. Even points you to a CUPS compiler that can be used to compile a PPD file for any situation or printer.

                        By the way, if you don't mind me asking, what product (brand, make & model) is he printing to? I downloaded ubuntu server today and plan on putting on a old PC at the shop, just so I can play around with stuff like this. Given the current economic situations and given my past experience in times like this, people will start leaning more to OpenSource software to help ease their IT budget pains. I would just like to be a little more pre-paired this around.

                        And yes, if you start digging around in stuff like this too much... you will actually curse BlackCat. I promise! I have spent a many an hour thinking about PCL codes and escape sequences that would make a data stream work right with a MFP or printer.
                        sigpic
                        The first law states that energy is conserved: The change in the internal energy is equal to the amount added by heating minus the amount lost by doing work on the environment.

                        Comment

                        • unisys12
                          Trusted Tech

                          250+ Posts
                          • Jul 2007
                          • 490

                          #13
                          Originally posted by tmaged
                          "Also, Downloader 2006 is a great utility that can be used in most cases... News I'm not totally sure if it supports PS as well, but it has saved me a time or two."

                          It looks like this utility will only work with Ricoh machines ?
                          Actually, this utility can work with any manufacturer. It is basically a data stream capture utility and as we all know... raw data streams are just that... raw. A solutions rep with Savin pointed me to it and he was a convert from Canon. He told me he had used it for years and was surprised that more techs didn't use it. Then again... when was the last time you had to de-bug PCL or PS code? Or made sure that a PCL macro was working properly with your machine? Or that a AS400 system was going to pull from the proper paper tray? yeah... I thought so and that was my answer to him. A month later I needed it.

                          As Blackcat mentioned, "print to file" can be a very helpful tool. But only if you have this utility. Well, when it comes to PCL anyway. PS well be saved as a mostly txt document, but PCL will not. You can take a problem, with a PCL driver related print driver, and print to file and save it. Then open it in this utility. Then, not only look at it as raw code, but resend that raw PCL code to another printer or MFP. You can also use it to create and test PCL or PS bar codes fonts, then upload them to a given printer. Test and create printer macros... the list goes on and on!! And it's free, for now anyway.

                          so no... since PCL and PS are not product specific, then this utility isn't either.

                          If you check the link I posted in the above post, they are starting the process of updating this utility. there's a survey you can take ( I was the first North American to take it. Woo Hoo!!) and every said that they would pay for this tool. Out of the total respondents, at the time, all said that they would pay for it, but less than half did. I will bet my last dollar that they will charge for the new version. Which might actually contain something that BlackCat asked about last week. Interested now? I know I am!!
                          sigpic
                          The first law states that energy is conserved: The change in the internal energy is equal to the amount added by heating minus the amount lost by doing work on the environment.

                          Comment

                          • blackcat4866
                            Master Of The Obvious

                            Site Contributor
                            10,000+ Posts
                            • Jul 2007
                            • 22996

                            #14
                            Is that my remote IP setting utility? Now we're talking.

                            You're right about PCL. There's a lot of non-ASCII characters in there, but you don't have to be able to read the code to cut/paste in TextPad. Look here: TextPad - the text editor for Windows
                            It's more like editing blindfolded. There's also XVI32 Text Editor that will let you type those non-ASCII characters. I haven't used it as much as I should. Look here: Download Hex Editor 2.51- XVI32 is a freeware hex editor running under Windows 95, Windows 98,... - SoftwareTipsPalace.com

                            Fortunately for me Kyocera has a capture utility built into all the newer MFPs and a portable utility that you can load onto a CF card for the Wysecore machines.

                            "Print-To-File" is indeed a really handy tool, and thankfully all Kyocera drivers have it. I use it daily when I'm at a customer location and need something printed. Without re-configuring the port I can print to file, then forward the .prn file to the printer's IP using LPR Jar or the "Print File" utility on the printers web interface or the "Print File" utility in KM-Net Viewer. At our office we had some server problems, and for ~6 months this was the only way I could print reliably. Sure I could set up a shared printer on the server, then it would vanish the next day. The software fairies would come in the night and steal away the driver settings. The new server seems to be free of this glitch.

                            "Print-To-File" is also a great way to distinguish between a network and a driver issue. If you trust the current version of the driver on your laptop you can take the sample document, print-to-file, the forward the .prn file to the printer via LPR Jar, essentially bypassing the users driver. If the job will now print (or print as desired) you've identified a driver issue. If it still won't print it's narrowed down to the printer & network. For a quickie network/driver test I've got LPR Jar on a USB stick with a few captures labelled by model to send. Quick & easy.

                            DLP: let us know how this turns out. You know I tried the same thing that you did. I turned over the info the the IT guy, then 6 months later he had not done a thing and it landed right back in my lap. I guess he wasn't as adventurous/stupid as I was. =^..^=
                            Last edited by blackcat4866; 01-16-2010, 06:33 PM.
                            If you'd like a serious answer to your request:
                            1) demonstrate that you've read the manual
                            2) demonstrate that you made some attempt to fix it.
                            3) if you're going to ask about jams include the jam code.
                            4) if you're going to ask about an error code include the error code.
                            5) You are the person onsite. Only you can make observations.

                            blackcat: Master Of The Obvious =^..^=

                            Comment

                            Working...