Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Can not load pdf in Chrome
Can not load pdf in Chrome [message #1746698] Thu, 03 November 2016 11:59
David Song is currently offline David SongFriend
Messages: 213
Registered: April 2011
Senior Member

In my RAP project, pdf file is created by iText dynamically as inputstream and displayed in browser. it can work well in IE with Adobe Reader, but Chrome gives errors as below:

rap-client.js:106 Resource interpreted as Document but transferred with MIME type application/pdf

the code snippet is:

InputStream pdfData = (InputStream) RWT.getUISession().getHttpSession().getAttribute(PrintDialog.PDF_KEY);
		//HttpServletResponse resp = RWT.getResponse();
		response.setHeader("Cache-Control", "no-cache"); // HTTP 1.1
		//response.setHeader("Cache-Control", "max-age=0");
		response.setHeader("Content-Disposition", "inline");
		//response.setHeader("content-length", pdfData.);
		ByteArrayOutputStream bos = new ByteArrayOutputStream();
		int next =;
		while (next > -1) {
			next =;
		byte[] result = bos.toByteArray();

		try {
			ServletOutputStream out = response.getOutputStream();
		} catch (IOException e) {

ServiceManager manager = RWT.getServiceManager();
manager.registerServiceHandler(SERVICE_HANDLER, new PDFServiceHandler());

Previous Topic:link widget has no markup???
Next Topic:[ANN] RAP 3.2 M3 published
Goto Forum:

Current Time: Tue Oct 16 21:32:12 GMT 2018

Powered by FUDForum. Page generated in 0.01978 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top