PDFViewer
TsgcHTMLComponent_PDFViewer — render an in-page PDF viewer backed by pdf.js, with page navigation, zoom, search, download and print, in Delphi, C++ Builder and .NET.
TsgcHTMLComponent_PDFViewer — render an in-page PDF viewer backed by pdf.js, with page navigation, zoom, search, download and print, in Delphi, C++ Builder and .NET.
Point PDFURL at a document (or embed it with Base64Data), tune the toolbar, then read the HTML property; pdf.js does the rendering client-side.
TsgcHTMLComponent_PDFViewer
Toolbar + canvas + scoped CSS (pdf.js from CDN)
Delphi, C++ Builder, .NET
Set PDFURL (or Base64Data to embed the bytes directly), pick InitialPage, Zoom and Theme, then read HTML.
uses
sgcHTML_Component_PDFViewer;
var
oViewer: TsgcHTMLComponent_PDFViewer;
begin
oViewer := TsgcHTMLComponent_PDFViewer.Create(nil);
try
oViewer.ViewerID := 'invoice';
oViewer.PDFURL := '/invoices/INV-2026-0042.pdf';
oViewer.Height := '700px';
oViewer.InitialPage := 1;
oViewer.Zoom := 'page-width';
oViewer.Theme := pvLight;
oViewer.DownloadFileName := 'invoice-0042.pdf';
WebModule.Response := oViewer.HTML; // toolbar + canvas + pdf.js init script
finally
oViewer.Free;
end;
end;
// includes: sgcHTML_Component_PDFViewer.hpp
TsgcHTMLComponent_PDFViewer *oViewer = new TsgcHTMLComponent_PDFViewer(NULL);
try
{
oViewer->ViewerID = "invoice";
oViewer->PDFURL = "/invoices/INV-2026-0042.pdf";
oViewer->Height = "700px";
oViewer->InitialPage = 1;
oViewer->Zoom = "page-width";
oViewer->Theme = pvLight;
oViewer->DownloadFileName = "invoice-0042.pdf";
String html = oViewer->HTML; // toolbar + canvas + pdf.js init script
}
__finally
{
delete oViewer;
}
using esegece.sgcWebSockets;
var viewer = new TsgcHTMLComponent_PDFViewer();
viewer.ViewerID = "invoice";
viewer.PDFURL = "/invoices/INV-2026-0042.pdf";
viewer.Height = "700px";
viewer.InitialPage = 1;
viewer.Zoom = "page-width";
viewer.Theme = TsgcHTMLPDFViewerTheme.pvLight;
viewer.DownloadFileName = "invoice-0042.pdf";
string html = viewer.HTML; // toolbar + canvas + pdf.js init script
The members you reach for most often.
PDFURL loads a URL-hosted document; Base64Data embeds the bytes directly (an optional data:application/pdf;base64, prefix is stripped automatically).
ShowToolbar, ShowPageNav, ShowZoomControls, ShowDownload, ShowPrint and ShowSearch each show or hide one control group.
InitialPage sets the starting page; Zoom accepts auto, page-width, fit, a percentage or a numeric factor.
Theme (TsgcHTMLPDFViewerTheme: pvLight, pvDark) switches the toolbar and canvas color scheme.
PDFJSLibURL/PDFJSWorkerURL default to the jsDelivr CDN build; override both to self-host the library.
Width/Height size the viewer; DownloadFileName names the file saved by the Download button.
| Online HelpFull API reference and usage guide for this component. | Open | |
| All sgcHTML ComponentsBrowse the full feature matrix of 80+ components. | Open | |
| Download Free TrialThe 30-day trial ships the 60.HTML demo projects. | Open | |
| PricingSingle, Team and Site licenses with full source code. | Open |