Package org.apache.fop.pdf

Examples of org.apache.fop.pdf.PDFEncryptionParams


            pdfUtil.setXMode(PDFXMode.valueOf(s));
        }
            Configuration encryptionParamsConfig
                = cfg.getChild(PDFConfigurationConstants.ENCRYPTION_PARAMS, false);
        if (encryptionParamsConfig != null) {
            PDFEncryptionParams encryptionParams = pdfUtil.getEncryptionParams();
            Configuration ownerPasswordConfig = encryptionParamsConfig.getChild(
                    PDFConfigurationConstants.OWNER_PASSWORD, false);
            if (ownerPasswordConfig != null) {
                String ownerPassword = ownerPasswordConfig.getValue(null);
                if (ownerPassword != null) {
                    encryptionParams.setOwnerPassword(ownerPassword);
                }
            }
            Configuration userPasswordConfig = encryptionParamsConfig.getChild(
                    PDFConfigurationConstants.USER_PASSWORD, false);
            if (userPasswordConfig != null) {
                String userPassword = userPasswordConfig.getValue(null);
                if (userPassword != null) {
                    encryptionParams.setUserPassword(userPassword);
                }
            }
            Configuration noPrintConfig = encryptionParamsConfig.getChild(
                    PDFConfigurationConstants.NO_PRINT, false);
            if (noPrintConfig != null) {
                encryptionParams.setAllowPrint(false);
            }
            Configuration noCopyContentConfig = encryptionParamsConfig.getChild(
                    PDFConfigurationConstants.NO_COPY_CONTENT, false);
            if (noCopyContentConfig != null) {
                encryptionParams.setAllowCopyContent(false);
            }
            Configuration noEditContentConfig = encryptionParamsConfig.getChild(
                    PDFConfigurationConstants.NO_EDIT_CONTENT, false);
            if (noEditContentConfig != null) {
                encryptionParams.setAllowEditContent(false);
            }
            Configuration noAnnotationsConfig = encryptionParamsConfig.getChild(
                    PDFConfigurationConstants.NO_ANNOTATIONS, false);
            if (noAnnotationsConfig != null) {
                encryptionParams.setAllowEditAnnotations(false);
            }
            Configuration noFillInForms = encryptionParamsConfig.getChild(
                    PDFConfigurationConstants.NO_FILLINFORMS, false);
            if (noFillInForms != null) {
                encryptionParams.setAllowFillInForms(false);
            }
            Configuration noAccessContentConfig = encryptionParamsConfig.getChild(
                    PDFConfigurationConstants.NO_ACCESSCONTENT, false);
            if (noAccessContentConfig != null) {
                encryptionParams.setAllowAccessContent(false);
            }
            Configuration noAssembleDocConfig = encryptionParamsConfig.getChild(
                    PDFConfigurationConstants.NO_ASSEMBLEDOC, false);
            if (noAssembleDocConfig != null) {
                encryptionParams.setAllowAssembleDocument(false);
            }
            Configuration noPrintHqConfig = encryptionParamsConfig.getChild(
                    PDFConfigurationConstants.NO_PRINTHQ, false);
            if (noPrintHqConfig != null) {
                encryptionParams.setAllowPrintHq(false);
            }
            Configuration encryptionLengthConfig = encryptionParamsConfig.getChild(
                    PDFConfigurationConstants.ENCRYPTION_LENGTH, false);
            if (encryptionLengthConfig != null) {
                int encryptionLength = checkEncryptionLength(
                        Integer.parseInt(encryptionLengthConfig.getValue(null)));
                encryptionParams.setEncryptionLengthInBits(encryptionLength);
            }
        }

        s = cfg.getChild(PDFConfigurationConstants.KEY_OUTPUT_PROFILE, true).getValue(null);
        if (s != null) {
View Full Code Here


            throw new IllegalArgumentException("Boolean or \"true\" or \"false\" expected.");
        }
    }

    private void initialize() {
        PDFEncryptionParams params
                = (PDFEncryptionParams)userAgent.getRendererOptions().get(ENCRYPTION_PARAMS);
        if (params != null) {
            this.encryptionParams = params; //overwrite if available
        }
        String userPassword = (String)userAgent.getRendererOptions().get(USER_PASSWORD);
View Full Code Here

     * Gets the encryption parameters used by the PDF renderer.
     * @return encryptionParams the encryption parameters
     */
    PDFEncryptionParams getEncryptionParams() {
        if (this.encryptionParams == null) {
            this.encryptionParams = new PDFEncryptionParams();
        }
        return this.encryptionParams;
    }
View Full Code Here

            return 1;
        }
    }

    private PDFEncryptionParams getPDFEncryptionParams() throws FOPException {
        PDFEncryptionParams params = (PDFEncryptionParams)renderingOptions.get(
                        PDFRenderer.ENCRYPTION_PARAMS);
        if (params == null) {
            if (!PDFEncryptionManager.checkAvailableAlgorithms()) {
                throw new FOPException("PDF encryption requested but it is not available."
                        + " Please make sure MD5 and RC4 algorithms are available.");
            }
            params = new PDFEncryptionParams();
            renderingOptions.put(PDFRenderer.ENCRYPTION_PARAMS, params);
        }
        return params;
    }
