Loading...

DisplayFromURL not rendering images returned by JSP

Support for GdViewer OCX and GdViewer Pro ActiveX/SDK.

DisplayFromURL not rendering images returned by JSP

Postby pnagpal » Mon Oct 06, 2008 6:19 pm

I have a jsp page that returns the TIF image based on parameter passed. The JSP is returning TIF correctly that can be downloaded on machine or can be opened using windows fax viewer correctly, but when I open the same using GdViewer.DisplayFromURL error 106 is returned. Please help

VB Script for loading image is
Call MyGdViewer.DisplayFromURL("localhost", "/proc/a.jsp", 8080)

and Sample code for the JSP is listed below

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="java.io.File"%>
<%@page import="java.io.FileInputStream"%>
<%@page import="java.io.OutputStream"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<%
File _f = new File("C:\\apsimg\\AIRATC1.tif");
FileInputStream _is = new FileInputStream(_f);
OutputStream _out = null;
byte _buf[] ;
int _len;
_buf = new byte[1024];

response.setContentType("application/binary");
response.setHeader("Content-Disposition", "attachment; filename=a.tif");
_out = response.getOutputStream();
while ((_len = _is.read(_buf)) > 0) {
_out.write(_buf, 0, _len);
}
_is.close();
%>
</body>
</html>
pnagpal
 
Posts: 2
Joined: Tue Jun 17, 2008 2:26 pm

Re: DisplayFromURL not rendering images returned by JSP

Postby Loïc » Mon Oct 06, 2008 8:30 pm

Hi,

With the DIsplayFromURL() method, the GdViewer control are waiting for the transfer of an existing file stored on an http server. You can't load data which are generated dynamically from a Web Page.

I suggest you to catch the data returned by your URL into an array of bytes or within a Stream Object. Then, you will be able to use the DIsplayFromByteArray() or the DisplayFromStream() method.


Best regards,

Loïc Carrère
Loïc Carrère, support team.
www.orpalis.com
User avatar
Loïc
Site Admin
 
Posts: 4441
Joined: Tue Oct 17, 2006 10:48 pm
Location: France

Re: DisplayFromURL not rendering images returned by JSP

Postby pnagpal » Tue Oct 07, 2008 3:33 pm

I am using gdPictureViewer Activex with Javascript on the HTML Page.

Can I use DisplayFromStream in Javascript?
pnagpal
 
Posts: 2
Joined: Tue Jun 17, 2008 2:26 pm

Re: DisplayFromURL not rendering images returned by JSP

Postby Loïc » Wed Oct 08, 2008 11:11 am

To be honest, I don't know.

Other solutions consist to save you image content as string or bytes array and to use one of these methods:

DisplayFromString()
DisplayFromByteArray()


Best regards,

Loïc Carrère
Loïc Carrère, support team.
www.orpalis.com
User avatar
Loïc
Site Admin
 
Posts: 4441
Joined: Tue Oct 17, 2006 10:48 pm
Location: France


Return to GdViewer [Pro] ActiveX

Who is online

Users browsing this forum: Bing [Bot] and 1 guest