I'm using javascript/JQuery and HTML to preview PDF in HTML format:
Javascript:
$("#print").click(function() {
var checkedItems = AUIGrid.getCheckedRowItemsAll(listGrid);
if(checkedItems.length <= 0) {
Common.alert("<spring:message code='000076'/>");
return false;
}
else if(checkedItems.length == 1 ) {
var itm = checkedItems[0];
$("#V_DELVRYNO").val(itm.delyno);
Common.report("printForm");
Common.popupDiv("/myPopUp.do");
}
else {
var tmpno = checkedItems[0].delyno;
var delbool = true;
for (var i = 0 ; i < checkedItems.length ; i++ ){
var itm = checkedItems[i];
if (tmpno != itm.delyno){
delbool = false;
break;
}
}
if (delbool) {
$("#V_DELVRYNO").val(tmpno);
Common.report("printForm");
Common.popupDiv("/myPopUp.do");
}
else {
Common.alert('<spring:message code="001255"/>');
return false;
}
}
});
HTML:
<li><p class="btn_grid"><a id="print">Print Report</a></p></li>
<form id="printForm" name="printForm">
<input type="hidden" id="viewType" name="viewType" value="PDF" />
<input type="hidden" id="V_DELVRYNO" name="V_DELVRYNO" value="" />
<input type="hidden" id="reportFileName" name="reportFileName" value="/logistics/Delivery_Note_for_Gl.rpt" /><br />
</form>
when I click print button, it seem incorrect, it download file and display popup as difference flow.. But as expect it will display PDF preview in popup and then i can click print this pdf..
Step 1: Click button 'Print', it appears popup preview of PDF
Step 2: And then, Crt + P to print (No need save file pdf)
How to fix the problem ? thank a lot