|
Just thought you guys would like an update So far this works the best for returning a pdf from a browser request (in the real world we will be getting parameters and sending something meaningful back. This just illustrates the send back with the immediate opening of the pdf in a new window) We call this by putting the following in a browser window http://192.168.2.1:8015/TEST/TSTpdf.pgm H DFTACTGRP(*NO) ACTGRP('TEST') BNDDIR('QC2LE') D stdout s * import('_C_IFS_stdout') D fputs PR 10I 0 ExtProc('_C_IFS_fputs') D string * value options(*string) D stream * value D fflush PR 10U 0 ExtProc('_C_IFS_fflush') D STREAM * VALUE D DATA S 1000A VARYING D $CRLF S 2A D PDFPATH S 200A /FREE $CRLF = X'0D25'; PDFPATH = '''HTTP://192.168.2.1:8015/ATEMP/10SM074.PDF'''; DATA = 'CONTENT-TYPE: TEXT/HTML' + $CRLF + $CRLF + '<HTML>' + $CRLF + '<HEAD>' + $CRLF + '<SCRIPT LANGUAGE="JAVASCRIPT">' + $CRLF + 'var PDFWINDOW;' + $CRLF + 'function openMyWindow()' + ' {' + 'window.open(' + %TRIM(PDFPATH) + ',' + 'PDFWINDOW,"SCROLLBARS=1,RESIZABLE=1,WIDTH=750,HEIGHT=540");'+ '}' + $CRLF + '</SCRIPT>' + $CRLF + '</HEAD>' + $CRLF + '<BODY ONLOAD="openMyWindow();">' + $CRLF + '</BODY>' + $CRLF + '</HTML>'; FPUTS(DATA: STDOUT); FFLUSH(STDOUT); RETURN; /END-FREE Instead of this would like to try 'CONTENT-TYPE: application/pdf' Fputs above header Open ifs document Loop Read a buffer Fputs the buffer Fflush when done This would allow us to clean up the ifs right away. Might also work with other content types like excel What do you think? Jim
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.