Dynamic Binary Content

For the real usage, the web application has to be able to send dynamic content in either text or binary format. In this section, the dynamic binary content is addressed.

The dynamic binary contents, such as formatted confirmation letters, on-line filled special forms, various reports, invoices, as well as the other kind of binary files, figures, graphs, images, even programs, are very important for web application.

Starting from the WebRainbow v1.2, the dynamic binary content sending capability has been included. The CPrint function can send either text or binary content now. The only extra code needed for sending binary content is to call SetCgiHeader, specify a proper content-type, then all characters, including NULL character, are going to the browser.

Here, the sample program DynaBin shows how to use CPrint to send binary content. This sample program first let users enter the name, address, then merge these data into a PDF template file and send it back to user.

Note:

  1. The VB source code DynaBin.bas. is for Visual Basic 6 & 5, and DynaBin4.bas is for Visual Basic 4, 32-bit version.

  2. This sample keeps JS.html, the JavaScript section, separated from dynamic section (this is not required, just we think it may be convenient for coding and developing):

To compile this sample, follow the steps list bellow:

  1. Start Visual Basic

  2. Select Standard EXE as project type

  3. Select Sub Main as Startup Object

  4. Give DynaBin as project name

  5. Set reference to WRHttpB.tlb, WRMimeB.tlb, and WRnbwB.tlb

  6. Remove Form1, which is the default form for new VB project

  7. Add DynaBin.bas (source code for Visual Basic 5 & 6) or DynaBin4.bas (source code for Visual Basic 4 32-bit), corresponding to the version of Visual Basic you used, into the Project DynaBin. These two files are normally in the folder
         C:\Program Files\WebRainbow\demo\dynabin\
    if you did not change the installation directory for WebRainbow.

  8. Compile it to DynaBin.exe.

To debug DynaBin:

  1. Create a folder HtmlFile9 in the same folder with DynaBin.vbp.

  2. copy pdftest.tmp and JS.html into this HtmlFile9 folder. These two files are normally in the folder
         C:\Program Files\WebRainbow\demo\dynabin\htmlfile\
    if you did not change the installation directory for WebRainbow.

click on Debug in VB IDE for detailed instruction.

To run this sample, click on the following link for instruction of


For the latest information on WebRainbow, please see:
http://www.dmfsys.com/wrainbow/

For questions / comments please email to:
support@dmfsys.com


Copyright © 2000 - 2005 D.M.F. Systems, Corporation. All rights reserved.

Last modified on March 2, 2005