Pentaho reportviewer URL not loading in iframe - html

Am new to pentaho.
I try to display the report using pentaho reportviewer in iframe i use .prpt file to load the report.
I used the following url in iframe
http://172.20.10.30:8080/pentaho/content/reporting/reportviewer/report.html?solution=steel-wheels&path=%2Freports&name=Inventory.prpt&userid=joe&password=password
If i invoke the above URL in the browser it display the report. I don't know the problem in the above code.
Hear is my Iframe code
<html>
<head>
<title>Sensatron Issue Testing</title>
</head>
<body>
<p><strong></strong><b> Sensatron Issue Testing.</b></p>
<iframe width="1300px" height="750px" src="http://172.20.10.30:8080/pentaho/content/reporting/reportviewer/report.html?solution=steel-wheels&path=%2Freports&name=Inventory.prpt&userid=joe&password=password" name="Bharat" >
</iframe><br>
<br>
</body>
</html>
Result:
iframe empty
Pentaho Server and its version.
I use pentaho BIserver4.5 to generate report using .prpt file
Thanks in advance.

This old question hasn't been answered yet and I also tried to find a solution.
One of solution is show html version of report as suggested in
http://pentahoreportingandintegration.blogspot.com/2013/04/pentaho-report-integration-in-iframe.html
But I believe the better solution is mine. I explained in my blog:
http://fabiantowang.blogspot.com/2013/07/embed-pentaho-report-viewer-to-web.html

Related

Angular 9 domSanitazer Not allowed to load resource [duplicate]

