Package org.xhtmlrenderer.pdf

Examples of org.xhtmlrenderer.pdf.PDFEncryption


      // 設定字型
      ITextFontResolver fontResolver = iTextRenderer.getFontResolver();
      fontResolver.addFont(getFontPath(), BaseFont.IDENTITY_H,
          BaseFont.NOT_EMBEDDED);

      PDFEncryption pdfEncryption = new PDFEncryption();
      // 設定加密
      if (reportData.containsKey(ReportParamEnum.encrypt.toString())) {
        String password = (String) reportData
            .get(ReportParamEnum.encrypt.toString());
        if (!CapString.isEmpty(password)) {
          pdfEncryption.setUserPassword(password.getBytes());
        }
      }
      // 設定權限
      if (getAllowedPrivileges() != -1) {
        pdfEncryption.setAllowedPrivileges(getAllowedPrivileges());
      }
      iTextRenderer.setPDFEncryption(pdfEncryption);

      iTextRenderer.setDocument(document, fileUrlPrefix
          + servletContext.getRealPath("").replace("\\", "/") + "/");
View Full Code Here

TOP

Related Classes of org.xhtmlrenderer.pdf.PDFEncryption

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.