How to load from byte array

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF CoreSuite for COM/ActiveX (v7)  /  How to load from byte array

DynamicPDF CoreSuite for COM/ActiveX (v7) Forum

 Dec 14 2012 11:07 AM
I am pulling the PDF from my database.  How do I load the PDF?
 Dec 14 2012 4:58 PM
Posted by a ceTe Software moderator
Hello,

Below sample code shows how to load the PDF byte array.

        'read the PDF file into a byte array
        Dim objStream
        Set objStream = Server.CreateObject("ADODB.Stream")
        objStream.Open        
        objStream.Type = 1 'Type of stream file
        objStream.LoadFromFile Server.MapPath( "./DocumentB.pdf" )
            Dim MyData
            MyData = objStream.Read

        'create a PdfDocument object
        Dim pdf
        Set Pdf = Server.CreateObject( "DynamicPdf.PdfDocument" )

        'load the byte data into the PdfDocument
        pdf.LoadPdf MyData
        
        'create merge document using the PdfDocument
        Dim MyDataDocument
        Set MyDataDocument = Server.CreateObject( "DynamicPDF.Document" )
        MyDataDocument.LoadPdf pdf
        
        'draw to web page
        MyDataDocument.DrawToWeb 

Thanks,
ceTe Software Support Team.

All times are US Eastern Standard time. The time now is 11:49 PM.