View Full Code Here

    /**
     * @see org.apache.fop.render.Renderer#setUserAgent(FOUserAgent)
     */
    public void setUserAgent(FOUserAgent agent) {
        super.setUserAgent(agent);
        PDFEncryptionParams params
                = (PDFEncryptionParams)agent.getRendererOptions().get(ENCRYPTION_PARAMS);
        if (params != null) {
            this.encryptionParams = params; //overwrite if available
        }
        String pwd;
        pwd = (String)agent.getRendererOptions().get(USER_PASSWORD);
        if (pwd != null) {
            if (encryptionParams == null) {
                this.encryptionParams = new PDFEncryptionParams();
            }
            this.encryptionParams.setUserPassword(pwd);
        }
        pwd = (String)agent.getRendererOptions().get(OWNER_PASSWORD);
        if (pwd != null) {
            if (encryptionParams == null) {
                this.encryptionParams = new PDFEncryptionParams();
            }
            this.encryptionParams.setOwnerPassword(pwd);
        }
        Object setting;
        setting = agent.getRendererOptions().get(NO_PRINT);
        if (setting != null) {
            if (encryptionParams == null) {
                this.encryptionParams = new PDFEncryptionParams();
            }
            this.encryptionParams.setAllowPrint(!booleanValueOf(setting));
        }
        setting = agent.getRendererOptions().get(NO_COPY_CONTENT);
        if (setting != null) {
            if (encryptionParams == null) {
                this.encryptionParams = new PDFEncryptionParams();
            }
            this.encryptionParams.setAllowCopyContent(!booleanValueOf(setting));
        }
        setting = agent.getRendererOptions().get(NO_EDIT_CONTENT);
        if (setting != null) {
            if (encryptionParams == null) {
                this.encryptionParams = new PDFEncryptionParams();
            }
            this.encryptionParams.setAllowEditContent(!booleanValueOf(setting));
        }
        setting = agent.getRendererOptions().get(NO_ANNOTATIONS);
        if (setting != null) {
            if (encryptionParams == null) {
                this.encryptionParams = new PDFEncryptionParams();
            }
            this.encryptionParams.setAllowEditAnnotations(!booleanValueOf(setting));
        }
        String s = (String)agent.getRendererOptions().get(PDF_A_MODE);
        if (s != null) {
View Full Code Here

            return 1;
        }
    }

    private PDFEncryptionParams getPDFEncryptionParams() throws FOPException {
        PDFEncryptionParams params = (PDFEncryptionParams)renderingOptions.get(
                        PDFRenderer.ENCRYPTION_PARAMS);
        if (params == null) {
            if (!PDFEncryptionManager.checkAvailableAlgorithms()) {
                throw new FOPException("PDF encryption requested but it is not available."
                        + " Please make sure MD5 and RC4 algorithms are available.");
            }
            params = new PDFEncryptionParams();
            renderingOptions.put(PDFRenderer.ENCRYPTION_PARAMS, params);
        }
        return params;
    }
