I would like to display a pdf file in a control on a window. Is this possible without plug-ins?
Depends what you hope for with ‘display’
You can .openaspicture to get the contents of a pdf file.
It will show you the first page esaily (and display it nice, at 100%).
But how do you display another page / larger or smaller (more or less than 100%) ?
Why not load it in an HTMLViewer?
It’s a good solution …
Sub Openpdf(filename as string)
#if TargetWin32
filename = "file://" + replaceall(filename,"\","/")
#elseif TargetMacOS or TargetLinux
filename = "file://" + filename
#endif
' visualizza il file pdf su HTMLViewer
dim stringopen as string
stringopen = "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>" + EndOfLine
stringopen = stringopen + "<html xmlns='http://www.w3.org/1999/xhtml'>"+ EndOfLine
stringopen = stringopen + "<head>"+ EndOfLine
stringopen = stringopen + "<meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />"+ EndOfLine
stringopen = stringopen +"<title>Visualizzatore PDF</title>"+ EndOfLine
stringopen = stringopen +"</head>"+ EndOfLine
stringopen = stringopen +"<body>"+ EndOfLine
' qui il codice per la visualizzazione del PDF
stringopen = stringopen +"<object data='" + filename + "' type='application/pdf' style='width:100%; height:100%; '>"+ EndOfLine
stringopen = stringopen +"<p>Sembra che non sia installato un visualizzatore web per PDF."+ EndOfLine
stringopen = stringopen +"Puoi premere sul link <a href='" + filename + "'> per"+ EndOfLine
stringopen = stringopen +"scaricare direttamente il file PDF.</a></p>"+ EndOfLine
stringopen = stringopen +"</object>" + EndOfLine
stringopen = stringopen +"</body>"+ EndOfLine
stringopen = stringopen +"</html>"+ EndOfLine
Dim c As New Clipboard
c.Text = stringopen
c.Close
HTMLViewer1.LoadPage stringopen, Nil
HTMLViewer1.LoadURL(filename)
End Sub
you can delete this :
Dim c As New Clipboard
c.Text = stringopen
c.Close
( was used to do debug … )
I just put the pdf into a folderitem and open it that way.
dim f as FolderItem = SpecialFolder.Desktop.Child("guide.pdf")
HTMLViewer1.LoadPage f
you used to be able to open it in editable movie and step through pages
but that relied on magic quicktime on OS X did
[quote=67154:@Norman Palardy]
but that relied on magic quicktime on OS X did[/quote]
Yoda?
No
That relied on magic that quicktime on OS X performed
Clearer ?
LOL, yes.