ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Printer session with pdf virtual printer outputs blank pdf's

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Printer session with pdf virtual printer outputs blank pdf's

    Hello, i am using pdfcreator 1.71 (a virtual pdf printer) which uses ghostscript 9.07 as its backend.
    The problem is that when i configure an iseries printer session as *HP5 or other combos, i get an error when doing the conversion and the pdf is blank.

    I tried talking to the ghostscript devs and they told me that ghostscript is a postscript interpreter, not a PCL interpreter.
    Since the error i am getting is:

    Error: Error: /undefined in E&l0O&a0P&l1C&l0008E&l001C&l0512F&a0R&l008C&l4H&l0 G&l1C&l0008E&l001C&l0512F&a0R&l008C&l0S;

    My guess is that these string is composed of PCL commands which ghostscript doesn't understand.

    The question is: is there a setting i can use in the printer session to output as PS instead of PCL? Or does this mean i can't use any virtual pdf printer since it needs PS support?
    Perhaps with a PDT in the session?

  • #2
    Re: Printer session with pdf virtual printer outputs blank pdf's

    I've never done this, and you haven't explained much about your setup, but... I have some guesses that may (or may not?) apply to your situation.

    I'm guessing that PDFCreator is a Windows virtual printer that's designed for printing from Windows. (I may be wrong, I haven't used the product.) So when a windows program prints, it calls a set of APIs (called 'GDI') to render the document. When GDI is connected to a printer driver, these APIs use the code in the printer driver for rendering. In your example, I suspect PDFCreator provides GDI drivers that render things in PostScript. Then, after it has a PostScript document, it calls GhostScript (under the covers) to translate it to PDF.

    (I've used GhostScript many times to convert PostScript to PDF, myself... but not within the PDFCreator product.)

    Assuming this is all true, I suspect that you are printing from IBM i using the Host Print Transform facility to convert your IBM i spooled file to PCL. Then you are sending this PCL to the Windows printer with instruction to send it on to the printer as-is. Is that what you're doing? Because you didn't explain this part at all. But... that's a fairly common setup on IBM i, because PCL is the most common printer language these days, so people set up the system to transform their data to PCL and then tell it to send to the printer as-is. The result works nicely because the printer understands PCL so it prints the document as expected.

    But, it won't work with PDFCreator because PDFCreator is expecting you to do the rendering on Windows where it uses it's own driver rather than on IBM i with a PCL driver, and therefore you have problems.

    If you can find a way to make your printer use Windows GDI to do the rendering, it should work.

    Or, you might find it more convenient to use a different tool besides PDFCreator to generate your PDF! For example, instead of using Host Print Transform to convert to PCL, and then trying to transform that to PostScript, and have Ghostscript convert it again to PDF... why not just have Host Print Transform output PDF in the first place?

    The question is: is there a setting i can use in the printer session to output as PS instead of PCL?
    Will that work, here? I know IBM has something called "image print transform" that supports PostScript, but I don't often hear of people using it. Not sure how limited it might be? But... I'm concerned that even if you got that working, it'd still confuse the PDFCreator tool, since it's undoubtedly expecting you to use Windows GDI to generate the PS.

    Or does this mean i can't use any virtual pdf printer since it needs PS support?
    No, it only means you can't use Host Print Transform with PDFCreator! Though, if you use a tool that does the conversion from IBM's internal format (AFPDS or SCS) via Windows GDI, it should work with PDFCreator or any other Windows PDF generator. Other PDF tools on Windows will work differently, so may work just fine with your setup.

    Perhaps with a PDT in the session?
    I have never used a PDT, but this might work if I understand it correctly? Might be worth a shot. The basic idea is you need to do the rendering using Windows printer driver support instread of doing the rendering elsewhere (such as Host Print Transform -- or anything else that pre-renders the data) and then sending to the Windows driver. Does PDT work that way?

    Comment


    • #3
      Re: Printer session with pdf virtual printer outputs blank pdf's

      Thanks for answering. As i said, pdfcreator is a virtual printer that appear on your windows printers. When the program prints to that printer, you get a dialog to save the .pdf file.

      My guess is that ghostscript (that the virtual printer uses on the backend) doesn't know PCL and only knows PS, therefore when using HPT in the printer session (as *HP5) ghostscript throws an error.

      The admin just updated our iseries 520 to OS 7.1, and we don't have clear if we can convert to PDF for free. I have tested the new ibm pc5250 emulator (called ibm client access solutions) and it has an option to view your spool and convert to PDF, which i have tested and works fine. The readme says that for PDF output to work, you need "transformation services (option 1)" installed, which in my guess it is since the pdf output works.

      Our main issue is that we have lots of remote clients with host-only printers, and they need to print stuff that is *AFPDS only, and when you print it ignores the printing. Using ibm client access solution works fine, but since all of our machines have pdfcreator i wanted to use it.

      Does the pdf solution you list need configuration for each user, to use the IFS or something like that? We want a generic setup that works for everyone.

      Comment


      • #4
        Re: Printer session with pdf virtual printer outputs blank pdf's

        Yes, Ghostscript is software that takes PostScript data as input. Typically, you use Ghostscript when you have PostScript data but do not have a PostScript-capable printer. GhostScript can be used to translate it to another printer language, such as PCL, PPDS, or other printer languages. It can even output PDF -- which is how you're using it. but, it cannot take PCL as input... only PostScript.

        But, there's more going on than that! There must also be a component that takes Windows GDI calls and translates them to PostScript. Without that piece, it would not work as a Windows printer...

        Again, the problem is that you aren't using Windows GDI calls to translate your output to a printer language, you're using HPT, and you're telling it specifically to output to PCL (since that's what *HP5 does.) But, I've already said all of this..

        Our main issue is that we have lots of remote clients with host-only printers, and they need to print stuff that is *AFPDS only, and when you print it ignores the printing. Using ibm client access solution works fine, but since all of our machines have pdfcreator i wanted to use it.
        Host-based printers do not work with HPT for the same reason that PDFCreator does not work with HPT. They are designed to only work when your document is rendered by calling the Windows GDI API. You should be able to configure your printer emulator (which runs on Windows) to do the transformation in Windows instead of using HPT. I know this works with Rumba's print emulation, I haven't ever tried it with Client Access (never used Client Access for print emulation, sorry.)

        Does the pdf solution you list need configuration for each user, to use the IFS or something like that? We want a generic setup that works for everyone.
        Not sure what you're referring to, here, as I did not offer a solution -- unless you mean using HPT to output PDF?

        If so, this is available on 6.1 and higher (so 7.1 should be fine) and requires IBM Transformation Services option 1 to be installed -- it sounds like you already have this? You can find out by doing GO LICPGM, take option 10, and scroll down and see if you have 5770TS1 option 1 installed. You can hit F11 twice to see which product options are installed. This is a no-charge tool from IBM, if you don't have it installed, you can install it for free from the operating system CD/DVD/imgclg.

        Once you've done that, you can use CRTPRTF, OVRPRTF or CPYSPLF to make your print program output a PDF. The output goes into the IFS (which does not require any special user setup that I'm aware of?!?!) and then you can e-mail it to the user, or open it via a mapped network drive, or download it via a web page (browser) or FTP or whatever makes sense in your situation.

        You'll want to test this to make sure it supports all of the printer options that you are using, since it does not support all AFPDS capabilities.

        There are also many 3rd party solutions to this, some are free, and some (the better ones) are commercial offerings.

        Comment


        • #5
          Re: Printer session with pdf virtual printer outputs blank pdf's

          Originally posted by Scott Klement View Post
          Again, the problem is that you aren't using Windows GDI calls to translate your output to a printer language, you're using HPT, and you're telling it specifically to output to PCL (since that's what *HP5 does.) But, I've already said all of this..
          If i disable HPT on the printer session then AFPDS files won't print.

          Host-based printers do not work with HPT for the same reason that PDFCreator does not work with HPT. They are designed to only work when your document is rendered by calling the Windows GDI API. You should be able to configure your printer emulator (which runs on Windows) to do the transformation in Windows instead of using HPT. I know this works with Rumba's print emulation, I haven't ever tried it with Client Access (never used Client Access for print emulation, sorry.)
          Guessing for your post this is what i actually need to do.

          If so, this is available on 6.1 and higher (so 7.1 should be fine) and requires IBM Transformation Services option 1 to be installed -- it sounds like you already have this? You can find out by doing GO LICPGM, take option 10, and scroll down and see if you have 5770TS1 option 1 installed. You can hit F11 twice to see which product options are installed. This is a no-charge tool from IBM, if you don't have it installed, you can install it for free from the operating system CD/DVD/imgclg.
          It is shows as *COMPATIBLE instead of *INSTALLED, so i will ask the admin to install. I will report back, thanks!

          Comment


          • #6
            Re: Printer session with pdf virtual printer outputs blank pdf's

            Originally posted by fjleon View Post
            It is shows as *COMPATIBLE instead of *INSTALLED, so i will ask the admin to install. I will report back, thanks!
            *COMPATIBLE is what you want. *COMPATIBLE means that the software is installed and is known to be compatible with the operating system release. By contrast, *INSTALLED means that it's installed, but it's unknown if it's going to be compatible.

            Comment


            • #7
              Re: Printer session with pdf virtual printer outputs blank pdf's

              yes, found this yesterday, and makes sense since the new ibm client access solution exports to pdf just fine and in the help it says it only works if you have this package installed.
              tested CPYSPLF and it converts to PDF just fine, sadly there isn't a user level command to use this feature, because CPYSPLF needs too many parameters the ordinary user doesn't know.

              Comment


              • #8
                Re: Printer session with pdf virtual printer outputs blank pdf's

                Originally posted by fjleon View Post
                ...sadly there isn't a user level command to use this feature, because CPYSPLF needs too many parameters the ordinary user doesn't know.
                Can you post an example of a CPYSPLF command that a user might have to enter? Using an example that you provide, we can possibly show you how some alternatives can be created.
                Tom

                There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.

                Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth?

                Comment


                • #9
                  Re: Printer session with pdf virtual printer outputs blank pdf's

                  Here is the complete CPYSPLF i have to do for a single pdf conversion:

                  CPYSPLF FILE(FORORD) TOFILE(*TOSTMF) JOB(034774/FLEON/QPRTJOB) SPLNBR(7) TOSTMF('/home/fleon/forord.pdf') WSCST(*PDF)

                  So, the user needs to know the file name, job details (number, user, job name and spool file number) and the destination file name.

                  I don't remember much about CL programming, but surely there is a spool API that will show the complete spool files and maybe a command option can be created to pass out this info from the api (the job and spool file details) to the cpysplf file, and maybe hardcode the output folder to /home/username/ and put the file name as filename-date (or even filename-fleon-034774-7.pdf to make sure you always get a unique name)

                  We are looking for a feature like this to replace the horrendous performance of IWA, though the new client access solutions is turning out to be real nice (it works with 7.1 native transformation feature). Believe it or not, lots of our users and clients (we are an insurance company) have host-only capable printers.

                  Comment


                  • #10
                    Re: Printer session with pdf virtual printer outputs blank pdf's

                    Now I'm really glad I said "we can possibly show...".

                    How many spooled files generally exist that a user might choose from? Does a user always pick only from their own spooled files? And are these usually expected to be printed the same day they are spooled? Or do they stay on the system for many days and often get printed later as .PDFs?

                    There are multiple solutions. Different answers could change the complexity.
                    Tom

                    There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.

                    Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth?

                    Comment


                    • #11
                      Re: Printer session with pdf virtual printer outputs blank pdf's

                      Heh heh. Users only have access to their own spool files (except us admin types, but we can manage CPYSPLF)
                      Users have a bunch of different files to print, and _generally_ print the same day, but the files _may_ linger for a few days.

                      I don't know why IBM didn't add an option in WRKSPLF to interface with the CPYSPLF command.

                      Comment

                      Working...
                      X