Jump to content
Sign in to follow this  
DCAlliances

Download the image from generate code

Recommended Posts

DCAlliances

Hi there

I've a webpage that using Telerik reporting control and trying to download the image itself that generate by the reporting.

The problem is that src of the image is like this:

http://localhost/TVI/Telerik.ReportViewer.axd?culture=en-AU&uiculture=en-US&instanceid=35ae7ff449d34e4cb31abfd37a522a7d&&optype=ReportImage&StreamID=kyynhyzfm5t

I did try to use the followng code but NO luck to get the image.

$sImgDir = "c:\temp\"; Please make certain this folder already exists (silent failure if not)
    $oIMGs = _IEImgGetCollection($oIE2)

    For $oIMG in $oIMGs

        MsgBox(1, "Test", "Pass here")

        $sImgUrl = $oIMG.src
        $sImgFileName = $oIMG.nameProp

        MsgBox(1, "Test", $sImgUrl)
        MsgBox(1, "Test", $sImgFileName)

        INetGet($sImgUrl,  $sImgDir & "test.png")
    Next

Any ideas? How do I see the error if it's failing on INetGet? Is this somehow blocking this due to autogenerate image though?

I am taking approach due to if I use Export button somehow the AutoIt can't access the File Download security thingy and not even go to Save As window for some reason.

Edited by DCAlliances

Share this post


Link to post
Share on other sites
PsaltyDS

Examine the DOM with something like DebugBar. Is it inside a frame? Could be blocked by cross-site scripting protections.

Add _IEErrorHandlerRegister() and watch the SciTE console for "Access Denied" errors.

:blink:


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
DCAlliances

Examine the DOM with something like DebugBar. Is it inside a frame? Could be blocked by cross-site scripting protections.

Add _IEErrorHandlerRegister() and watch the SciTE console for "Access Denied" errors.

:blink:

Hi PsaltyDS

The controller produces iframe to generate an image. But I've managed to get src of the iframe though and managing to get the src the image for that. But as I said, the image src is in some sort "generate file" mechanism.

But anyway I'll checked out this "Access Denied" stuff. So if I found this, how do I combat this? I am getting close to get this report image file:)

Thanks

Share this post


Link to post
Share on other sites
DCAlliances

Continuing this.

Here's the HTML of iFrame as you can see there is IMG tag on this (only one) which the one that I am trying to download but as you can see it's not physical image but it's hitting on the file to generate image if you know what I mean.

<img alt="Image" src="/TVI/Telerik.ReportViewer.axd?culture=en-AU&amp;uiculture=en-US&amp;instanceid=166d92f7a0d64ecbbcd187538a2c9236&amp;&amp;optype=ReportImage&amp;StreamID=lnlxjvng0y4" style="position:relative;height:100%; left:170.833333333333px" />

<html>
<head>
<title>

