PDF Programming

 

PDF and Active Server Pages

Active Server Pages are objects that write a specific file formats (MIME) to the web page. Whether it’s FDF or PDF, you must specify a Content Type or MIME type for the ASP to write to.

FDF Content Type is as follows:

Response.ContentType = “application/vnd.fdf

PDF Content Type is as follows:

Response.ContentType = “application/pdf

Since we are writing the PDF Format we use the PDF MIME for this example.

We also need a component registered with the Reg32Srv.dll (Server) called BinReadWriteBuf.dll. This object can read a binary file (PDF) and return it into a variable in an Active Server Pages Document.

 

<%@ Language=VBSCRIPT %>

<% Option Explicit %>

<%

On Error Resume Next

‘ Declare Binary Object Variables

Dim vntStream3, binObj3

 

‘ Turn Buffer On (Must be enabled in Server Settings)

Response.Buffer = true

 

‘ Declare PDF Filename Variable

Dim strPdfFileName

strPdfFileName = Server.MapPath(“/PDFs/My_PDF.pdf”)

 

‘ Create Binary Read Buffer Object

Set binObj3 = Server.CreateObject("binReadWriteBuf.BinRead")

 

‘ Set the Response MIME or Content Type = PDF

Response.ContentType = "application/pdf"

 

‘ Load Binary File to Object Variable

vntStream3 = binObj3.readBinFile(cPdfFileName)

 

‘ Write the Variable to Buffer

Response.BinaryWrite vntStream3

 

‘ Close Object

Set binObj3 = Nothing

 

‘ Clear errors

err.Clear

 

‘ End Response

Response.End

%>

 

 

 

Home
PDF Programming
ASP Server Setup
ASP Programming
Digital Signatures
FDF Programming
ASP.Net Server Setup
ASP.NET
Problems and Solutions
VB6 Programming

 

Copyright © 2003, 1991 - 2002

     

 

     
     
       

Last Updated 09/13/2003