WebHTMLViewer in Windows is too slow to load pdf

Good Day to all,
I have just finished a Web app using Xojo 2020.2
I read the name of a pdf file from mysql db and i want to load and show that pdf inside a WebHtmlViewer control.

The name of the file is stored as String:
Var myfilename As String

I have a string pointing to the parent folder that the file exists:

Var DataFilesPath as String
If TargetWindows Then
DataFilesPath =“c:\datafiles\”
Else
DataFilesPath ="/opt/datafiles/"
End If

Finally, I load the file with the following code:

Var f As FolderItem = New FolderItem(Session.DataFilesPath+myfilename, FolderItem.PathModes.Shell)

pdfWebFile = WebFile.Open(f)
pdfWebFile.MIMEType = “application/pdf”
pdfWebFile.ForceDownload = False
myHTMLViewer.LoadURL(pdfWebFile.URL)

One important detail is that the file is a scanned document in pdf format.
So, when I run the application in Linux, it loads and show the pdf files very fast.
But when I run the same app in Windows, it takes a long time, and if for example the pdf file has more than 100 pages, it takes a cup of coffee to finally load it and show it.!!)

Can anybody explain why this is happening?
Thanks in advance!

Hello again,
It seems that the problem is not the Windows filesystem but the WebHtmlViewer component.
The file is loading fast from the filesystem.
The command
myHTMLViewer.LoadURL(pdfWebFile.URL)
is very slow when I run the app on Windows.

So, after searching I used the recommendation here:

I copied the pdf files inside my web server root directory (The IIS root directory in Windows), and changed the code as bellow:

var myhtml As String
myhtml = " <embed src="“http://127.0.0.1/myfile.pdf”" style="“width: 100%;height: 100%;”" />"
myHTMLViewer.LoadHTML(myhtml)

Remember to change 127.0.0.1 with your server IP address, in order to be accessible from other clients.

Maybe this is helpful to others too.

P.S. I want to change the title of this topic from " Windows is to slow to load pdf" to “WebHtmlViewer in Windows is to slow to load pdf”. Can anybody tell how to do it?

To change the title or the contents of a post, you have to do it within a certain time window, if the window passed then you can’t change the title/contents. This is a forum setting.

The only way now will be to contact a forum admin and ask them to change it.

Thanks Alberto.