|
Thanks for the great examples. I will be trying them all. We also use a tool (Coolspools) to create pdf/html/whatever from spool files. The new system will basically allow the existing report program to be called from either greenscreen or browser, change the access method to sql and send the report back to the user either via the printer he selected or via html or pdf. Almost no changes required to the original program to do it. Trying to make it a "fill in the blanks" kind of conversion so we can use the same code a few hundred times. Would like to write it directly from the spool file to the web if I had a tool. Will look into it with our tool provider to see if they have suggestions. If any of you are unhappy with your spool to pdf/html/excel converter/emailer, we've been happy with this one and the support has been great. Works with generated sql statements also. As a 30 year rpg developer who is just making the transition to the web, your help is invaluable. Many thanks. Jim message: 7 date: Thu, 28 Dec 2006 14:03:12 -0600 (CST) from: Scott Klement <rpg400-l@xxxxxxxxxxxxxxxx> subject: Re: reading pdf/html from ifs send via cgidev2 Howdy Mr. History Channel,
Need some assistance on the retrieve from the ifs and send back vis cgi part.
I don't understand. What's the point of writing the data to the IFS, if only to read it back and write it to the browser? why not write it to the browser in the first place?
Any examples of doing this out there?
Lots of examples of writing HTML... PDF is harder to find. ------------------------------ message: 8 date: Thu, 28 Dec 2006 15:11:36 -0500 from: "Jim Franz" <jfranz@xxxxxxxxxxxx> subject: Re: reading pdf/html from ifs send via cgidev2 I cannot give a cgidev example, but using Websmart (a generated rpgle "cgi") have been doing this for many years. I use a spooled file to pdf tool called SPLAMATIC that works great. If using other tools, check if supports various spooled file types supported(*scs *afpds). Places the pdf in the ifs directory you specify. I create a url like /directory/user/p061228151202.pdf (unique file name from "p" + yymmddhhmmss) and then redirect to that url. User's browser sees it as .pdf and called the Adobe Reader to open. Have had major problems with Adobe Reader and/or browser (IE, Netscape, etc recognizing if or when to open the page within the browser rather than loading a new window. We warn all our customers to go into Adobe properties and uncheck the default to load within the current window. If within the browser and version & updates not matching in Adobe to browser may get blank page, or "back" button not correct. Adobe says it's MS fault and MS says it is Adobe's fault. This is not a server issue. Most updates from Adobe resets the default property and needs to be unchecked again. jim franz ----- Original Message ----- From: "Jim Horn" <jimh@xxxxxxxxxxxxxx> To: <rpg400-l@xxxxxxxxxxxx> Sent: Thursday, December 28, 2006 1:16 PM Subject: reading pdf/html from ifs send via cgidev2
To make a long story short, we will be converting an old reporting system to use cgidev2 to Request parameters from the user via a browser create pdf/html reports in the IFS based on browser requests retrieve the reports and send them back to the requesting browser. would prefer not to send a link. Need some assistance on the retrieve from the ifs and send back vis cgi part. Any examples of doing this out there? Thanks Jim Horn -- This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.
------------------------------ message: 9 date: Thu, 28 Dec 2006 15:23:05 -0500 from: "rick baird" <rick.baird@xxxxxxxxx> subject: Re: reading pdf/html from ifs send via cgidev2 I'm not very well versed in how cgidev2 works (just played briefly with it) but.... If you can already create the PDF and can give it a unique name via the CGI program, the program can tell the browser to open the pdf in a separate window by pushing the following code back to the browser via std out - (this is the only reply the browser receives from the CGI report request): C eval OutStr = 'Content-Type: Text/HTML' + C $CrLf + 'Pragma: no-cache' + C $CrLf + 'Expires: 0' + C $CrLf + 'Cache-Control: no-cache' + C $CrLf + $CrLf + C '<html><script language=JavaScript>' + C $CrLf + C 'var pdfWindow = window.open("' + C %trim(PDFPATH) + ",' + C '"pdfWindow","scrollbars,resizable,' + C 'width=750,height=540");'+ $CrLf + C 'pdfWindow;' + $CrLf + C 'pdfWindow.moveTo(3,3);' + $CrLf + C 'history.back();' + $CrLf + C '</script></html>' C exsr $APIStdOut - PDFPATH is the webserver defined path to the IFS location and file name. example: /webdirectory/pdfs/mypdffilename.pdf the code will open a new window, and the pdf extension tells the browser to open adobe reader and download the file. after the new window is displayed, the original browser will return - using history.back() - to the page that requested the report. hope this helps a little. On 12/28/06, Jim Horn <jimh@xxxxxxxxxxxxxx> wrote:
To make a long story short, we will be converting an old reporting system
to
use cgidev2 to Request parameters from the user via a browser create pdf/html reports in the IFS based on browser requests retrieve the reports and send them back to the requesting browser. would prefer not to send a link. Need some assistance on the retrieve from the ifs and send back vis cgi part. Any examples of doing this out there? Thanks Jim Horn -- This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.
------------------------------ message: 10 date: Thu, 28 Dec 2006 15:28:24 -0500 from: "rick baird" <rick.baird@xxxxxxxxx> subject: Re: reading pdf/html from ifs send via cgidev2 FYI, for the code below, the standard out to the browser looks like this: Content-Type: Text/HTML Pragma: no-cache' Expires: 0 Cache-Control: no-cache <html><script language=JavaScript> var pdfWindow = window.open("//webdirectory/pdfs/mypdffilename.pdf","pdfWindow","scrollbars, resizable,width=750,height=540"); pdfWindow; pdfWindow.moveTo(3,3); history.back(); </script></html> On 12/28/06, rick baird <rick.baird@xxxxxxxxx> wrote:
I'm not very well versed in how cgidev2 works (just played briefly with it) but.... If you can already create the PDF and can give it a unique name via the CGI program, the program can tell the browser to open the pdf in a separate window by pushing the following code back to the browser via std out - (this is the only reply the browser receives from the CGI report request): C eval OutStr = 'Content-Type: Text/HTML' + C $CrLf + 'Pragma: no-cache' + C $CrLf + 'Expires: 0' + C $CrLf + 'Cache-Control: no-cache' + C $CrLf + $CrLf + C '<html><script language=JavaScript>' + C $CrLf + C 'var pdfWindow = window.open("' + C %trim(PDFPATH) + ",' + C '"pdfWindow","scrollbars,resizable,' + C 'width=750,height=540");'+ $CrLf + C 'pdfWindow;' + $CrLf + C 'pdfWindow.moveTo(3,3);' + $CrLf + C 'history.back();' + $CrLf + C '</script></html>' C exsr $APIStdOut - PDFPATH is the webserver defined path to the IFS location and file name. example: /webdirectory/pdfs/mypdffilename.pdf the code will open a new window, and the pdf extension tells the browser to open adobe reader and download the file. after the new window is displayed, the original browser will return - using history.back() - to the page that requested the report. hope this helps a little. On 12/28/06, Jim Horn <jimh@xxxxxxxxxxxxxx> wrote:To make a long story short, we will be converting an old reporting
system to
use cgidev2 to Request parameters from the user via a browser create pdf/html reports in the IFS based on browser requests retrieve the reports and send them back to the requesting browser. would prefer not to send a link. Need some assistance on the retrieve from the ifs and send back vis cgi part. Any examples of doing this out there? Thanks Jim Horn -- This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing
list
To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.
------------------------------
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.