You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by sh...@apache.org on 2015/07/19 22:41:34 UTC

svn commit: r1691852 - in /ofbiz/trunk: ./ applications/content/lib/ framework/base/lib/ framework/webapp/config/ framework/webapp/src/org/ofbiz/webapp/view/ framework/widget/src/org/ofbiz/widget/renderer/fo/ specialpurpose/example/config/ specialpurpo...

Author: shijh
Date: Sun Jul 19 20:41:32 2015
New Revision: 1691852

URL: http://svn.apache.org/r1691852
Log:
OFBIZ-6504.

1. Changed to use FOP 2.0 native encryption, jars are updated.

2. Now the Embeded options are request parameters supported in ScreenFopViewHandler.java, the options are:
http://xmlgraphics.apache.org/fop/2.0/pdfencryption.html#embedded
the default values of the options can be configured in framework/webapp/config/fop.properties.

3. The demo page is https://localhost:8443/example/control/ExampleReportPdfOptions?exampleId=EX01

4. Barcode is tested.

Added:
    ofbiz/trunk/applications/content/lib/fontbox-1.8.5.jar   (with props)
    ofbiz/trunk/applications/content/lib/jempbox-1.8.5.jar   (with props)
    ofbiz/trunk/applications/content/lib/pdfbox-1.8.5.jar   (with props)
    ofbiz/trunk/framework/base/lib/batik-all-1.8.jar   (with props)
    ofbiz/trunk/framework/base/lib/fop-2.0.jar   (with props)
    ofbiz/trunk/framework/base/lib/xmlgraphics-commons-2.0.1.jar   (with props)
Removed:
    ofbiz/trunk/applications/content/lib/fontbox-1.7.1.jar
    ofbiz/trunk/applications/content/lib/jempbox-1.7.1.jar
    ofbiz/trunk/applications/content/lib/pdfbox-1.7.1.jar
    ofbiz/trunk/framework/base/lib/batik-all-1.7.jar
    ofbiz/trunk/framework/base/lib/fop-1.1.jar
    ofbiz/trunk/framework/base/lib/xmlgraphics-commons-1.5.jar
    ofbiz/trunk/specialpurpose/example/lib/bcprov-jdk15-1.44.jar
    ofbiz/trunk/specialpurpose/example/src/org/ofbiz/example/ExampleEvents.java
Modified:
    ofbiz/trunk/.classpath
    ofbiz/trunk/framework/webapp/config/fop.properties
    ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/ApacheFopWorker.java
    ofbiz/trunk/framework/widget/src/org/ofbiz/widget/renderer/fo/ScreenFopViewHandler.java
    ofbiz/trunk/specialpurpose/example/config/ExampleUiLabels.xml
    ofbiz/trunk/specialpurpose/example/webapp/example/WEB-INF/controller.xml
    ofbiz/trunk/specialpurpose/example/widget/example/ExampleForms.xml

Modified: ofbiz/trunk/.classpath
URL: http://svn.apache.org/viewvc/ofbiz/trunk/.classpath?rev=1691852&r1=1691851&r2=1691852&view=diff
==============================================================================
--- ofbiz/trunk/.classpath (original)
+++ ofbiz/trunk/.classpath Sun Jul 19 20:41:32 2015
@@ -2,9 +2,9 @@
 <classpath>
     <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
     <classpathentry kind="lib" path="applications/content/lib/dom4j-1.6.1.jar"/>
-    <classpathentry kind="lib" path="applications/content/lib/fontbox-1.7.1.jar"/>
-    <classpathentry kind="lib" path="applications/content/lib/jempbox-1.7.1.jar"/>
-    <classpathentry kind="lib" path="applications/content/lib/pdfbox-1.7.1.jar"/>
+    <classpathentry kind="lib" path="applications/content/lib/pdfbox-1.8.5.jar"/>
+    <classpathentry kind="lib" path="applications/content/lib/jempbox-1.8.5.jar"/>
+    <classpathentry kind="lib" path="applications/content/lib/fontbox-1.8.5.jar"/>
     <classpathentry kind="lib" path="applications/content/lib/poi-3.10.1-20140818.jar"/>
     <classpathentry kind="lib" path="applications/content/lib/tika-core-1.7.jar"/>
     <classpathentry kind="lib" path="applications/content/lib/tika-parsers-1.7.jar"/>
