Oaf_ file Series 12_ implementation OAF export PDF Templatehelper (case)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.