I have to create previews of text documents or images or pdf, error code security, access denied
Error
Could not execute returned javascript: Accesso negato.
Source: window.location = "file:///C:/Users/ivanomonti/Desktop/Demo_Xojo/DebugDemo/circ_Human_Equality/document/Human_Equality_document_0.txt";
code
dim f as new FolderItem
dim namefolder as string = "circ_" + Session.IOFullName.ReplaceAll(" ","_")
f = GetFolderItem(namefolder)
if f.Exists = false then
return
end if
f = f.Child("document")
if f.Exists = false then
return
end if
f = f.Child(me.List(me.ListIndex))
ShowURL(f.URLPath)
scenery 2
Could not execute returned javascript: Accesso negato.
Source: window.location = "file:///C:/Users/ivanomonti/Desktop/Demo_Xojo/DebugDemo/circ_Human_Equality/document/Human_Equality_document_0.pdf";
new frameworkObject('S1xyldn7',[]);
Xojo.controls['S1xyldn7'].setEnabled(true);
new dialog('OetuKGET',['Close','Open','Shown','Close','Hidden','Open','Shown']);
Xojo.controls['OetuKGET'].setEnabled(true);
Xojo.controls['OetuKGET'].minWidth = 0;
Xojo.controls['OetuKGET'].minHeight = 0;
didFinishLoading();
Xojo.controls['OetuKGET'].present();
code
dim f as new FolderItem
dim namefolder as string = "circ_" + Session.IOFullName.ReplaceAll(" ","_")
f = GetFolderItem(namefolder)
if f.Exists = false then
return
end if
f = f.Child("document")
if f.Exists = false then
return
end if
f = f.Child(me.List(me.ListIndex))
dim md as new Modal_view
md.HTMLViewer1.ShowURL(f.URLPath,false)
md.Show
Could be a problem of permissions.
Also, who do you do f = f.Child(me.List(me.ListIndex))
AFTER checking if the fodlerItem exists ? Would it not make sense to be sure it exists before trying to display it ?
[quote=211503:@Michel Bujardet]Could be a problem of permissions.
Also, who do you do f = f.Child(me.List(me.ListIndex))
AFTER checking if the fodlerItem exists ? Would it not make sense to be sure it exists before trying to display it ?[/quote]
new code , but it does not open url, even if the file is error HTTP 404 !!!
dim f as new FolderItem
dim namefolder as string = "circ_" + Session.IOFullName.ReplaceAll(" ","_")
f = GetFolderItem(namefolder)
if f.Exists = false then
return
end if
f = f.Child("document")
if f.Exists = false then
return
end if
f = f.Child(me.List(me.ListIndex))
if f <> Nil And f.Exists Then
dim wfile As new WebFile
wfile = WebFile.Open(f)
wfile.MIMEType = "application/pdf"
dim md as new Modal_view
md.Show
md.HTMLViewer1.URL = wfile.URL
end if
wfile is getting out of scope. Make it a webpage property instead.
wfile as webFile
Then the URL is not complete. Do :
HTMLViewer1.URL = "http://"+session.header("host")+wfile.URL
[quote=211506:@Michel Bujardet]wfile is getting out of scope. Make it a webpage property instead.
wfile as webFile
Then the URL is not complete. Do :
HTMLViewer1.URL = "http://"+session.header("host")+wfile.URL
mmmmm ugual problem error 404
weblink
http://127.0.0.1:8080/28DA53A35D229FB9A488AD6DED22177E/files/0516-9632-2620-9333-3078/Human_Equality_document_0.pdf
dim f as new FolderItem
dim namefolder as string = "circ_" + Session.IOFullName.ReplaceAll(" ","_")
f = GetFolderItem(namefolder)
if f.Exists = false then
return
end if
f = f.Child("document")
if f.Exists = false then
return
end if
f = f.Child(me.List(me.ListIndex))
if f <> Nil And f.Exists Then
dim wfile As new WebFile
wfile = WebFile.Open(f)
wfile.MIMEType = "application/pdf"
dim md as new Modal_view
md.Show
md.Link1.URL = "http://" + session.header("host") + wfile.URL
md.HTMLViewer1.URL = "http://" + session.header("host") + wfile.URL
end if
Remove the line
dim wfile As new WebFile
Make sure you have added wfile as webfile to your WebPage.
[quote=211526:@Michel Bujardet]Remove the line
dim wfile As new WebFile
Make sure you have added wfile as webfile to your WebPage.[/quote]
I can not find solution!!!
change code, internet explore, safari, crome, firefox perfect, to webHtmlview error:
Couldn’t Open Pdf
Something’s keeping this pdf from opening.
codice
dim f as new FolderItem
dim namefolder as string = "circ_" + Session.IOFullName.ReplaceAll(" ","_")
f = GetFolderItem(namefolder)
if f.Exists = false then
return
end if
f = f.Child("document")
if f.Exists = false then
return
end if
f = f.Child(me.List(me.ListIndex))
if f <> Nil And f.Exists Then
dim md as new Modal_view
dim s as String = "http://" + Session.header("host") + "/circ_" + Session.IOFullName.ReplaceAll(" ","_") + "/document/" + me.List(me.ListIndex)
dim x as string = "<html xmlns='http://www.w3.org/1999/xhtml'>" + _
"<head>" + _
"<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1' />" + _
"<title>View</title>" + _
"</head>" + _
"<body>" + _
"<embed src='" + f.URLPath + "' width='600' height='600' alt='pdf' pluginspage='http://www.adobe.com/products/acrobat/readstep2.html' />" + _
"</body>" + _
"</html>"
md.Link1.URL = s
md.HTMLViewer1.LoadPage(x)
md.Show
end if
codice html generato
<html xmlns='http://www.w3.org/1999/xhtml'>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1' />
<title>View</title>
</head>
<body>
<embed src='file:///C:/Users/ivanomonti/Desktop/Demo_Xojo/DebugDemo/circ_Human_Equality/document/Human_Equality_document_0.pdf' width='600' height='600' alt='pdf' pluginspage='http://www.adobe.com/products/acrobat/readstep2.html' />
</body>
</html>
Help
[quote=211593:@Ivano Monti]I can not find solution!!!
change code, internet explore, safari, crome, firefox perfect, to webHtmlview error:
Couldn’t Open Pdf
Something’s keeping this pdf from opening.
Help[/quote]
You are now completely lost in your own complexity.
This works perfectly here. It is based on what you posted first. Just try to adapt it :
[code] dim f as new FolderItem
f = specialfolder.desktop.child(“ReadMe.pdf”)
if f <> Nil And f.Exists Then
//wfile is a property of self
wfile = WebFile.Open(f)
wfile.MIMEType = "application/pdf"
dim md as new Modal_view
md.Show
md.HTMLViewer1.URL = "http://" + session.header("host") + wfile.URL
end if[/code]
[quote=211601:@Ivano Monti]Result
and all day I slam head :-([/quote]
Add wfile as a webfile property to the page, and remove the line “dim wfile as Webfile”.
Michel thank 10000000000000000000000000000000000000
perfect