DynamicPDF™ Generator for COM/ActiveX has support for 9 image types and transparent images. It can read images from a file, Byte Array. This section explains how to use images in a document.
Images can be added to a page using the Image Page Element or the BackgroundImage Page Element:
[VBScript]
' Adds a background image and image to a page.
MyPage.AddBackgroundImage Server.MapPath( "Images/ceTeSoftware_top.gif" )
MyPage.AddImage Server.MapPath( "Images/ceTeSoftware_top.gif" ), 0, 0
NOTE: The examples in this topic show how to add an image when it is not going to be reused multiple times. For details on how to most efficiently handle images that will be used multiple times, see the Image Reuse topic.
Adding Images From A File
Images can be created from a file as follows:
[VBScript]
' Adds an image to a page.
MyPage.AddImage Server.MapPath( "Images/ceTeSoftware_top.gif" ), 0, 0
Adding Images From A Byte Array
Images can be created from a byte array as follows:
[ASP - VBScript]
<!-- METADATA TYPE="typelib" UUID="{DF9225FE-94A4-490D-8CAD-E8366CE621D3}"-->
<%
' Adds an image from a byte array.
Dim MyDocument
Set MyDocument = Server.CreateObject( "DynamicPDF.Document" )
Dim MyStream
Set MyStream = Server.CreateObject( "ADODB.Stream" )
MyStream.Open
MyStream.Type = 1
MyStream.LoadFromFile( Server.MapPath( "Images/ceTeSoftware_top.gif" ) )
Dim strMyPath
MyFilePath = MyDocument.AddRawImageData( "Home.jpg", MyStream.Read )
MyStream.Close
Set MyStream = Nothing
Dim MyPage
Set MyPage = MyDocument.AddPage()
' Scale value is 24
Set MyImage = MyPage.AddImage( MyFilePath, 20, 100,75 )
MyDocument.DrawToWeb
Set MyPage = Nothing
Set MyDocument = Nothing
%>
The Variable MyFilePath can be used as FilePath parameter in Page AddImage method.
In This Section
- Image Formats
- Lists and Explains the different image formats that are supported.
- Image Resolution
- Explains how to set and adjust the resolution and size of images.
- Tiff Images
- Explains the different options for Tiff images that are supported.
- Image Reuse
- Explains how to most efficiently use reuse images.
| See Also |
BackgroundImage Class | Image Class | Image ReUse | Programming with Generator for COM/ActiveX

