PDA

View Full Version : Loading PDF in Ext.Window



softbender
24 Nov 2010, 4:58 PM
I have a servlet that returns a PDF. What i trying do is loading the PDF to Ext.Window. Below is the sample source

Ext.getCmp('hisAmpPhyWin').load(
{
url:'servlet/Servlet/',
params: {xhtml:xhtmlData},
text: 'Loading PDF...',
scripts: false
});

Where 'hisAmpPhyWin' is a Ext.Window instance.

The thing is its showing the PDF content (i mean ascii characters) not the actual PDF in the browser.

Please help to fix this issue.

moegal
25 Nov 2010, 5:59 AM
try searching the forum for IFrameComponent or displaying pdf in extjs. I use an iframe to display pdf's

Condor
25 Nov 2010, 6:08 AM
You could use:

var win = new Ext.Window({
title: 'My PDF',
bodyCfg: {
tag: 'iframe',
src: 'servlet/Servlet/?xhtml=' + encodeURIComponent(xhtmlData)
}
}).show();

softbender
25 Nov 2010, 4:49 PM
Excellent! Thanks

Daz
18 Jan 2011, 5:57 PM
Thanks, worked fine with IE/ Chrome/ Opera for Ext 3.3.1

With Safari 4.0.5 the PDF didn't appear.
Yet, if the window is resized after the PDF has downloaded it appears.
As a workaround I'm checking for Safari and using the embed tag and the PDF appears fine.

Any tips on how to make IFrames/ PDFs work with Safari?