PDA

View Full Version : Help: how to quick print (without preview) a pdf



SchattenMann
20 Jul 2009, 2:17 AM
hi to all

at this moment im stuck without any idea on how to do this.

basically i'm doing a very simple app to some "senior users" ( around 60 years old ) and i need a very simple report in pdf...

what i usually do is simple: i send some info to the server when click the print button, generate the pdf with the php fpdf class (http://www.fpdf.org/) and open it with the uxMediaWindow...

but now i need one more thing: to automatically print without any user input. usually the user have to click on the "print button" in the Acrobat Reader inside uxMediaWindow...but in this situation that won't be possible...

does anyone have anyidea on how to automatically start the print job?

many tks...

SchattenMann
20 Jul 2009, 6:01 AM
i had an idea that might work...

what i need is that when the window with pdf opens to input ctrl+p (to print), ENTER (to confirm message) and then ESC (to close window)...

is it possible to input those keys creating some sort of sequence or so...?

tks

MD
20 Jul 2009, 6:37 AM
Can't be done without manual intervention (at least not in any way I've ever heard of). If sites could trigger automatic printing, it'd be a spammer's dream come true. /:)

SchattenMann
20 Jul 2009, 6:53 AM
yes indeed my friend ...

but the same way i can put window.print() on body load...can't i do the same with a pdf?

i know that the windows print window will always appear but the user won't need to click somewhere to have it...

thats what i'm trying to accomplish here...

tks

steffenk
20 Jul 2009, 7:13 AM
no, it's not the same. window.print() only opens the dialog. There is no way of direct print!
(and this is good)

SchattenMann
20 Jul 2009, 7:26 AM
yes my friend i already understood that...

what i'm trying to accomplish now is just to open that dialog when opening a uxMediaWindow...



var mConfig = {
mediaType :'PDF',
url : 'mapas/Bilhete.php?id='+id+'&uid='+uid,//pdf file path
unsupportedText : 'Acrobat Viewer is not Installed',
resizable : true
};

var p = new Ext.ux.MediaWindow({
id : 'impressao_'+Math.random(),
bodyStyle : 'position:relative; padding:0px;',
width : 600,
height : 400,
mediaCfg : mConfig,
title : 'Impressão'
}).show();



this is what i have...and i need that when opening this window to automatically open the print window...

tried p.print() but it fails...