PDF.js will not open in the file:///
protocol, this is because of security issues with XmlHttpRequest
(ajax), the only way I can see to make this work is to create a proper protocol (if possible ) in Delphi, or else create a mini HTTP server that just for the use of PDF.js
A simple example of an HTTP server would be this:
procedure TMainForm.HTTPServerCommandGet(AContext: TIdContext;
ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo);
begin
AResponseInfo.ContentType := 'text/html';
AResponseInfo.CharSet := 'utf-8';
AResponseInfo.ContentStream := TMemoryStream.Create;
TMemoryStream(AResponseInfo.ContentStream).LoadFromFile(ExtractFilePath(Application.ExeName) + 'pdf.html');
end;
The command contains the pdf.js html:
ExtractFilePath(Application.ExeName) + 'pdf.html'