It works if the html file is local (on my C drive), but not if the html file is on a server and the image file is local. Why is that?
Any possible workarounds?
It would be a security vulnerability if the client could request local file system files and then use JavaScript to figure out what's in them.
The only way around this is to build an extension in a browser. Firefox extensions and IE extensions can access local resources. Chrome is much more restrictive.
shouldn't you use "file://C:/localfile.jpg" instead of "C:/localfile.jpg"?
Browsers aren't allowed to access the local file system unless you're accessing a local html page. You have to upload the image somewhere. If it's in the same directory as the html file, then you can use <img src="localfile.jpg"/>
C: is not a recognized URI scheme. Try file://c|/... instead.
Honestly the easiest way was to add file hosting to the server.
Open IIS
Add a Virtual Directory under Default Web Site
virtual path will be what you want to browse to in the browser. So if you choose "serverName/images you will be able to browse to it by going to http://serverName/images
Then add the physical path on the C: drive
Add the appropriate permissions to the folder on the C: drive for "NETWORK SERVICE" and "IIS AppPool\DefaultAppPool"
Refresh Default Web Site
And you're done. You can now browse to any image in that folder by navigating to http://yourServerName/whateverYourFolderNameIs/yourImage.jpg and use that url in your img src
Hope this helps someone
we can use javascript's FileReader() and it's readAsDataURL(fileContent) function to show local drive/folder file.
Bind change event to image then call javascript's showpreview function.
Try this -
<!doctype html>
<html>
<head>
<meta charset='utf-8'>
<meta name='viewport' content='width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=no;'>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
<title></title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script type="text/javascript">
function showpreview(e) {
var reader = new FileReader();
reader.onload = function (e) {
$("#previewImage").attr("src", e.target.result);
}
//Imagepath.files[0] is blob type
reader.readAsDataURL(e.files[0]);
}
</script>
</head>
<body >
<div>
<input type="file" name="fileupload" value="fileupload" id="fileupload" onchange='showpreview(this)'>
</div>
<div>
</div>
<div>
<img width="50%" id="previewImage">
</div>
</body>
</html>
IE 9 : If you want that the user takes a look at image before he posts it to the server :
The user should ADD the website to "trusted Website list".
Newtang's observation about the security rules aside, how are you going to know that anyone who views your page will have the correct images at c:\localfile.jpg? You can't. Even if you think you can, you can't. It presupposes a windows environment, for one thing.
if you use Google chrome browser you can use like this
<img src="E://bulbpro/pic_bulboff.gif" width="150px" height="200px">
But if you use Mozila Firefox the you need to add "file " ex.
<img src="file:E://bulbpro/pic_bulboff.gif" width="150px" height="200px">
starts with file:/// and ends with filename should work:
<img src="file:///C:/Users/91860/Desktop/snow.jpg" alt="Snow" style="width:100%;">
I see two possibilities for what you are trying to do:
You want your webpage, running on a server, to find the file on the computer that you originally designed it?
You want it to fetch it from the pc that is viewing at the page?
Option 1 just doesn't make sense :)
Option 2 would be a security hole, the browser prohibits a web page (served from the web) from loading content on the viewer's machine.
Kyle Hudson told you what you need to do, but that is so basic that I find it hard to believe this is all you want to do.
If you're deploying a local website just for yourself or certain clients, you can get around this by running mklink /D MyImages "C:/MyImages" in the website root directory as an admin in cmd. Then in the html, do <img src="MyImages/whatever.jpg"> and the symbolic link established by mklink will connect the relative src link with the link on your C drive. It solved this issue for me, so it may help others who come to this question.
(Obviously this won't work for public websites since you can't run cmd commands on people's computers easily)
I have tried a lot of techniques and finally found one in C# side and JS Side.
You cannot give a physical path to src attribute but you can give the base64 string as a src to Img tag.
Lets look into the below C# code example.
<asp:Image ID="imgEvid" src="#" runat="server" Height="99px"/>
C# code
if (File.Exists(filepath)
{
byte[] imageArray = System.IO.File.ReadAllBytes(filepath);
string base64ImageRepresentation = Convert.ToBase64String(imageArray);
var val = $"data: image/png; base64,{base64ImageRepresentation}";
imgEvid.Attributes.Add("src", val);
}
Hope this will help
background-image: url(${localImage});
If you want to add a file as background to your website locally.
You need to upload the image aswell, then link to the image on the server.
what about having the image be something selected by the user? Use a input:file tag and then after they select the image, show it on the clientside webpage? That is doable for most things. Right now i am trying to get it working for IE, but as with all microsoft products, it is a cluster fork().

Why can't I do <img src="C:/localfile.jpg">?

It works if the html file is local (on my C drive), but not if the html file is on a server and the image file is local. Why is that?
Any possible workarounds?
It would be a security vulnerability if the client could request local file system files and then use JavaScript to figure out what's in them.
The only way around this is to build an extension in a browser. Firefox extensions and IE extensions can access local resources. Chrome is much more restrictive.
shouldn't you use "file://C:/localfile.jpg" instead of "C:/localfile.jpg"?
Browsers aren't allowed to access the local file system unless you're accessing a local html page. You have to upload the image somewhere. If it's in the same directory as the html file, then you can use <img src="localfile.jpg"/>
C: is not a recognized URI scheme. Try file://c|/... instead.
Honestly the easiest way was to add file hosting to the server.
Open IIS
Add a Virtual Directory under Default Web Site
virtual path will be what you want to browse to in the browser. So if you choose "serverName/images you will be able to browse to it by going to http://serverName/images
Then add the physical path on the C: drive
Add the appropriate permissions to the folder on the C: drive for "NETWORK SERVICE" and "IIS AppPool\DefaultAppPool"
Refresh Default Web Site
And you're done. You can now browse to any image in that folder by navigating to http://yourServerName/whateverYourFolderNameIs/yourImage.jpg and use that url in your img src
Hope this helps someone
we can use javascript's FileReader() and it's readAsDataURL(fileContent) function to show local drive/folder file.
Bind change event to image then call javascript's showpreview function.
Try this -
<!doctype html>
<html>
<head>
<meta charset='utf-8'>
<meta name='viewport' content='width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=no;'>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
<title></title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script type="text/javascript">
function showpreview(e) {
var reader = new FileReader();
reader.onload = function (e) {
$("#previewImage").attr("src", e.target.result);
}
//Imagepath.files[0] is blob type
reader.readAsDataURL(e.files[0]);
}
</script>
</head>
<body >
<div>
<input type="file" name="fileupload" value="fileupload" id="fileupload" onchange='showpreview(this)'>
</div>
<div>
</div>
<div>
<img width="50%" id="previewImage">
</div>
</body>
</html>
IE 9 : If you want that the user takes a look at image before he posts it to the server :
The user should ADD the website to "trusted Website list".
Newtang's observation about the security rules aside, how are you going to know that anyone who views your page will have the correct images at c:\localfile.jpg? You can't. Even if you think you can, you can't. It presupposes a windows environment, for one thing.
if you use Google chrome browser you can use like this
<img src="E://bulbpro/pic_bulboff.gif" width="150px" height="200px">
But if you use Mozila Firefox the you need to add "file " ex.
<img src="file:E://bulbpro/pic_bulboff.gif" width="150px" height="200px">
starts with file:/// and ends with filename should work:
<img src="file:///C:/Users/91860/Desktop/snow.jpg" alt="Snow" style="width:100%;">
I see two possibilities for what you are trying to do:
You want your webpage, running on a server, to find the file on the computer that you originally designed it?
You want it to fetch it from the pc that is viewing at the page?
Option 1 just doesn't make sense :)
Option 2 would be a security hole, the browser prohibits a web page (served from the web) from loading content on the viewer's machine.
Kyle Hudson told you what you need to do, but that is so basic that I find it hard to believe this is all you want to do.
If you're deploying a local website just for yourself or certain clients, you can get around this by running mklink /D MyImages "C:/MyImages" in the website root directory as an admin in cmd. Then in the html, do <img src="MyImages/whatever.jpg"> and the symbolic link established by mklink will connect the relative src link with the link on your C drive. It solved this issue for me, so it may help others who come to this question.
(Obviously this won't work for public websites since you can't run cmd commands on people's computers easily)
I have tried a lot of techniques and finally found one in C# side and JS Side.
You cannot give a physical path to src attribute but you can give the base64 string as a src to Img tag.
Lets look into the below C# code example.
<asp:Image ID="imgEvid" src="#" runat="server" Height="99px"/>
C# code
if (File.Exists(filepath)
{
byte[] imageArray = System.IO.File.ReadAllBytes(filepath);
string base64ImageRepresentation = Convert.ToBase64String(imageArray);
var val = $"data: image/png; base64,{base64ImageRepresentation}";
imgEvid.Attributes.Add("src", val);
}
Hope this will help
background-image: url(${localImage});
If you want to add a file as background to your website locally.
You need to upload the image aswell, then link to the image on the server.
what about having the image be something selected by the user? Use a input:file tag and then after they select the image, show it on the clientside webpage? That is doable for most things. Right now i am trying to get it working for IE, but as with all microsoft products, it is a cluster fork().

How to include Perl into shtml files

Hi I am trying to include a perl script within my shtml file. Unfortunately when I do my script doesnt seem to run but instead it just displays the content of the script.
The code I am using is as follows:
test.shtml:
<html>
<title> business home page </title>
<body>
</br>
<!--#echo var="DATE_LOCAL" -->
<br />
<!--#include virtual="hello.pl"-->
</body>
</html>
hello.pl:
#!C:/Sun/WebServer6.1/bin/https/perl/perl
print "Content-type:text/html\n\n";
print "Hello World!";
I am not sure what I am doing wrong. Incase you all wanted to know the server I am using is Sun One WebServer 6.1 (OS = Windows XP). Thanks for your responses!
The de facto standard SSI directive for executing dynamic content within an SSI page is
<!--#exec cgi="hello.pl"-->
That works with Apache mod_include and at least a few other web servers that support SSI. No idea if it will work on your platform, but give it a shot.
Try getting rid of the first print statement in your Perl program, which sets the content-type header. That's not a useful thing to do in the body of an HTML page, which is where your SSI is located.
SSI is a rather quaint technology these days, even if it is occasionally useful, so if you are serious about learning web programming then this is not an area where you should spend much time.

Showing HTML reports in CruiseControl dashboard

I have been looking into CruiseControl configuration recently (I'm a complete CC noob) and so far I understand that various XML reports generated by your build process (eg mbunit.xml, ncover.xml, fxcop.xml) can be shown in the dashboard by adding a reference to the xml to the following part of the ccnet.config:
<publishers>
<merge>
<files>
<file>logs\some-report.xml</file>
</files>
</merge>
</publish>
adding an xsl file to transform the xml into presentable html and adding a report build plugin to dashboard.config which references the xsl:
<xslReportBuildPlugin description="Some report"
actionName="SomeReportAction" xslFileName="xsl\some-report.xsl" />
My question is: if I have some reports (code documentation generated by JGregory's Docu and test specs generated by jpboodhoo's Bdddoc) which are pure HTML, is there any way I can show these in the dashboard in a similar way? I can't figure this out. I did think of adding an ExternalLink directly to the HTML page, but this is in a protected area which users normally cant access. Anyone any ideas?
Currently this is not possible in CruiseControl.NET up to version 1.4.4. However this functionality is being added as part of version 1.5.0.
We can't give you a timeframe on the release yet, but you can download and try out the latest version from http://ccnetlive.thoughtworks.com/CCNet-builds/1.5.0/.
Craig
As craig already mentioned this functionality was added in CCNet 1.5, you'll find the documentation about the HtmlPlugin here: http://cruisecontrolnet.org/projects/ccnet/wiki/HtmlReportPlugin

Cannot display images in HTML component

I have the following HTML component, trying to display a local image, however it will not show up whether I use <img src="file:/tmp/img.png"> or <img src="/tmp/img.png" />. Any ideas why this doesn't work? Saving the file to a local file and opening it works fine!
var xhtml:XML = <html>
<body>
<img src="file:/tmp/logo.gif" />
</body>
</html>;
myhtml.htmlText = xhtml.toXMLString();
Update:
This works fine, btw, if I save the same xhtml to a file and use webkit to open that file using myhtml.htmlLoader.load(new URLRequest("file:///path/to/html/file")).
Did you check for security sandbox violation?
Also did you try with "tmp/img.png" and "./tmp/img.png"?
Or maybe Air doesn't support xhtml, I'm not sure. Try and remove the slash in the img tag like this:
myhtml.htmlText = "<html><body><img src=\"tmp/logo.gif\"></body></html>";
Did you check for any javascript error in other parts of you webpage? They might be preventing your webpage to open.
Syntax looks OK for embedding image, check it here:
http://www.w3schools.com/htmL/tryit.asp?filename=tryhtml_images2