OAF_文件系列12_实现OAF导出PDF方式TemplateHelper

 

ap.paymentrequest.webui

PaymentRequestSignCO

 

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 = "后补发票";
            } else {
                fileName = "付款申请";
            }
            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);
    }

ERP技术讨论群: 288307890
技术交流,技术讨论,欢迎加入
Technology Blog Created By Oracle ERP - 鲍新建
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值