@@ -15,10 +15,10 @@
     <classpathentry kind="lib" path="framework/base/lib/ant-1.9.0-ant-launcher.jar"/>
     <classpathentry kind="lib" path="framework/base/lib/avalon-framework-4.2.0.jar"/>
     <classpathentry kind="lib" path="framework/base/lib/barcode4j-2.1-barcode4j-fop-ext-complete.jar"/>
-    <classpathentry kind="lib" path="framework/base/lib/batik-all-1.7.jar"/>
+    <classpathentry kind="lib" path="framework/base/lib/batik-all-1.8.jar"/>
     <classpathentry kind="lib" path="framework/base/lib/clhm-release-1.0-lru.jar"/>
     <classpathentry kind="lib" path="framework/base/lib/esapi-2.1.0.jar"/>
-    <classpathentry kind="lib" path="framework/base/lib/fop-1.1.jar"/>
+    <classpathentry kind="lib" path="framework/base/lib/fop-2.0.jar"/>
     <classpathentry kind="lib" path="framework/base/lib/freemarker-2.3.22.jar"/>
     <classpathentry kind="lib" path="framework/base/lib/hamcrest-all-1.2.jar"/>
     <classpathentry kind="lib" path="framework/base/lib/httpclient-4.3.6.jar"/>
@@ -48,7 +48,7 @@
     <classpathentry kind="lib" path="framework/base/lib/ws-commons-java5-1.0.1.jar"/>
     <classpathentry kind="lib" path="framework/base/lib/ws-commons-util-1.0.2.jar"/>
     <classpathentry kind="lib" path="framework/base/lib/xercesImpl-2.9.1.jar"/>
-    <classpathentry kind="lib" path="framework/base/lib/xmlgraphics-commons-1.5.jar"/>
+    <classpathentry kind="lib" path="framework/base/lib/xmlgraphics-commons-2.0.1.jar"/>
     <classpathentry kind="lib" path="framework/base/lib/xmlrpc-client-3.1.2.jar"/>
     <classpathentry kind="lib" path="framework/base/lib/xmlrpc-common-3.1.2.jar"/>
     <classpathentry kind="lib" path="framework/base/lib/xmlrpc-server-3.1.2.jar"/>

Added: ofbiz/trunk/applications/content/lib/fontbox-1.8.5.jar
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/lib/fontbox-1.8.5.jar?rev=1691852&view=auto
==============================================================================
Binary file - no diff available.

Propchange: ofbiz/trunk/applications/content/lib/fontbox-1.8.5.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: ofbiz/trunk/applications/content/lib/jempbox-1.8.5.jar
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/lib/jempbox-1.8.5.jar?rev=1691852&view=auto
==============================================================================
Binary file - no diff available.

Propchange: ofbiz/trunk/applications/content/lib/jempbox-1.8.5.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: ofbiz/trunk/applications/content/lib/pdfbox-1.8.5.jar
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/lib/pdfbox-1.8.5.jar?rev=1691852&view=auto
==============================================================================
Binary file - no diff available.

Propchange: ofbiz/trunk/applications/content/lib/pdfbox-1.8.5.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: ofbiz/trunk/framework/base/lib/batik-all-1.8.jar
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/lib/batik-all-1.8.jar?rev=1691852&view=auto
==============================================================================
Binary file - no diff available.

Propchange: ofbiz/trunk/framework/base/lib/batik-all-1.8.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: ofbiz/trunk/framework/base/lib/fop-2.0.jar
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/lib/fop-2.0.jar?rev=1691852&view=auto
==============================================================================
Binary file - no diff available.

