dcsimg
Print tiff images on the fly, from my servlet
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   claustre_marc
Posted On:   Wednesday, July 17, 2002 03:31 AM

Please, look at it... my tiff image doesn't print in my browser (IE6). Could somone tell me why !???? // Method of a "Page" class public void write (OutputStream out) { // Reading of the tiff file (this.tempFile is a valid File) PlanarImage image = JAI.create("fileload", this.tempFile.getCanonicalPath ()); /* // Test : the writed file is a valid tiff file --> the reading is OK ! * File outFile = new File ("c:\temp\JLdsWeb\Test.tif"); * RenderedOp op = JAI.create("filestore", image, outFile.getCanonicalPath (), "tiff"); */ // Writing of the tiff file in the received OutputStream JAI.create("encod   More>>

Please, look at it... my tiff image doesn't print in my browser (IE6).
Could somone tell me why !????

			
// Method of a "Page" class
public void write (OutputStream out) {
// Reading of the tiff file (this.tempFile is a valid File)
PlanarImage image = JAI.create("fileload", this.tempFile.getCanonicalPath ());
/* // Test : the writed file is a valid tiff file --> the reading is OK !
* File outFile = new File ("c:\temp\JLdsWeb\Test.tif");
* RenderedOp op = JAI.create("filestore", image, outFile.getCanonicalPath (), "tiff");
*/
// Writing of the tiff file in the received OutputStream
JAI.create("encode", image, out, this.FORMAT_NAME, null);
}


// my 1st JSP :page.jsp (to call the 2nd JSP witch have an other content type)
<%@page
contentType="text/html"
language="java"
errorPage="errorpage.jsp"
import="com.damaris.ldsweb.*,com.damaris.data.*,com.damaris.page.*,java.util.*"
%>





<%=request.getContextPath()%>image.jsp>



// my 2nd JSP
<%@page
language="java"
errorPage="errorpage.jsp"
import="com.damaris.ldsweb.*,com.damaris.data.*,com.damaris.page.*,java.util.*"
%>



<%
// pageToPrint is an instance of the class "Page" (getContentType ( ) give the String "image/tiff")
response.setContentType(pageToPrint.getContentType ( ));
%>



<%
ServletOutputStream bOut = response.getOutputStream();
pageToPrint.write (bOut);
%>


   <<Less

Re: Print tiff images on the fly, from my servlet

Posted By:   Joachim_Schaaf  
Posted On:   Wednesday, July 17, 2002 05:53 AM

What do you expect when you change the content-type on a HTML page (like you did in your 2nd JSP)? The content-type of your HTML/JSP page is text/html.

If you want to display a (dynamic) image you have to do this in a IMG tag, like







Joachim

About | Sitemap | Contact