Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Display PDF / HTML in IWModalWindow
#1
Hello,

according to the demo on GitHub, I tried the following:

with MW do begin

  Reset;

  Autosize := false;
  CloseButtonVisible := true;
  Draggable := false;
  WindowWidth := 80;
  WindowHeight := 80;
  Src := 'legacy.pdf';
  OnAsyncClick := nil;
  OnAsyncClose := nil;

  Show;

end;

MW appears correctly but the PDF is not displayed. The window is empty.

The file is in wwwroot.

Another problem with loading an HTML file (MW.Src := 'legacy.html'):

The file is loaded and displayed. But all special characters (e. g. ä, ö, ü, ...) are displayed as question marks.

Something wrong on my side?  Huh


Thanks for solutions!!
The way to success is always under construction ... but i see a light at the end of the tunnel  Idea Big Grin
Reply
#2
For legacy.html, what encoding did you use to save the file?

For legacy.pdf, can you open it locally OK with the same browser?
Reply
#3
We use Word (German edition) and save documents as PDF or HTML.

So the HTML contains <meta http-equiv=Content-Type content="text/html; charset=windows-1252">

Legacy.pdf we can open locally in edge, chrome, firefox, opera and in safari on iPad
The way to success is always under construction ... but i see a light at the end of the tunnel  Idea Big Grin
Reply
#4
IntraWeb by default uses UTF-8. Older Windows encodings are long ago not recommended in any web application and you should be using Unicode instead. You can easily convert them using Delphi, command line tools, or even Notepad++.

In the blank window, press Ctrl-Shift-J. Are any errors displayed? I suggest doing this in Chrome. Although I prefer Firefox myself, at least to me the debugger in Chrome is simpler to view things.
Reply
#5
(02-12-2021, 01:23 PM)Lorbass Wrote: MW appears correctly but the PDF is not displayed. The window is empty.

The file is in wwwroot.


Another problem with loading an HTML file (MW.Src := 'legacy.html'):

The file is loaded and displayed. But all special characters (e. g. ä, ö, ü, ...) are displayed as question marks.

Open Developer Tools in your browser (F12) and select the network tab before clicking on the button that opens the MW. See the request for legacy.pdf and the status. This should give an indication of what is hapenning.

Regarding the special chars, convert the HTML file as UTF-8. All HTML files used directly by IW (templates, etc) must be UTF-8 files.
Reply
#6
Thanks for your advice!

The problem has basically been solved. But:

The display of PDF or HTML files works only if the browser settings are set accordingly.

Is there some way to check the user's browser settings?

Thank you in advance for any hints!
The way to success is always under construction ... but i see a light at the end of the tunnel  Idea Big Grin
Reply
#7
What browser settings are you referring to?
Reply
#8
For example Firefox:

Settings -> General -> Applications -> Portable Document Format (PDF) -> Open in Firefox = Only this option works correctly
The way to success is always under construction ... but i see a light at the end of the tunnel  Idea Big Grin
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)