Propchange: ofbiz/trunk/framework/base/lib/fop-2.0.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: ofbiz/trunk/framework/base/lib/xmlgraphics-commons-2.0.1.jar
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/lib/xmlgraphics-commons-2.0.1.jar?rev=1691852&view=auto
==============================================================================
Binary file - no diff available.

Propchange: ofbiz/trunk/framework/base/lib/xmlgraphics-commons-2.0.1.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Modified: ofbiz/trunk/framework/webapp/config/fop.properties
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/config/fop.properties?rev=1691852&r1=1691851&r2=1691852&view=diff
==============================================================================
--- ofbiz/trunk/framework/webapp/config/fop.properties (original)
+++ ofbiz/trunk/framework/webapp/config/fop.properties Sun Jul 19 20:41:32 2015
@@ -26,3 +26,42 @@ fop.font.family=NotoSans
 #Set font base url
 fop.font.base.url=/framework/webapp/config/
 
+###############################################################################
+# FOP Encryption Parameters
+# Ref: http://xmlgraphics.apache.org/fop/2.0/pdfencryption.html
+###############################################################################
+#Set default encryption length, Any multiple of 8 between 40 and 128, or 256
+fop.encryption-length.default=
+
+#Set default user password
+fop.userPassword.default=
+
+#Set default owner password
+fop.ownerPassword.default=
+
+#Set default allow print, true or false, default is true
+fop.allowPrint.default=
+
+#Set default allow copy content, true or false, default is true
+fop.allowCopyContent.default=
+
+#Set default allow edit content, true or false, default is true
+fop.allowEditContent.default=
+
+#Set default allow edit annotations, true or false, default is true
+fop.allowEditAnnotations.default=
+
+#Set default allow fill-in forms, true or false, default is true
+fop.allowFillInForms.default=
+
+#Set default allow access content, true or false, default is true
+fop.allowAccessContent.default=
+
+#Set default allow assemble document, true or false, default is true
+fop.allowAssembleDocument.default=
+
+#Set default allow print high quality, true or false, default is true
+fop.allowPrintHq.default=
+
+#Set default encrypt metadata, true or false, default is true
+fop.encrypt-metadata.default=

Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/ApacheFopWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/ApacheFopWorker.java?rev=1691852&r1=1691851&r2=1691852&view=diff
==============================================================================
--- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/ApacheFopWorker.java (original)
+++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/ApacheFopWorker.java Sun Jul 19 20:41:32 2015
@@ -40,8 +40,8 @@ import org.apache.fop.apps.FOUserAgent;
 import org.apache.fop.apps.Fop;
 import org.apache.fop.apps.FopFactory;
 import org.apache.fop.apps.MimeConstants;
+import org.apache.fop.apps.io.ResourceResolverFactory;
 import org.ofbiz.base.location.FlexibleLocation;
-import org.ofbiz.base.start.Start;
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.FileUtil;
 import org.ofbiz.base.util.UtilProperties;
