× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



To simplify things...
Write the PDF on your IFS, then rather than read it and send it to the
browser, redirect the end-user to the PDF file using the Location: header.
You send that instead of the Content-type: header, something like this:

Location: http://www.mydomain.com//reports/293254.pdf\n\n

Where \n are linefeed characters.


-Bob Cozzi
www.RPGxTools.com
If everything is under control, you are going too slow.
- Mario Andretti


-----Original Message-----
From: web400-bounces@xxxxxxxxxxxx [mailto:web400-bounces@xxxxxxxxxxxx] On
Behalf Of Ricky Thompson
Sent: Thursday, April 21, 2005 10:54 AM
To: web400@xxxxxxxxxxxx
Subject: [WEB400] Pushing a PDF file with CGIDEV2

Can I push a PDF file out to a web browser?

 

I wrote the following RPG program thinking it would work but I get garbage.
We are wanting to dynamically produce the PDF and then push to the user.
The main reason I wanted to push it out was so that I could delete the PDF
as soon as they are done.  Am I going about this the wrong way?

 

 /copy cgidev2/qrpglesrc,hspecs                        

 /copy cgidev2/qrpglesrc,hspecsbnd                     

F*                                                     

 /copy cgidev2/qrpglesrc,prototypeb                    

 /copy cgidev2/qrpglesrc,usec                          

 /copy cgidev2/qrpglesrc,variables3                    

D IfsInpBuff      s          65535a   varying          

D InpBuffLen      s             10i 0                  

D IfsObj          s            255a                    

D FileHandle      s             10i 0                  

D ReturnInt       s             10i 0                  

D BytesIn         s             10i 0                  

 /copy cgidev2/qrpglesrc,prolog3                       

 /free                                                 

     clrhtmlBuffer();                                  

     gethtml('QHTMLSRC':'CGILIB':'EMLACK');            

     wrtsection('start');                              

     IfsObj = '/reports/293254.pdf';   

  //  1-Open the IFS file                              

  //  1-Open the IFS file                                               

     FileHandle = open(%trim(IfsObj) : O_RDONLY + O_TEXTDATA);          

  //  2-Read the IFS file                                               

     BytesIn = read(FileHandle : %addr(IfsInpBuff) :  %size(IfsInpBuff) :
%size(IfsInpBuff));  

  //  3-Close the IFS file                                              

     ReturnInt = close(FileHandle);                                     

     IfsInpBuff = %trim(IfsInpBuff);                                    

  //  Insert the string read into the CGI output buffer                 

     InpBuffLen = %checkr(' ':IfsInpBuff);                              

     WrtNoSection(%addr(IfsInpBuff): InpBuffLen);                       

     wrtsection('*fini');                                               

     *INLR = *On;                                                       

 /end-free                                                              

-- 
This is the Web Enabling the AS400 / iSeries (WEB400) mailing list
To post a message email: WEB400@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/web400.





As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.