See Also

Document Object

!UNRECOGNISED ELEMENT TYPE 'defaultmemberrequirements'!
ImageName
The name of the image to be embedded. It can be a name of the file or file name with full path.
ImageData
An array containing the raw image data.

Description

Adds an image to the PDF document from a byte array.

Syntax

Public Function AddRawImageData( _
   ByVal ImageName As String, _
   ByRef ImageData() As Byte _
) As String

Parameters

ImageName
The name of the image to be embedded. It can be a name of the file or file name with full path.
ImageData
An array containing the raw image data.

Return Type

String

Remarks

Returns a string that can be used as the FilePath on a AddImage method or AddBackgroundImage method.This method helps in Image Reuse and hence will not increase the final PDF size.

Example

[ASP - VBScript] 

<!-- METADATA TYPE="typelib" UUID="{DF9225FE-94A4-490D-8CAD-E8366CE621D3}"--> 
<% 
    ' Create a PDF Document 
    Dim MyDocument 
    Set MyDocument = Server.CreateObject( "DynamicPDF.Document" ) 
    ' Create a Page and add it to the document 
    Dim MyPage 
    Set MyPage = MyDocument.AddPage() 
    ' Add a label to the page 
    Dim MyLabel 
    Set MyLabel = MyPage.AddLabel( "My PDF Document", 0, 0, 512, 40 ) 
    MyLabel.Font = DPDF_Font_Helvetica 
    MyLabel.FontSize = 30 
    MyLabel.Align = DPDF_Align_Center 
    ' Use ADODB Stream object to get a Byte Array of the Image File 
    Dim MyStream 
    Set MyStream = Server.CreateObject( "ADODB.Stream" ) 
    MyStream.Open 
    MyStream.Type = 1 
    MyStream.LoadFromFile( Server.MapPath( "Images/DynamicPDF_Top.gif" ) ) 
    Dim MyStrPath 
    MyStrPath = MyDocument.AddRawImageData( "Top.gif", MyStream.Read ) 
    MyStream.Close 
    Set MyStream = Nothing 
    ' Now strMyPath can be used while adding Image to the Page or any other object to which other objects can be 'added 
    Dim MyImage 
    Dim MyImage1 
    Set MyImage = MyPage.AddImage( MyStrPath, 10, 30, 75 ) 
    ' The second Image is the same and hence will not increase the final PDF Size with the addition of another Image object which has the same reference produced by AddRawImageData method 
    Set MyImage1 = MyPage.AddImage( MyStrPath, 150, 150, 75 ) 
    MyPage.AddImage MyStrPath, 300, 270, 75 
    MyDocument.DrawToWeb 
    Set MyPage = Nothing 
    Set MyDocument = Nothing 
%> 

See Also

Document Object

 

 


© Copyright 2007, ceTe Software