@@ -60,6 +60,37 @@ public class ApacheFopWorker {
     public static final String tempFilePrefix = "org.ofbiz.webapp.view.ApacheFopWorker-";
 
     protected static FopFactory fopFactory = null;
+    
+    public static final int encryptionLengthBitsDefault = 128;
+    
+    public static final String encryptionLengthDefault = UtilProperties.getPropertyValue("fop.properties", "fop.encryption-length.default", String.valueOf(encryptionLengthBitsDefault));
+
+    public static final String userPasswordDefault = UtilProperties.getPropertyValue("fop.properties", "fop.userPassword.default");
+
+    public static final String ownerPasswordDefault = UtilProperties.getPropertyValue("fop.properties", "fop.ownerPassword.default");
+
+    public static final String allowPrintDefault = UtilProperties.getPropertyValue("fop.properties", "fop.allowPrint.default", "true");
+
+    public static final String allowCopyContentDefault = UtilProperties.getPropertyValue("fop.properties", "fop.allowCopyContent.default", "true");
+
+    public static final String allowEditContentDefault = UtilProperties.getPropertyValue("fop.properties", "fop.allowEditContent.default", "true");
+
+    public static final String allowEditAnnotationsDefault = UtilProperties.getPropertyValue("fop.properties", "fop.allowEditAnnotations.default", "true");
+
+    public static final String allowFillInFormsDefault = UtilProperties.getPropertyValue("fop.properties", "fop.allowFillInForms.default", "true");
+
+    public static final String allowAccessContentDefault = UtilProperties.getPropertyValue("fop.properties", "fop.allowAccessContent.default", "true");
+
+    public static final String allowAssembleDocumentDefault = UtilProperties.getPropertyValue("fop.properties", "fop.allowAssembleDocument.default", "true");
+
+    public static final String allowPrintHqDefault = UtilProperties.getPropertyValue("fop.properties", "fop.allowPrintHq.default", "true");
+
+    public static final String encryptMetadataDefault = UtilProperties.getPropertyValue("fop.properties", "fop.encrypt-metadata.default", "true");
+    
+    public static final String fopPath = UtilProperties.getPropertyValue("fop.properties", "fop.path", "/framework/webapp/config");
+    
+    public static final String fopFontBaseProperty = UtilProperties.getPropertyValue("fop.properties", "fop.font.base.url", "/framework/webapp/config/");
+
 
     /** Returns an instance of the FopFactory class. FOP documentation recommends
      * the reuse of the factory instance because of the startup time.
@@ -71,35 +102,22 @@ public class ApacheFopWorker {
                 if (fopFactory != null) {
                     return fopFactory;
                 }
-                // Create the factory
-                fopFactory = FopFactory.newInstance();
-
-                // Limit the validation for backwards compatibility
-                fopFactory.setStrictValidation(false);
 
                 try {
                     String ofbizHome = System.getProperty("ofbiz.home");
-                    String fopPath = UtilProperties.getPropertyValue("fop.properties", "fop.path", "/framework/webapp/config");
                     File userConfigFile = FileUtil.getFile(ofbizHome + fopPath + "/fop.xconf");
                     if (userConfigFile.exists()) {
-                        fopFactory.setUserConfig(userConfigFile);
-                        URL baseUrl = new URL(fopFactory.getBaseURL());
-                        String protocol = baseUrl.getProtocol();
-                        String host = baseUrl.getHost();
-                        Integer baseport = baseUrl.getPort();
-                        Integer port = baseport + Start.getInstance().getConfig().portOffset;
-                        fopFactory.setBaseURL(protocol + "://" + host + ":" + port);
+                        fopFactory = FopFactory.newInstance(userConfigFile);
                     } else {
                         Debug.logWarning("FOP configuration file not found: " + userConfigFile, module);
                     }
-                    String fopFontBaseProperty = UtilProperties.getPropertyValue("fop.properties", "fop.font.base.url", "/framework/webapp/config/");
                     File fontBaseFile = FileUtil.getFile(ofbizHome + fopFontBaseProperty);
                     if (fontBaseFile.isDirectory()) {
-                        fopFactory.getFontManager().setFontBaseURL(fontBaseFile.toURI().toURL().toString());
+                        fopFactory.getFontManager().setResourceResolver(ResourceResolverFactory.createDefaultInternalResourceResolver(fontBaseFile.toURI()));
                     } else {
                         Debug.logWarning("FOP font base URL not found: " + fontBaseFile, module);
                     }
-                    Debug.logInfo("FOP FontBaseURL: " + fopFactory.getFontManager().getFontBaseURL(), module);
+                    Debug.logInfo("FOP FontBaseURL: " + fopFactory.getFontManager().getResourceResolver().getBaseURI(), module);
                 } catch (Exception e) {
                     Debug.logWarning(e, "Error reading FOP configuration: ", module);
                 }
@@ -119,16 +137,6 @@ public class ApacheFopWorker {
         StreamSource stylesheet = stylesheetFile == null ? null : new StreamSource(stylesheetFile);
         BufferedOutputStream dest = new BufferedOutputStream(new FileOutputStream(destFile));
         Fop fop = createFopInstance(dest, outputFormat);
-        if (fop.getUserAgent().getBaseURL() == null) {
-            String baseURL = null;
-            try {
-                File parentFile = new File(srcFile.getAbsolutePath()).getParentFile();
-                baseURL = parentFile.toURI().toURL().toExternalForm();
-            } catch (Exception e) {
-                baseURL = "";
-            }
-            fop.getUserAgent().setBaseURL(baseURL);
-        }
         transform(src, stylesheet, fop);
         dest.close();
     }
@@ -175,11 +183,24 @@ public class ApacheFopWorker {
      * @return Fop instance
      */
     public static Fop createFopInstance(OutputStream out, String outputFormat) throws FOPException {
+        return createFopInstance(out, outputFormat, null);
+    }
+
+    /** Returns a new Fop instance. Note: FOP documentation recommends using
+     * a Fop instance for one transform run only.
+     * @param out The target (result) OutputStream instance
+     * @param outputFormat Optional output format, defaults to "application/pdf"
+     * @param foUserAgent FOUserAgent object which may contains encryption-params in render options
+     * @return Fop instance
+     */
+    public static Fop createFopInstance(OutputStream out, String outputFormat, FOUserAgent foUserAgent) throws FOPException {
         if (UtilValidate.isEmpty(outputFormat)) {
             outputFormat = MimeConstants.MIME_PDF;
         }
-        FopFactory fopFactory = getFactoryInstance();
-        FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
+        if (UtilValidate.isEmpty(foUserAgent)) {
+            FopFactory fopFactory = getFactoryInstance();
+            foUserAgent = fopFactory.newFOUserAgent();
+        }
         Fop fop;
         if (out != null) {
             fop = fopFactory.newFop(outputFormat, foUserAgent, out);

Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/renderer/fo/ScreenFopViewHandler.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/renderer/fo/ScreenFopViewHandler.java?rev=1691852&r1=1691851&r2=1691852&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/renderer/fo/ScreenFopViewHandler.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/renderer/fo/ScreenFopViewHandler.java Sun Jul 19 20:41:32 2015
@@ -30,7 +30,11 @@ import javax.servlet.http.HttpServletReq
 import javax.servlet.http.HttpServletResponse;
 import javax.xml.transform.stream.StreamSource;
 
+import org.apache.fop.apps.FOUserAgent;
 import org.apache.fop.apps.Fop;
+import org.apache.fop.apps.FopFactory;
+import org.apache.fop.pdf.PDFEncryptionParams;
+import org.apache.fop.render.pdf.PDFEncryptionOption;
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.UtilCodec;
 import org.ofbiz.base.util.UtilProperties;
@@ -102,11 +106,50 @@ public class ScreenFopViewHandler extend
         if (UtilValidate.isEmpty(contentType)) {
             contentType = UtilProperties.getPropertyValue("widget", getName() + ".default.contenttype");
         }
+        
+        // get encryption related parameters
+        FOUserAgent foUserAgent = null;
+        String userPassword = request.getParameter("userPassword");
+        String ownerPassword = request.getParameter("ownerPassword");
+        boolean allowPrint = Boolean.parseBoolean(UtilValidate.isEmpty(request.getParameter("allowPrint")) ? ApacheFopWorker.allowPrintDefault : request.getParameter("allowPrint"));
+        boolean allowCopyContent = Boolean.parseBoolean(UtilValidate.isEmpty(request.getParameter("allowCopyContent")) ? ApacheFopWorker.allowCopyContentDefault : request.getParameter("allowCopyContent"));
+        boolean allowEditContent = Boolean.parseBoolean(UtilValidate.isEmpty(request.getParameter("allowEditContent")) ? ApacheFopWorker.allowEditContentDefault : request.getParameter("allowEditContent"));
+        boolean allowEditAnnotations = Boolean.parseBoolean(UtilValidate.isEmpty(request.getParameter("allowEditAnnotations")) ? ApacheFopWorker.allowEditAnnotationsDefault : request.getParameter("allowEditAnnotations"));
+        if (UtilValidate.isNotEmpty(userPassword) || UtilValidate.isNotEmpty(ownerPassword) || !allowPrint || !allowCopyContent || allowEditContent || !allowEditAnnotations) {
+            int encryptionLength = 128;
+            try {
+                encryptionLength = Integer.parseInt(request.getParameter("encryption-length"));
+            } catch (NumberFormatException e) {
+                try {
+                    encryptionLength = Integer.parseInt(ApacheFopWorker.encryptionLengthDefault);
+                } catch (NumberFormatException e1) {
+                    // ignore
+                }
+            }
+            
+            boolean encryptMetadata = Boolean.parseBoolean(UtilValidate.isEmpty(request.getParameter("encrypt-metadata")) ? ApacheFopWorker.encryptMetadataDefault : request.getParameter("encrypt-metadata"));
+            boolean allowFillInForms = Boolean.parseBoolean(UtilValidate.isEmpty(request.getParameter("allowFillInForms")) ? ApacheFopWorker.allowFillInFormsDefault : request.getParameter("allowFillInForms"));
+            boolean allowAccessContent = Boolean.parseBoolean(UtilValidate.isEmpty(request.getParameter("allowAccessContent")) ? ApacheFopWorker.allowAccessContentDefault : request.getParameter("allowAccessContent"));
+            boolean allowAssembleDocument = Boolean.parseBoolean(UtilValidate.isEmpty(request.getParameter("allowAssembleDocument")) ? ApacheFopWorker.allowAssembleDocumentDefault : request.getParameter("allowAssembleDocument"));
+            boolean allowPrintHq = Boolean.parseBoolean(UtilValidate.isEmpty(request.getParameter("allowPrintHq")) ? ApacheFopWorker.allowPrintHqDefault : request.getParameter("allowPrintHq"));
+            
+            FopFactory fopFactory = ApacheFopWorker.getFactoryInstance();
+            foUserAgent = fopFactory.newFOUserAgent();
+            PDFEncryptionParams pdfEncryptionParams = new PDFEncryptionParams(userPassword, ownerPassword, allowPrint, allowCopyContent, allowEditContent, allowEditAnnotations, encryptMetadata);
+            pdfEncryptionParams.setEncryptionLengthInBits(256);
+            pdfEncryptionParams.setAllowFillInForms(allowFillInForms);
+            pdfEncryptionParams.setAllowAccessContent(allowAccessContent);
+            pdfEncryptionParams.setAllowAssembleDocument(allowAssembleDocument);
+            pdfEncryptionParams.setAllowPrintHq(allowPrintHq);
+            pdfEncryptionParams.setEncryptionLengthInBits(encryptionLength);
+            foUserAgent.getRendererOptions().put(PDFEncryptionOption.ENCRYPTION_PARAMS, pdfEncryptionParams);
+        }
+        
         Reader reader = new StringReader(screenOutString);
         StreamSource src = new StreamSource(reader);
         ByteArrayOutputStream out = new ByteArrayOutputStream();
         try {
-            Fop fop = ApacheFopWorker.createFopInstance(out, contentType);
+            Fop fop = ApacheFopWorker.createFopInstance(out, contentType, foUserAgent);
             ApacheFopWorker.transform(src, null, fop);
         } catch (Exception e) {
             renderError("Unable to transform FO file", e, screenOutString, request, response);

Modified: ofbiz/trunk/specialpurpose/example/config/ExampleUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/example/config/ExampleUiLabels.xml?rev=1691852&r1=1691851&r2=1691852&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/example/config/ExampleUiLabels.xml (original)
+++ ofbiz/trunk/specialpurpose/example/config/ExampleUiLabels.xml Sun Jul 19 20:41:32 2015
@@ -1124,4 +1124,52 @@
         <value xml:lang="en">Password did not match confirm password.</value>
         <value xml:lang="zh">密码与验证密码不一致。</value>
     </property>
+    <property key="PDFOwnerPassword">
+        <value xml:lang="en">Owner Password</value>
+        <value xml:lang="zh">拥有者密码</value>
+    </property>
+    <property key="PDFUserPassword">
+        <value xml:lang="en">User Password</value>
+        <value xml:lang="zh">使用者密码</value>
+    </property>
+    <property key="PDFAllowPrint">
+        <value xml:lang="en">Allow Print</value>
+        <value xml:lang="zh">允许打印</value>
+    </property>
+    <property key="PDFAllowCopyContent">
+        <value xml:lang="en">Allow Copy Content</value>
+        <value xml:lang="zh">允许复制内容</value>
+    </property>
+    <property key="PDFAllowEditContent">
+        <value xml:lang="en">Allow Edit Content</value>
+        <value xml:lang="zh">允许编辑内容</value>
+    </property>
+    <property key="PDFAllowEditAnnotations">
+        <value xml:lang="en">Allow Edit Annotations</value>
+        <value xml:lang="zh">允许编辑注释</value>
+    </property>
+    <property key="PDFAllowFillInForms">
+        <value xml:lang="en">Allow Fill-in Forms</value>
+        <value xml:lang="zh">允许填写表格</value>
+    </property>
+    <property key="PDFAllowAccessContent">
+        <value xml:lang="en">Allow Access Content</value>
+        <value xml:lang="zh">允许访问内容</value>
+    </property>
+    <property key="PDFAllowAssembleDocument">
+        <value xml:lang="en">Allow Assemble Document</value>
+        <value xml:lang="zh">允许组装文档</value>
+    </property>
+    <property key="PDFAllowPrintHq">
+        <value xml:lang="en">Allow Print HQ</value>
+        <value xml:lang="zh">允许高质量打印</value>
+    </property>
+    <property key="PDFEncryptMetadata">
+        <value xml:lang="en">Encrypt Metadata</value>
+        <value xml:lang="zh">加密元数据</value>
+    </property>
+    <property key="PDFEncryptionLength">
+        <value xml:lang="en">Encryption Length</value>
+        <value xml:lang="zh">密钥长度</value>
+    </property>
 </resource>

Modified: ofbiz/trunk/specialpurpose/example/webapp/example/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/example/webapp/example/WEB-INF/controller.xml?rev=1691852&r1=1691851&r2=1691852&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/example/webapp/example/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/specialpurpose/example/webapp/example/WEB-INF/controller.xml Sun Jul 19 20:41:32 2015
@@ -230,13 +230,6 @@ under the License.
         <security https="true" auth="true"/>
         <response name="success" type="view" value="ExampleReportPdfOptions"/>
     </request-map>
-    <request-map uri="setExamplePdfPassword">
-        <security https="true" auth="true"/>
-        <event type="java" path="org.ofbiz.example.ExampleEvents" invoke="setExamplePdfPassword"/>
-        <response name="success" type="none"/>
-        <response name="nopassword" type="view" value="ExampleReportPdf"/>
-        <response name="error" type="view" value="ExampleReportPdfOptions"/>
-    </request-map>
     
     <!-- end of request mappings -->
 

Modified: ofbiz/trunk/specialpurpose/example/widget/example/ExampleForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/example/widget/example/ExampleForms.xml?rev=1691852&r1=1691851&r2=1691852&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/example/widget/example/ExampleForms.xml (original)
+++ ofbiz/trunk/specialpurpose/example/widget/example/ExampleForms.xml Sun Jul 19 20:41:32 2015
@@ -312,10 +312,65 @@ under the License.
         <field name="submitButton" title="${uiLabelMap.CommonAdd}"><submit button-type="button"/></field>
     </form>
 
-    <form name="SetExamplePdfPassword" type="single" target="setExamplePdfPassword" title="">
+    <form name="SetExamplePdfPassword" type="single" target="ExampleReportPdf" title="">
         <field name="exampleId"><hidden/></field>
-        <field name="PASSWORD" title="${uiLabelMap.CommonPassword}"><password size="15" maxlength="250"/></field>
-        <field name="CONFIRM_PASSWORD" title="${uiLabelMap.CommonPassword}" tooltip="* ${uiLabelMap.CommonConfirm}"><password size="15" maxlength="250"/></field>
+        <field name="ownerPassword" title="${uiLabelMap.PDFOwnerPassword}"><text size="15" maxlength="250"/></field>
+        <field name="userPassword" title="${uiLabelMap.PDFUserPassword}"><text size="15" maxlength="250"/></field>
+        <field name="allowPrint" title="${uiLabelMap.PDFAllowPrint}">
+            <drop-down>
+                <option key="true" description="${uiLabelMap.CommonTrue}"/>
+                <option key="false" description="${uiLabelMap.CommonFalse}"/>
+            </drop-down>
+        </field>
+        <field name="allowCopyContent" title="${uiLabelMap.PDFAllowCopyContent}">
+            <drop-down>
+                <option key="true" description="${uiLabelMap.CommonTrue}"/>
+                <option key="false" description="${uiLabelMap.CommonFalse}"/>
+            </drop-down>
+        </field>
+        <field name="allowEditContent" title="${uiLabelMap.PDFAllowEditContent}">
+            <drop-down>
+                <option key="true" description="${uiLabelMap.CommonTrue}"/>
+                <option key="false" description="${uiLabelMap.CommonFalse}"/>
+            </drop-down>
+        </field>
+        <field name="allowEditAnnotations" title="${uiLabelMap.PDFAllowEditAnnotations}">
+            <drop-down>
+                <option key="true" description="${uiLabelMap.CommonTrue}"/>
+                <option key="false" description="${uiLabelMap.CommonFalse}"/>
+            </drop-down>
+        </field>
+        <field name="allowFillInForms" title="${uiLabelMap.PDFAllowFillInForms}">
+            <drop-down>
+                <option key="true" description="${uiLabelMap.CommonTrue}"/>
+                <option key="false" description="${uiLabelMap.CommonFalse}"/>
+            </drop-down>
+        </field>
+        <field name="allowAccessContent" title="${uiLabelMap.PDFAllowAccessContent}">
+            <drop-down>
+                <option key="true" description="${uiLabelMap.CommonTrue}"/>
+                <option key="false" description="${uiLabelMap.CommonFalse}"/>
+            </drop-down>
+        </field>
+        <field name="allowAssembleDocument" title="${uiLabelMap.PDFAllowAssembleDocument}">
+            <drop-down>
+                <option key="true" description="${uiLabelMap.CommonTrue}"/>
+                <option key="false" description="${uiLabelMap.CommonFalse}"/>
+            </drop-down>
+        </field>
+        <field name="allowPrintHq" title="${uiLabelMap.PDFAllowPrintHq}">
+            <drop-down>
+                <option key="true" description="${uiLabelMap.CommonTrue}"/>
+                <option key="false" description="${uiLabelMap.CommonFalse}"/>
+            </drop-down>
+        </field>
+        <field name="encrypt-metadata" title="${uiLabelMap.PDFEncryptMetadata}">
+            <drop-down>
+                <option key="true" description="${uiLabelMap.CommonTrue}"/>
+                <option key="false" description="${uiLabelMap.CommonFalse}"/>
+            </drop-down>
+        </field>
+        <field name="encryption-length" title="${uiLabelMap.PDFEncryptionLength}"><text size="15"/></field>
         <field name="submitButton" title="${uiLabelMap.ExampleGeneratePDF}"><submit button-type="button"/></field>
     </form>
 </forms>