# LoadFromBuffer Method

## Applies to

THtmlViewer component

## Deprecated

Use methods LoadFromDocument or LoadFromString instead.

## Declaration

procedure LoadFromBuffer(Buffer: PChar; BufSize: LongInt; const Reference: ThtString = '');

## Description

The LoadFromBuffer method loads an HTML document from a memory buffer. BufSize is the number of characters to be loaded. A terminating null character is not required.

Reference is an optional reference parameter.

## Example

Assume an HTML document exists in a TMemo object. The following code could be used to then copy the document to an THtmlViewer object:

    var
    	Buffer: PChar;
    	Size: integer;
    begin
    	Size := Memo1.GetTextLen;
    	Inc(Size);
    	GetMem(Buffer, Size);
    	Memo1.GetTextBuf(Buffer,Size);
    	Viewer.LoadFromBuffer(Buffer, Size-1);
    	FreeMem(Buffer, Size);
    end;

## See also

- LoadFromDocument Method
- LoadFromFile Method
- LoadFromStream Method
- LoadFromString Method
- OnhtStreamRequest Event