Http://wenku.baidu.com/link?url=ujbT5CHkeC1bAtUn9Nsm_FgVB4k4nAWwwlphukyPGKNoPv5cDjRONWAZmf6RejggMg9onxIg_Rqi_ Gkkv665evffofz3ds_idkh9y3tskzq
public void Printpdf (Oapagecontext pagecontext, Oawebbean Webbean,
CLOB Xmlclob, String Printtype,
String Paymentrequestid) {
HttpServletResponse response =
(HttpServletResponse) Pagecontext.getrenderingcontext (). Getservletresponse ();
Set the Output report File Name and Content Type
String contentdisposition;
String FileName;
try {
if ("INVOICE". Equals (Printtype)) {
FileName = "Post-replenishment invoice";
} else {
FileName = "Payment Request";
}
Contentdisposition =
"Attachment;filename=" + java.net.URLEncoder.encode (filename,
"UTF-8") +
Paymentrequestid + ". pdf";
Response.setheader ("Content-disposition", contentdisposition);
Response.setcontenttype ("Application/pdf");
Reader Inputreader = Xmlclob.getcharacterstream ();
Oadbtransactionimpl Oatrans =
(Oadbtransactionimpl) Pagecontext.getapplicationmodule (Webbean). Getoadbtransaction ();
String templatename = "";
if ("CON". Equals (Printtype)) {
templatename = "Xvk_no_cnt_payment_request";
} else if ("INVOICE". Equals (Printtype)) {
templatename = "Xvk_add_inv_payment_request";
} else {
templatename = "Xvk_contract_payment_request";
}
Templatehelper.processtemplate (Oatrans.getappscontext (), "Xvk",
templatename, "zh", "CN",
Inputreader,
Templatehelper.output_type_pdf,
NULL, Response.getoutputstream ());
Response.getoutputstream (). Flush ();
Response.getoutputstream (). Close ();
} catch (Exception e) {
Response.setcontenttype ("text/html");
throw new Oaexception (E.getmessage (), oaexception.error);
}
Pagecontext.setdocumentrendered (FALSE);
}
Oaf_ file Series 12_ implementation OAF export PDF Templatehelper (case)