August 14th, 2008Htm2Pic ActiveX Control API Manual
All property & function names are self-explanatory. You’d be able to understand them even without the manual. However, I hate great product with poor documentation. The following type library definitions are written in Delphi, one of my favourite programming languages. OK, let’s go…
Properties Functions Events Enumerations
Properties
{<<< Output filename for snapshot image (full-length page)>>>} // eg. 'snapshot.gif', 'c:\webshot.jpg' // default value : 'snapshot.PNG' property OutputImage: WideString read Get_OutputImage write Set_OutputImage; {<<< Output filename for thumbnail image (created from snapshot image)>>>} // eg. 'thumbnail.bmp', 'c:\thumb.png' // default value : thumbnail.PNG' property OutputThumbnail: WideString read Get_OutputThumbnail write Set_OutputThumbnail; {<<< Whether to process windows messages or not, set to TRUE only when you're calling from a win form app that has a message loop, which allows the control to fire "OnStatusText" event. Otherwise your UI would be frozen during snapshooting. For server side integration, errors may occur if this property is set to TRUE, so just leave it default >>>} // default value : FALSE property ProcessWinMsg: WordBool read Get_ProcessWinMsg write Set_ProcessWinMsg; {<<< Browser window width in pixels >>>} // default value : 800 property BrowserWidth: Integer read Get_BrowserWidth write Set_BrowserWidth; {<<< While creating thumbnail from original snapshot, Htm2PicX crops height to specified value in pixels. Thus you can pick the part you want and avoid getting a distorted one. Set to zero if you do not want to crop. >>>} // default value : 600 property CropHeightTo: Integer read Get_CropHeightTo write Set_CropHeightTo; {<<< Force to take snapshot if timeout >>>} // default value : TRUE property ForceCapture: WordBool read Get_ForceCapture write Set_ForceCapture; {<<< Timeout in milliseconds >>>} // default value : 10000 property TimeOut: Integer read Get_TimeOut write Set_TimeOut; {<<< Delay in milliseconds. If set to zero, there would be no delay. >>>} // default value : 0 property Delay: Integer read Get_Delay write Set_Delay; {<<< Jpeg compression quality control. 0-100, the bigger number the higher quality. >>>} // default value : 95 property JpegQuality: Integer read Get_JpegQuality write Set_JpegQuality; {<<< You can create thumbnail image in 2 resizing methods, by fixed width&height or by zoom ratio. These 2 properties are valid while "ResizeType" is set to RT_RECT(refer to "Enumeration" section). You can also call the "SetThumbSize" function to set these 2 properties at one time (refer to "Functions" section) >>>} // default value : 400 property ThumbWidth: Integer read Get_ThumbWidth write Set_ThumbWidth; // default value : 300 property ThumbHeight: Integer read Get_ThumbHeight write Set_ThumbHeight; {<<< Zoom ratio for thumbnail creation. Valid while "ResizeType" is set to RT_ZOOM >>>} // default value : 0.50 property ThumbZoomRatio: Double read Get_ThumbZoomRatio write Set_ThumbZoomRatio; {<<< Resizing method for thumbnail creation >>> } // default value : RT_RECT (refer to "Enumerations" section) property ThumbResizeType: ResizeType read Get_ThumbResizeType write Set_ThumbResizeType; {<<< By default, Htm2PicX send request to the given URL using "GET" method. If this property gets set, "POST" method would be used instead, you know the rest >>> } // eg. 'username=dennis&password=123456' // default value : empty property PostData: WideString read Get_PostData write Set_PostData; //////////////////////////////////////// /// download control properties /// //////////////////////////////////////// // Disable script // default value : FALSE property NoScript: WordBool read Get_NoScript write Set_NoScript; // Disable activex // default value : FALSE property NoActiveX: WordBool read Get_NoActiveX write Set_NoActiveX; // Disable java applet // default value : TRUE property NoJava: WordBool read Get_NoJava write Set_NoJava; // Disable image // default value : FALSE property NoImage: WordBool read Get_NoImage write Set_NoImage; // Disable video // default value : TRUE property NoVideo: WordBool read Get_NoVideo write Set_NoVideo; // Disable background sound // default value : TRUE property NoBgSound: WordBool read Get_NoBgSound write Set_NoBgSound;
Functions
{<<< Get your user name and registration key set to remove watermarks in generated images>>>} procedure SetRegInfo(const AUsr: WideString; const APwd: WideString); safecall; {<<< Main functions for taking a snapshot of a webpage, the "Url" param could be a valid internet URL or a local webpage that may be rendered in common webbrowser. The leading protocal identifier "http://" is not necessary for URLs. eg. 'http://www.google.com', 'www.yahoo.com' , 'C:\mypage.html' For return value, refer to "Enumerations" section. >>>} function Snapshot(const Url: WideString): SnapshotResult; safecall; function SnapshotAs(const AURL: WideString; const AOutput: WideString): SnapshotResult; safecall; {<<< Now you can turn html source code into image with ease by calling these 2 functions >>>} function SnapshotHtml(const AHtml: WideString) : SnapshotResult; safecall; function SnapshotHtmlAs(const AHtml: WideString; const AOutput: WideString): SnapshotResult; safecall; {<<< Call "Stop" to interrupt during snapshooting>>>} procedure Stop; safecall; {<<< Call this to get detailed error message if error occurs >>>} function GetLastError: WideString; safecall; {<<< Create a thumbnail image in memory >>>} function MakeThumbnail: SnapshotResult; safecall; {<<< It calls "MakeThumbnail" first and save the image to disk >>>} function SaveThumbnail: SnapshotResult; {<<< For this one, you can specify the output filename >>>} function SaveThumbnailAs(const AFileName: WideString): SnapshotResult; safecall; {<<< Get the HBITMAP handle of the snapshot image in memory >>>} function GetSnapshotHandle: Integer; safecall; {<<< Get the HBITMAP handle of the thumbnail image in memory >>>} function GetThumbnailHandle: Integer; safecall; {<<< Htm2PicX has a built-in image list from which you can create multi-page TIFF/PDF/DCX documents. >>>} // Add current thumbnail to the image list procedure AddThumbnailToList; safecall; // Add current snapshot to the image list procedure AddSnapshotToList; safecall; // Clear the image list procedure ClearImageList; safecall; // Load a local image into the image list procedure AddImageToList(const AFileName: WideString); safecall; // Create multi-page TIFF document procedure MakeMultiPageTiffAs(const AFileName: WideString); safecall; // Create multi-page PDF document procedure MakeMultiPagePdfAs(const AFileName: WideString); safecall; // Create multi-page DCX document procedure MakeMultiPageDcxAs(const AFileName: WideString); safecall; //////////////////////////////////////// /// thumbnail effect functions /// //////////////////////////////////////// {<<< The color param can be RGB Color HEX string with leading '#' (eg: #c0c0c0) or Common Color Name (black,red,blue,yellow,white,Maroon,Green,Olive,Navy,Purple, Teal,Gray,Silver,Lime,Fuchsia,Aqua,LtGray,DkGray) >>>} // BorderWeight(0-255) procedure SetThumbEffectButtonize(const BorderColor: WideString; BorderWidth: Integer; BorderWeight: Integer); safecall; // Head to "Enumerations" section to check out "ShadowType" procedure SetThumbEffectDropShadow(Value: ShadowType); safecall; // Alpha(0-255) Htm2PicX applies a linear transform from one alpha value to another to the reflection area procedure SetThumbEffectReflection(APercent: Integer; const ABgColor: WideString; AAlphaA: Integer; AAlphaB: Integer); safecall; procedure SetThumbEffectRoundCorner(const ABgColor: WideString; ARadius: Integer); safecall; // "ARWidth" and "ARHeight" determines the final size of output image, Htm2PicX would automatically determine if you set them to zero. procedure SetThumbEffectRotate(ARWidth: Integer; ARHeight: Integer; AAngle: Double; const ABgColor: WideString); safecall; // "ALenA" and "ALenB" would also be automacally determined if set to zero. procedure SetThumbEffectTilt3D(ATiltType: Tilt3DType; ALenA: Integer; ALenB: Integer; ATiltAngle: Double; const ABgColor: WideString); safecall; // Cancel any effect setting procedure SetThumbEffectNone; safecall; {<<< This is a util function as it can convert images from one format to another among the supported ones. For "OutFormat" param, refer to "Enumerations" section >>>} // Htm2Pix currrently supports BMP, PNG, GIF, JPG, PCX, DCX, TGA, EMF, WMF, TIF, PDF procedure ConvertImage(const InFile: WideString; const OutFile: WideString; OutFormat: Integer); safecall;
Events
procedure OnStatusText(const AText: WideString); // Currently "AErrCode" is reserved, all errors has an error code of zero procedure OnError(AErrCode: Integer; const AErrMsg: WideString); // "ACode" is one of the values defined in enumeration type : SnapshotResult procedure OnComplete(ACode: Integer);
Enumerations
// Constants for enum SnapshotResult type SnapshotResult = TOleEnum; const HTM2PIC_SUCCESS = $00000000; HTM2PIC_FAILURE = $00000001; HTM2PIC_TIMEOUT = $00000002; HTM2PIC_EXCEPTION = $00000003; HTM2PIC_INTERRUPT = $00000004; // Constants for enum ResizeType type ResizeType = TOleEnum; const RT_ZOOM = $00000000; RT_RECT = $00000001; // Constants for enum ShadowType type ShadowType = TOleEnum; const ST_RIGHT_TOP = $00000000; ST_RIGHT_BOTTOM = $00000001; ST_LEFT_TOP = $00000002; ST_LEFT_BOTTOM = $00000003; ST_RECT = $00000004; // Constants for enum EffectType type EffectType = TOleEnum; const ET_BUTTONIZE = $00000000; ET_DROP_SHADOW = $00000001; ET_REFLECTION = $00000002; ET_ROUND_CORNER = $00000003; ET_ROTATE = $00000004; ET_TILT_3D = $00000005; // Constants for enum Tilt3DType type Tilt3DType = TOleEnum; const TT_VERT = $00000000; TT_HORI = $00000001; // Constants for enum ImageFormat type ImageFormat = TOleEnum; const IF_JPG = $00000000; IF_GIF = $00000001; IF_BMP = $00000002; IF_PNG = $00000003; IF_TIF = $00000004; IF_PCX = $00000005; IF_DCX = $00000006; IF_TGA = $00000007; IF_WMF = $00000008; IF_EMF = $00000009; IF_PDF = $0000000A;




October 24th, 2008 at 11:55 am
How can I disable the time stamp from appearing to end of the filename defined with /name option? For example /name mypic outputs mypic_12321.BMP instead of just mypic.bmp.
October 25th, 2008 at 8:17 am
Have installed the dll file with regsvr32 with your RegDLL.bat, rebooted my computer.
When I run your ASP.NET demo in Visual Studio I get the error
“Retrieving the COM class factory for component with CLSID {D7B82D3A-CA4B-425B-876D-113CBC6268BC} failed due to the following error: 800703e6.”
What have I done wrong?
October 28th, 2008 at 1:43 am
Hello, Thor, please import the dll into VS so that your IDE can recognize the registered component on your machine.
October 28th, 2008 at 1:46 am
Samppa, the component does not append random string to file name.
just set the ‘OutputImage’ property will be fine.
Our demo appends a random string so as to generate multiple images.
October 29th, 2008 at 4:23 pm
Upon calling the Snapshot method, I get the following:
Error from control: Access violation at address 0B6194BA in module ‘Htm2PicX.dll’. Read of address 00000000
How can I resolve this?