View Full Code Here

            return 1;
        }
    }

    private PDFEncryptionParams getPDFEncryptionParams() throws FOPException {
        PDFEncryptionParams params = (PDFEncryptionParams)foUserAgent.getRendererOptions().get(
                        PDFRenderer.ENCRYPTION_PARAMS);
        if (params == null) {
            if (!PDFEncryptionManager.checkAvailableAlgorithms()) {
                throw new FOPException("PDF encryption requested but it is not available."
                        + " Please make sure MD5 and RC4 algorithms are available.");
            }
            params = new PDFEncryptionParams();
            foUserAgent.getRendererOptions().put(PDFRenderer.ENCRYPTION_PARAMS, params);
        }
        return params;
    }
View Full Code Here

    /**
     * @see org.apache.fop.render.Renderer#setUserAgent(FOUserAgent)
     */
    public void setUserAgent(FOUserAgent agent) {
        super.setUserAgent(agent);
        PDFEncryptionParams params
                = (PDFEncryptionParams)agent.getRendererOptions().get(ENCRYPTION_PARAMS);
        if (params != null) {
            this.encryptionParams = params; //overwrite if available
        }
        String pwd;
        pwd = (String)agent.getRendererOptions().get(USER_PASSWORD);
        if (pwd != null) {
            if (encryptionParams == null) {
                this.encryptionParams = new PDFEncryptionParams();
            }
            this.encryptionParams.setUserPassword(pwd);
        }
        pwd = (String)agent.getRendererOptions().get(OWNER_PASSWORD);
        if (pwd != null) {
            if (encryptionParams == null) {
                this.encryptionParams = new PDFEncryptionParams();
            }
            this.encryptionParams.setOwnerPassword(pwd);
        }
        Object setting;
        setting = agent.getRendererOptions().get(NO_PRINT);
        if (setting != null) {
            if (encryptionParams == null) {
                this.encryptionParams = new PDFEncryptionParams();
            }
            this.encryptionParams.setAllowPrint(!booleanValueOf(setting));
        }
        setting = agent.getRendererOptions().get(NO_COPY_CONTENT);
        if (setting != null) {
            if (encryptionParams == null) {
                this.encryptionParams = new PDFEncryptionParams();
            }
            this.encryptionParams.setAllowCopyContent(!booleanValueOf(setting));
        }
        setting = agent.getRendererOptions().get(NO_EDIT_CONTENT);
        if (setting != null) {
            if (encryptionParams == null) {
                this.encryptionParams = new PDFEncryptionParams();
            }
            this.encryptionParams.setAllowEditContent(!booleanValueOf(setting));
        }
        setting = agent.getRendererOptions().get(NO_ANNOTATIONS);
        if (setting != null) {
            if (encryptionParams == null) {
                this.encryptionParams = new PDFEncryptionParams();
            }
            this.encryptionParams.setAllowEditAnnotations(!booleanValueOf(setting));
        }
        String s = (String)agent.getRendererOptions().get(PDF_A_MODE);
        if (s != null) {
View Full Code Here

        if (foUserAgent.getPDFEncryptionParams() == null) {
            if (!PDFEncryptionManager.checkAvailableAlgorithms()) {
                throw new FOPException("PDF encryption requested but it is not available."
                        + " Please make sure MD5 and RC4 algorithms are available.");
            }
            foUserAgent.setPDFEncryptionParams(new PDFEncryptionParams());
        }
        return foUserAgent.getPDFEncryptionParams();
    }
View Full Code Here

        if (foUserAgent.getPDFEncryptionParams() == null) {
            if (!PDFEncryptionManager.checkAvailableAlgorithms()) {
                throw new FOPException("PDF encryption requested but it is not available."
                        + " Please make sure MD5 and RC4 algorithms are available.");
            }
            foUserAgent.setPDFEncryptionParams(new PDFEncryptionParams());
        }
        return foUserAgent.getPDFEncryptionParams();
    }
View Full Code Here

TOP

Related Classes of org.apache.fop.pdf.PDFEncryptionParams

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.