Skip to content


The TTMSFNCWXPDFViewer is a component to display PDF files in your applications, including page thumbnails. There is programmatic access to navigate through pages, search text and more. It uses the PDF.js JavaScript library.

Load a PDF

You can load a PDF through different methods:

To load from a URL, use TTMSFNCWXPDFViewer.LoadFromURL. Keep in mind that the PDF will be retrieved via an HTTP request in this case, so any URLs that are CORS protected won’t be able to load.

A PDF can be load as a base64 encoded string by using the TTMSFNCWXPDFViewer.LoadFromBase64 method.

For VCL, FMX and LCL there is also an extra method available which enables PDF loading directly from files.

procedure TForm1.Button1Click(Sender: TObject);
 //From URL:
 //From base64:
 //From file (only VCL, FMX and LCL):


By default thumbnail generation is disabled. To enable this functionality, set the TTMSFNCWXPDFViewer.CalculateThumbnails property to True. After that, whenever a PDF is loaded, the thumbnails will be calculated. These thumbnails can be accessed by implementing the OnGenerateThumbnail event.

procedure TForm1.TMSFNCPDFViewer1GenerateThumbnail(Sender: TObject;
 NumPage: Integer; Base64Img: string);
 ms: TMemoryStream;
 b: TBytes;
 Base64DataImg: string;
 Base64DataImg := Copy(Base64Img, Pos(',', Base64Img) + 1, 
 b := TTMSFNCUtils.Decode64ToBytes(Base64DataImg);
 ms := TMemoryStream.Create;
 ms.Write(b, Length(b));
 ms.Position := 0;
 //Use your image here 
 //For example: load it into a bitmap from a stream


Property name Description
NextPage Navigate to the next page.
PreviousPage Navigate to the previous page.
ShowPage(AIndex: Integer) Show a page with a given index.
ZoomIn Zoom into the PDF.
ZoomOut Zoom out of the PDF.
TurnAngleLeft Rotate the PDF to the left by 90 degrees.
TurnAngleRight Rotate the PDF to the right by 90 degrees. GenerateImageActualPage
SearchText(TextToSearch: string) Search for a given text.


Property name Description
OnLoaded Event triggers when the PDF has loaded.
OnPageLoaded Event triggers when the current page has loaded.
OnPageRendered Event triggers when the current page has been rendered.
OnLoadError Event triggers when an error happens during loading.
OnGenerateThumbnail Event triggers for each generated thumbnail.
OnGenerateImagePage Event triggers as a result of the GenerateImageActualPage method.
OnHyperlinkClick Event triggers when a hyperlink is clicked in the PDF.
OnThumbnailProgress Event triggers as the thumbnails are being loaded. The progress can be tracked here.
OnViewerInitialized Event triggers when the TTMSFNCWXPDFViewer is initialized.
OnFoundSearchText Event triggers for each match for the SearchText method.
OnNotFoundSearchText Event triggers when no search results were found for a given text.
OnSearchTextFinished Event triggers when the text search finished.