Re: Printing from HTTP

Scott Klement <[email protected]>
Newsgroups gmane.comp.systems.as400.web
Message-ID <[email protected]>
Hello Jay,

I believe that when you refer to an "HTTP session", you really mean a 
CGI program running under the IBM HTTP Server (Powered by Apache).

The IBM HTTP Server will user the operating system's "profile token" 
support to switch userids.  By default, it switches your job from the 
QTMHHTTP profile to QTMHHTP1, but this can be changed in the Apache 
configuration.  At any rate, whenever a job switches profiles, this 
affects spooled files.  This is not specific to the HTTP server, it is 
true of ANY job that switches profiles for any reason.  For security 
purposes, the current job id is not associated with spooled files, but 
instead, a QPRTJOB job is used.

You can learn more about this by reading about the Profile Token APIs, 
here: 
https://www.ibm.com/docs/en/i/7.4?topic=ssw_ibm_i_74/apis/qsysetpt.htm 
(There's similar information under "Profile Handles" as well, since they 
work the same way.)   Just look for QPRTJOB in the page to understand 
about how spooled files are named with a different job id, you don't 
necessarily have to read the entire page.

To solve your dilemna, you can call the Retrieve Identity of Last 
Spooled File Created (QSPRILSP) program.  Just call it, and it tells you 
the appropriate job id, et al, that you would need to know in order to 
use CPYSPLF 
https://www.ibm.com/docs/en/i/7.4?topic=ssw_ibm_i_74/apis/QSPRILSP.htm

Alternately, you can eliminate the CPYSPLF and use OVRPRTF instead.

Good Luck

-- 
Scott Klement
http://www.scottklement.com



On 11/24/21 3:26 PM, Jay wrote:
> I am extending an existing application to permit printing directly from the HTTP session.
> So far, okay. It prints when it is told to send to a printer.
> When I added in the ability to copy the spool file to a PDF file, I run into issues.
> The printer file name is okay, but the job is not longer the current job. It's the QPRTJOB session that handled the request.
> So, copying the spool file blows up.
>
> Is there a way to capture the actual printer job handling the print request?
> I'm expecting it to be 123456/QMHHTTP/username, but I wind up with a spool file in 123456/QPRTJOB/username.
>
>
-- 
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400) mailing list
To post a message email: [email protected]
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/web400
or email: [email protected]
Before posting, please take a moment to review the archives
at https://archive.midrange.com/web400.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.