PDA

View Full Version : Printing a PDF file loaded to the ContentPanel -



thursday
26 Oct 2011, 11:06 PM
I loaded PDF file to the ContentPanel using setUrl method. I want to print the PDF by using the
following native function.

ContentPanel panel = new ContentPanel();

Frame frame = panel.setUrl("/url/of/file.pdf');
frame.setId("printId");

The native function is this

function printTrigger(elementId) {

var getMyFrame = document.getElementById(elementId);
getMyFrame.focus();
getMyFrame.contentWindow.print();
}

// This suggestion is from http://stackoverflow.com/questions/687675/can-a-pdf-files-print-dialog-be-opened-with-javascript

I always get null frame. Though the PDF is displaying properly in the ContentPanel.

I debugged the frame.getElement().getId() which is also correct.

Please help in pointing the error.

thanks!