</title>
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type='text/css'>
.s5 { width:333px;overflow:auto;word-wrap:break-normal; }
.s10 { padding-left:0.1cm;padding-right:0.1cm;padding-top:0cm;padding-bottom:0cm;color:Black;font-family:Arial;font-size:6pt;font-weight:normal;font-style:normal;text-align:center;vertical-align:top;border-left-style:None;border-top-style:None;border-right-style:None;border-bottom-style:None;border-left-color:Black;border-top-color:Black;border-right-color:Black;border-bottom-color:Black;border-left-width:1pt;border-top-width:1pt;border-right-width:1pt;border-bottom-width:1pt;overflow:hidden;word-wrap:break-word; }
.s2 { width:971px;overflow:auto;word-wrap:break-normal; }
.s8 { width:0px;height:27px;overflow:auto;word-wrap:break-normal; }
.s6 { width:522px;overflow:auto;word-wrap:break-normal; }
.s14 { width:0px;height:11px;overflow:auto;word-wrap:break-normal; }
.s4 { padding-left:0cm;padding-right:0cm;padding-top:0cm;padding-bottom:0cm;border-left-style:None;border-top-style:None;border-right-style:None;border-bottom-style:None;border-left-color:Black;border-top-color:Black;border-right-color:Black;border-bottom-color:Black;border-left-width:1pt;border-top-width:1pt;border-right-width:1pt;border-bottom-width:1pt;overflow:hidden;width:971px;height:472px; }
.s13 { width:0px;height:19px;overflow:auto;word-wrap:break-normal; }
.s3 { width:0px;height:472px;overflow:auto;word-wrap:break-normal; }
.s11 { width:0px;height:22px;overflow:auto;word-wrap:break-normal; }
.s0 { padding-left:0cm;padding-right:0cm;padding-top:0cm;padding-bottom:0cm;color:Black;font-family:Arial;font-size:10pt;font-weight:normal;font-style:normal;text-align:left;vertical-align:top;border-left-style:None;border-top-style:None;border-right-style:None;border-bottom-style:None;border-left-color:Black;border-top-color:Black;border-right-color:Black;border-bottom-color:Black;border-left-width:1pt;border-top-width:1pt;border-right-width:1pt;border-bottom-width:1pt;overflow:auto;word-wrap:break-normal; }
.s9 { width:0px;height:14px;overflow:auto;word-wrap:break-normal; }
.s7 { width:116px;overflow:auto;word-wrap:break-normal; }
.s1 { width:0px;height:0px;overflow:auto;word-wrap:break-normal; }
.s12 { padding-left:0.1cm;padding-right:0.1cm;padding-top:0cm;padding-bottom:0cm;color:Black;font-family:Arial;font-size:6pt;font-weight:normal;font-style:normal;text-align:left;vertical-align:top;border-left-style:None;border-top-style:None;border-right-style:None;border-bottom-style:None;border-left-color:Black;border-top-color:Black;border-right-color:Black;border-bottom-color:Black;border-left-width:1pt;border-top-width:1pt;border-right-width:1pt;border-bottom-width:1pt;overflow:hidden;word-wrap:break-word; }
.bodycenter { text-align:center; }
.bodycenter { text-align:-moz-center; }
</style>
<script type='text/javascript'>function BodyClickHandler() {  var window = document.parentWindow;  if (!window) window = document.contentWindow;  if (!window) window = document.defaultView;    var frameElement = (window) ? window.frameElement : null;  if (frameElement)  {      var viewer = frameElement.Viewer;      if ((viewer) && (viewer.HideEditorPopup))      {          viewer.HideEditorPopup();      }  }}</script>
</head>
<body id="ReportBody" class="bodycenter" style="overflow: hidden; margin: 0px 0px 0px 0px; vertical-align: center" onclick='BodyClickHandler();'>
<div id='ReportDiv' style='overflow:auto; width: 100%; height: 100%;'>
<table id='ConsolidatedReport' style='padding-left:0cm;padding-right:0cm;padding-top:0cm;padding-bottom:0cm;background-color:White;color:Black;font-family:Arial;font-size:10pt;font-weight:normal;font-style:normal;text-align:left;vertical-align:top;border-left-style:None;border-top-style:None;border-right-style:None;border-bottom-style:None;border-left-color:Black;border-top-color:Black;border-right-color:Black;border-bottom-color:Black;border-left-width:1pt;border-top-width:1pt;border-right-width:1pt;border-bottom-width:1pt;overflow:auto;word-wrap:break-normal;width:971px;margin-left: auto; margin-right: auto; overflow: hidden' cellspacing='0' cellpadding='0'>
<tr><td>
  <table cellspacing="0" cellpadding="0" border="0" style="width:100%;" class="s0">
    <tr>
      <td class="s1">
      </td>
      <td class="s2">
      </td>
    </tr>
    <tr valign="top">
      <td class="s3">
      </td>
      <td colspan="1" rowspan="1">
      <div class="s4"><img alt="Image" src="/TVI/Telerik.ReportViewer.axd?culture=en-AU&amp;uiculture=en-US&amp;instanceid=166d92f7a0d64ecbbcd187538a2c9236&amp;&amp;optype=ReportImage&amp;StreamID=lnlxjvng0y4" style="position:relative;height:100%; left:170.833333333333px" /></div></td>
    </tr>
  </table>
</td></tr>
<tr><td>
  <table cellspacing="0" cellpadding="0" border="0" style="width:100%;" class="s0">
    <tr>
      <td class="s1">
      </td>
      <td class="s5">
      </td>
      <td class="s6">
      </td>
      <td class="s7">
      </td>
    </tr>
    <tr valign="top">
      <td class="s8">
      </td>
      <td colspan="3" rowspan="1">
      </td>
    </tr>
    
    <tr valign="top">
      <td class="s13">
      </td>
      <td colspan="2" rowspan="1">
      </td>
    </tr>
    <tr valign="top">
      <td class="s14">
      </td>
    <td dir="ltr" lang="en-AU" class="s12" colspan="1" rowspan="1">Report generated on:8/07/2010 6:40:37 AM</td><td colspan="1" rowspan="1">
      </td>
    </tr>
  </table>
</td></tr>
<tr><td>
</td></tr>
</table></div>
<script type="text/javascript">
    var PageInfo = [0, 1];

</script></body>
</html>
Edited by DCAlliances

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.