From 58f3fc7ace6d997f6f30c48839e123a2a75bfacc Mon Sep 17 00:00:00 2001 From: Asirika Date: Mon, 17 Feb 2020 08:41:07 +1100 Subject: [PATCH 1/4] pdf-toolkit 6.2 upgrade --- README.md | 96 ++-- pdf-toolkit-share/pom.xml | 238 +-------- pdf-toolkit-share/src/main/assembly/amp.xml | 13 +- .../src/main/assembly/web/README.md | 2 +- .../META-INF/share-config-custom.xml | 423 +++++++++++++++- pom.xml | 455 ++++++++++++++++++ 6 files changed, 946 insertions(+), 281 deletions(-) create mode 100644 pom.xml diff --git a/README.md b/README.md index eac846d..e8b66fa 100644 --- a/README.md +++ b/README.md @@ -1,50 +1,46 @@ -# This project is no longer being maintained. It does not fully work with the latest versions of Alfresco Share, nor does it currenly work with the Alfresco App Dev Framework (ADF) to my knowledge. If somebody wants to take over the project, feel free. - -alfresco-pdf-toolkit -==================== - -The new home of the Alfresco PDF Toolkit (replacing the deprecated Google Code project) - -Alfresco PDF Toolkit adds additional functionality to Alfresco that allows you to work with PDF files. - -The toolkit compatibility matrix and some additional information is available on addons.alfresco.com. If you find this stuff useful, please pop over to the addons site and "like" the project! - -Current Functionality: - -* Append - Append PDF to another PDF, generating a new PDF -* Split - Splits a PDF at a specified interval, (ex. 2 pages, 3 pages, etc.), generating new PDFs for each section. -* Split At - Split PDF into two PDFs at a specific page, generating two new PDFs. -* Insert PDF - Insert PDF at a specific Page -* Delete page(s) from a PDF document -* Extract page(s) from a PDF document -* PDF Watermarking -* PDF Encryption / decryption -* Digital Signatures -* Rotate PDF Documents -* TIFF to PDF transformation (currently rather rudimentary, but functional) -* Extended metadata to capture information about encryption or signature events -* Search for encrypted or signed documents by encryption or signature metadata - - -All of the actions are available as actions that can be used in content rules, and as document library actions in the document browse and detail views. - -Note that as of Version 1.2, the legacy Explorer UI components will no longer be maintained and will be fully removed in version 1.3. - -NOTE: The latest 1.3 betas remove the PDF/A conversion action, since that action has dependencies on Alfresco Enterprise. I'm committed to keeping this project 100% compatible with Alfresco community. The PDF/A action will be released as a separate module for Alfresco Enterprise. - -A teaser screencast is available here: - -http://www.youtube.com/watch?v=cJYpFgx037E - -Functionality in development: - -* Minimally requires Alfresco 3.4 for the repository tier actions, 4.1 for the Share UI components. - -LICENSING - -The Alfresco PDF Toolkit is an unsupported, community developed open source project. The project code itself is released under the -AGPL License. - -iText - Affero GPL 3 (http://itextpdf.com/terms-of-use/agpl.php) - - +# Alfresco AIO Project - SDK 4.0 + +This is an All-In-One (AIO) project for Alfresco SDK 4.0. + +Run with `./run.sh build_start` or `./run.bat build_start` and verify that it + + * Runs Alfresco Content Service (ACS) + * Runs Alfresco Share + * Runs Alfresco Search Service (ASS) + * Runs PostgreSQL database + * Deploys the JAR assembled modules + +All the services of the project are now run as docker containers. The run script offers the next tasks: + + * `build_start`. Build the whole project, recreate the ACS and Share docker images, start the dockerised environment composed by ACS, Share, ASS and + PostgreSQL and tail the logs of all the containers. + * `build_start_it_supported`. Build the whole project including dependencies required for IT execution, recreate the ACS and Share docker images, start the + dockerised environment composed by ACS, Share, ASS and PostgreSQL and tail the logs of all the containers. + * `start`. Start the dockerised environment without building the project and tail the logs of all the containers. + * `stop`. Stop the dockerised environment. + * `purge`. Stop the dockerised container and delete all the persistent data (docker volumes). + * `tail`. Tail the logs of all the containers. + * `reload_share`. Build the Share module, recreate the Share docker image and restart the Share container. + * `reload_acs`. Build the ACS module, recreate the ACS docker image and restart the ACS container. + * `build_test`. Build the whole project, recreate the ACS and Share docker images, start the dockerised environment, execute the integration tests from the + `integration-tests` module and stop the environment. + * `test`. Execute the integration tests (the environment must be already started). + +# Few things to notice + + * No parent pom + * No WAR projects, the jars are included in the custom docker images + * No runner project - the Alfresco environment is now managed through [Docker](https://www.docker.com/) + * Standard JAR packaging and layout + * Works seamlessly with Eclipse and IntelliJ IDEA + * JRebel for hot reloading, JRebel maven plugin for generating rebel.xml [JRebel integration documentation] + * AMP as an assembly + * Persistent test data through restart thanks to the use of Docker volumes for ACS, ASS and database data + * Integration tests module to execute tests against the final environment (dockerised) + * Resources loaded from META-INF + * Web Fragment (this includes a sample servlet configured via web fragment) + +# TODO + + * Abstract assembly into a dependency so we don't have to ship the assembly in the archetype + * Functional/remote unit tests diff --git a/pdf-toolkit-share/pom.xml b/pdf-toolkit-share/pom.xml index db7f636..642dd33 100644 --- a/pdf-toolkit-share/pom.xml +++ b/pdf-toolkit-share/pom.xml @@ -2,250 +2,38 @@ 4.0.0 - org.alfresco.extension pdf-toolkit-share - 1.4.3-SNAPSHOT - Alfresco PDF Toolkit - Share - Alfresco PDF Toolkit Share customizations + Alfresco Share JAR Module jar + Sample Share JAR Module (to be included in the share.war) - part of AIO - SDK 4.0 - - - 3.0.1 - - UTF-8 - - - org.alfresco - - - 5.2.f - - - community - - - 6.11 - - - 8081 - - - 1.1.6 + + org.alfresco.extension + alfresco-pdf-toolkit + 1.0-SNAPSHOT + - - 1.7 - 1.7 + + - ${alfresco.groupId} share - ${alfresco.share.version} classes - provided - - - - org.alfresco.surf - spring-surf-api - ${alfresco.surf.version} - provided - - - org.alfresco.maven.plugin - alfresco-maven-plugin - ${alfresco.sdk.version} - - - - false - false - false - - - true - - - - - - ${project.groupId} - ${project.artifactId} - ${project.version} - - - - - - - - maven-assembly-plugin - 2.6 - - - build-amp-file - package - - single - - - false - src/main/assembly/amp.xml - - - - - - org.alfresco.maven.plugin - alfresco-maven-plugin - ${alfresco.sdk.version} - - - - - - - org.zeroturnaround - jrebel-maven-plugin - ${jrebel.version} - - - generate-rebel-xml - process-resources - - generate - - - - - - - all - - - - - - - - - true - - - org.apache.maven.plugins - maven-resources-plugin - 3.0.1 - - UTF-8 - - ftl - acp - svg - pdf - doc - docx - xls - xlsx - ppt - pptx - bin - lic - swf - zip - msg - jar - ttf - eot - woff - woff2 - css - ico - psd - js - - + maven-assembly-plugin - - - - - src/main/resources - true - - - - - - src/test/resources - true - - - - - - alfresco-public - https://artifacts.alfresco.com/nexus/content/groups/public - - - alfresco-public-snapshots - https://artifacts.alfresco.com/nexus/content/groups/public-snapshots - - true - daily - - - - - alfresco-private-repository - https://artifacts.alfresco.com/nexus/content/groups/private - - - - - alfresco-plugin-public - https://artifacts.alfresco.com/nexus/content/groups/public - - - alfresco-plugin-public-snapshots - https://artifacts.alfresco.com/nexus/content/groups/public-snapshots - - true - daily - - - - - \ No newline at end of file + diff --git a/pdf-toolkit-share/src/main/assembly/amp.xml b/pdf-toolkit-share/src/main/assembly/amp.xml index 9f17de8..9917d7b 100644 --- a/pdf-toolkit-share/src/main/assembly/amp.xml +++ b/pdf-toolkit-share/src/main/assembly/amp.xml @@ -1,7 +1,7 @@ + xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd"> + + src/main/resources/alfresco/module/${project.artifactId}/log4j.properties + false + diff --git a/pdf-toolkit-share/src/main/assembly/web/README.md b/pdf-toolkit-share/src/main/assembly/web/README.md index 44f7597..0901911 100644 --- a/pdf-toolkit-share/src/main/assembly/web/README.md +++ b/pdf-toolkit-share/src/main/assembly/web/README.md @@ -10,7 +10,7 @@ any existing web resources in the Share.WAR. ` ${project.groupId} - some-share-jar + some-share ${project.version} amp diff --git a/pdf-toolkit-share/src/main/resources/META-INF/share-config-custom.xml b/pdf-toolkit-share/src/main/resources/META-INF/share-config-custom.xml index 7d3887a..f136221 100644 --- a/pdf-toolkit-share/src/main/resources/META-INF/share-config-custom.xml +++ b/pdf-toolkit-share/src/main/resources/META-INF/share-config-custom.xml @@ -1,6 +1,426 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
cm:content +
+
cm:folder
+ + +
acme:document +
+
+
+
+ + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 255 + + + + + + + + true + + + + + + + + + + + + + + + + + + + + true + aspect=cm:taggable + /api/tag/workspace/SpacesStore + tag + + + + + true + + + + + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + + + + + 255 + + + + + + + + true + + + + + true + aspect=cm:taggable + /api/tag/workspace/SpacesStore + tag + + + + + true + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + 255 + + + + + + + + explorer + true + + + + + + + + + + +
+
+
+ + + + +
+ + + + + + + + + + + + + + + + 255 + + + + + + + + explorer + + + + + mimeType + + + + + editInline + + - + + + + + + + +
+ + +
+
+ + + + + + @@ -468,4 +888,5 @@ +
\ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..6a46755 --- /dev/null +++ b/pom.xml @@ -0,0 +1,455 @@ + + + 4.0.0 + org.alfresco.extension + alfresco-pdf-toolkit + 1.0-SNAPSHOT + AIO - SDK 4.0 + All-In-One (AIO) project for SDK 4.0 + pom + + + 3.3.0 + + + + + 4.1.0 + + UTF-8 + + + org.alfresco + acs-packaging + 6.2.0 + 6.2.0 + + + alfresco/alfresco-content-repository + alfresco/alfresco-share + + + 1.1.8 + + + 8180 + 9898 + pdf-toolkit-acs + 8080 + 8888 + 5555 + + + + + + + + + + junit + junit + test + + + org.mockito + mockito-all + 1.9.5 + test + + + org.apache.httpcomponents + httpclient + test + + + + + ${alfresco.groupId} + alfresco-remote-api + provided + + + + + org.alfresco.maven + alfresco-rad + ${alfresco.sdk.version} + test + + + + + + + + ${alfresco.groupId} + ${alfresco.bomDependencyArtifactId} + ${alfresco.platform.version} + pom + import + + + + ${alfresco.groupId} + share + ${alfresco.share.version} + war + provided + + + ${alfresco.groupId} + share + ${alfresco.share.version} + classes + provided + + + ${alfresco.groupId} + alfresco-web-framework-commons + ${alfresco.share.version} + classes + provided + + + + + + + + + + + + + + org.apache.maven.plugins + maven-resources-plugin + 3.1.0 + + UTF-8 + + ftl + acp + svg + pdf + doc + docx + xls + xlsx + ppt + pptx + bin + lic + swf + zip + msg + jar + ttf + eot + woff + woff2 + css + ico + psd + js + + + + + + org.zeroturnaround + jrebel-maven-plugin + ${jrebel.version} + + + + org.apache.maven.plugins + maven-jar-plugin + 3.1.0 + + + + org.apache.maven.plugins + maven-failsafe-plugin + 3.0.0-M1 + + + + verify-test + verify + + verify + + + + + + org.apache.maven.surefire + surefire-junit47 + 3.0.0-M1 + + + + + + org.apache.maven.plugins + maven-dependency-plugin + 3.1.1 + + + + + + + + src/main/resources + true + + + + + + + org.apache.maven.plugins + maven-resources-plugin + false + + + + copy-and-filter-docker-resources + validate + + copy-resources + + + ${project.build.outputDirectory}/docker + + + docker + true + + + + + + + + + + net.alchim31.maven + yuicompressor-maven-plugin + 1.5.1 + + + + compress-assembly + + compress + + + ${project.basedir}/src/main/assembly/web + ${project.basedir}/src/main/assembly/web + + **/webscripts/** + **/site-webscripts/** + **/META-INF/** + **/*.lib.js + **/*.css + **/*-min.js + **/*-min.css + + true + false + + + + + compress-resources + + compress + + + + **/webscripts/** + **/site-webscripts/** + **/*.lib.js + **/*.css + **/*-min.js + **/*-min.css + + true + false + + + + + + + + org.zeroturnaround + jrebel-maven-plugin + + + generate-rebel-xml + process-resources + + generate + + + + + + + all + + + ${project.build.outputDirectory} + ${project.build.testOutputDirectory} + + + + + + true + + + + + + + + java8 + + [1.8,11.0) + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.0 + + 1.8 + 1.8 + + + + + + + java11 + + [11.0,) + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.0 + + 11 + + + + + + + + + + + alfresco-public + https://artifacts.alfresco.com/nexus/content/groups/public + + + alfresco-public-snapshots + https://artifacts.alfresco.com/nexus/content/groups/public-snapshots + + true + daily + + + + + alfresco-private-repository + https://artifacts.alfresco.com/nexus/content/groups/private + + + + + + alfresco-plugin-public + https://artifacts.alfresco.com/nexus/content/groups/public + + + alfresco-plugin-public-snapshots + https://artifacts.alfresco.com/nexus/content/groups/public-snapshots + + true + daily + + + + + pdf-toolkit-platform + pdf-toolkit-share + pdf-toolkit-integration-tests + pdf-toolkit-platform-docker + pdf-toolkit-share-docker + + From 9a9002ece13a55e2bc8cdbeb8808ae76e8519e84 Mon Sep 17 00:00:00 2001 From: Asirika Date: Mon, 17 Feb 2020 09:23:02 +1100 Subject: [PATCH 2/4] pdf -toolkit 6.2 upgrade pdf -toolkit 6.2 upgrade --- docker/docker-compose.yml | 59 + pdf-toolkit-integration-tests/pom.xml | 76 + pdf-toolkit-platform-docker/pom.xml | 130 + .../src/main/docker/Dockerfile | 22 + .../main/docker/alfresco-global.properties | 84 + .../src/main/docker/dev-log4j.properties | 267 ++ .../disable-webscript-caching-context.xml | 63 + .../src/main/docker/hotswap-agent.properties | 8 +- .../src/main/docker/license/README.md | 6 + pdf-toolkit-platform/pom.xml | 43 + .../src/main/assembly/amp.xml | 66 + .../src/main/assembly/file-mapping.properties | 27 + .../src/main/assembly/web/README.md | 22 + .../constants/PDFToolkitConstants.java | 91 + .../pdftoolkit/constraints/MapConstraint.java | 58 + .../pdftoolkit/form/PDFActionFormFilter.java | 102 + .../pdftoolkit/model/PDFToolkitModel.java | 22 + .../executer/BasePDFActionExecuter.java | 73 + .../executer/BasePDFStampActionExecuter.java | 62 + .../executer/PDFAppendActionExecuter.java | 78 + .../executer/PDFDecryptionActionExecuter.java | 40 + .../executer/PDFDeletePageActionExecuter.java | 45 + .../executer/PDFEncryptionActionExecuter.java | 99 + .../PDFExtractPageActionExecuter.java | 45 + .../PDFInsertAtPageActionExecuter.java | 78 + .../executer/PDFRotateActionExecuter.java | 46 + .../executer/PDFSignatureActionExecuter.java | 106 + .../executer/PDFSplitActionExecuter.java | 76 + .../PDFSplitAtPageActionExecuter.java | 75 + .../executer/PDFWatermarkActionExecuter.java | 106 + .../pdftoolkit/service/PDFToolkitService.java | 116 + .../service/PDFToolkitServiceImpl.java | 2142 +++++++++++++++++ .../ITextTransformerTIFFToPDF.java | 83 + .../ITextTransformerTextToPDF.java | 167 ++ .../pdftoolkit/webscripts/GetPageCount.java | 53 + .../resources/META-INF/resources/test.html | 1 + .../handlers/pdfappend-messages.properties | 8 + .../handlers/pdfdelete-messages.properties | 7 + .../pdfencryption-messages.properties | 17 + .../handlers/pdfinsert-messages.properties | 9 + .../handlers/pdfsignature-messages.properties | 18 + .../handlers/pdfsplit-messages.properties | 7 + .../pdfsplitatpage-messages.properties | 7 + .../handlers/pdfwatermark-messages.properties | 15 + .../pdftoolkit/pagecount.get.desc.xml | 7 + .../pdftoolkit/pagecount.get.json.ftl | 3 + .../pdftoolkit/pageschemes.get.desc.xml | 7 + .../pdftoolkit/pageschemes.get.json.ftl | 7 + .../pageschemes.get_pt_BR.properties | 3 + .../alfresco-global.properties | 5 + .../context/actions-context.xml | 123 + .../context/alfresco-pdf-toolkit-context.xml | 133 + .../context/bootstrap-context.xml | 41 + .../context/custom-form-services-context.xml | 48 + .../context/pdftoolkit-config.properties | 8 + .../context/service-context.xml | 64 + .../context/webscript-context.xml | 26 + .../pdf-toolkit-platform/log4j.properties | 1 + .../messages/content-model.properties | 6 + .../messages/pdf-toolkit.properties | 192 ++ .../messages/pdf-toolkit_de.properties | 192 ++ .../messages/pdf-toolkit_en.properties | 192 ++ .../messages/pdf-toolkit_pt_BR.properties | 214 ++ .../messages/workflow-messages.properties | 5 + .../model/pdftoolkitModel.xml | 61 + .../pdf-toolkit-platform/module-context.xml | 52 + .../pdf-toolkit-platform/module.properties | 48 + pdf-toolkit-share-docker/pom.xml | 73 + .../src/main/docker/Dockerfile | 16 + .../src/main/docker/hotswap-agent.properties | 49 + .../src/main/docker}/log4j.properties | 2 + .../src/main/docker/share-config-custom.xml | 105 + pdf-toolkit-share/README.md | 33 - pdf-toolkit-share/debug.bat | 10 - pdf-toolkit-share/debug.sh | 4 - pdf-toolkit-share/run.bat | 9 - pdf-toolkit-share/run.sh | 4 - .../doclib/rule-config-action-custom.js | 74 + .../js/tutorials/widgets/TemplateWidget.js | 20 + .../tutorials/widgets/css/TemplateWidget.css | 6 + .../widgets/i18n/TemplateWidget.properties | 3 + .../widgets/templates/TemplateWidget.html | 1 + .../module/pdf-toolkit-share/log4j.properties | 1 + .../messages/pdf-toolkit-share.properties | 25 + ...t-share-slingshot-application-context.xml} | 27 +- .../pdf-toolkit-share-example-widgets.xml | 20 + .../example/pages/simple-page.get.desc.xml | 6 + .../example/pages/simple-page.get.html.ftl | 1 + .../com/example/pages/simple-page.get.js | 29 + .../site-webscripts/org/alfresco/README.md | 6 + .../config/rule-config-action.get.config.xml | 100 + .../config/rule-config-action.get.properties | 1 + .../rules/rule-details.get.html.ftl | 57 + .../components/rules/rule-edit.get.html.ftl | 141 ++ run.bat | 127 + run.sh | 122 + 96 files changed, 7168 insertions(+), 67 deletions(-) create mode 100644 docker/docker-compose.yml create mode 100644 pdf-toolkit-integration-tests/pom.xml create mode 100644 pdf-toolkit-platform-docker/pom.xml create mode 100644 pdf-toolkit-platform-docker/src/main/docker/Dockerfile create mode 100644 pdf-toolkit-platform-docker/src/main/docker/alfresco-global.properties create mode 100644 pdf-toolkit-platform-docker/src/main/docker/dev-log4j.properties create mode 100644 pdf-toolkit-platform-docker/src/main/docker/disable-webscript-caching-context.xml rename pdf-toolkit-share/src/test/resources/share-hotswap-agent.properties => pdf-toolkit-platform-docker/src/main/docker/hotswap-agent.properties (89%) create mode 100644 pdf-toolkit-platform-docker/src/main/docker/license/README.md create mode 100644 pdf-toolkit-platform/pom.xml create mode 100644 pdf-toolkit-platform/src/main/assembly/amp.xml create mode 100644 pdf-toolkit-platform/src/main/assembly/file-mapping.properties create mode 100644 pdf-toolkit-platform/src/main/assembly/web/README.md create mode 100644 pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/constants/PDFToolkitConstants.java create mode 100644 pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/constraints/MapConstraint.java create mode 100644 pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/form/PDFActionFormFilter.java create mode 100644 pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/model/PDFToolkitModel.java create mode 100644 pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/repo/action/executer/BasePDFActionExecuter.java create mode 100644 pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/repo/action/executer/BasePDFStampActionExecuter.java create mode 100644 pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/repo/action/executer/PDFAppendActionExecuter.java create mode 100644 pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/repo/action/executer/PDFDecryptionActionExecuter.java create mode 100644 pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/repo/action/executer/PDFDeletePageActionExecuter.java create mode 100644 pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/repo/action/executer/PDFEncryptionActionExecuter.java create mode 100644 pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/repo/action/executer/PDFExtractPageActionExecuter.java create mode 100644 pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/repo/action/executer/PDFInsertAtPageActionExecuter.java create mode 100644 pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/repo/action/executer/PDFRotateActionExecuter.java create mode 100644 pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/repo/action/executer/PDFSignatureActionExecuter.java create mode 100644 pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/repo/action/executer/PDFSplitActionExecuter.java create mode 100644 pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/repo/action/executer/PDFSplitAtPageActionExecuter.java create mode 100644 pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/repo/action/executer/PDFWatermarkActionExecuter.java create mode 100644 pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/service/PDFToolkitService.java create mode 100644 pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/service/PDFToolkitServiceImpl.java create mode 100644 pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/transformer/ITextTransformerTIFFToPDF.java create mode 100644 pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/transformer/ITextTransformerTextToPDF.java create mode 100644 pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/webscripts/GetPageCount.java create mode 100644 pdf-toolkit-platform/src/main/resources/META-INF/resources/test.html create mode 100644 pdf-toolkit-platform/src/main/resources/alfresco/extension/pdftoolkit/web/bean/actions/handlers/pdfappend-messages.properties create mode 100644 pdf-toolkit-platform/src/main/resources/alfresco/extension/pdftoolkit/web/bean/actions/handlers/pdfdelete-messages.properties create mode 100644 pdf-toolkit-platform/src/main/resources/alfresco/extension/pdftoolkit/web/bean/actions/handlers/pdfencryption-messages.properties create mode 100644 pdf-toolkit-platform/src/main/resources/alfresco/extension/pdftoolkit/web/bean/actions/handlers/pdfinsert-messages.properties create mode 100644 pdf-toolkit-platform/src/main/resources/alfresco/extension/pdftoolkit/web/bean/actions/handlers/pdfsignature-messages.properties create mode 100644 pdf-toolkit-platform/src/main/resources/alfresco/extension/pdftoolkit/web/bean/actions/handlers/pdfsplit-messages.properties create mode 100644 pdf-toolkit-platform/src/main/resources/alfresco/extension/pdftoolkit/web/bean/actions/handlers/pdfsplitatpage-messages.properties create mode 100644 pdf-toolkit-platform/src/main/resources/alfresco/extension/pdftoolkit/web/bean/actions/handlers/pdfwatermark-messages.properties create mode 100644 pdf-toolkit-platform/src/main/resources/alfresco/extension/templates/webscripts/org/alfresco/extension/pdftoolkit/pagecount.get.desc.xml create mode 100644 pdf-toolkit-platform/src/main/resources/alfresco/extension/templates/webscripts/org/alfresco/extension/pdftoolkit/pagecount.get.json.ftl create mode 100644 pdf-toolkit-platform/src/main/resources/alfresco/extension/templates/webscripts/org/alfresco/extension/pdftoolkit/pageschemes.get.desc.xml create mode 100644 pdf-toolkit-platform/src/main/resources/alfresco/extension/templates/webscripts/org/alfresco/extension/pdftoolkit/pageschemes.get.json.ftl create mode 100644 pdf-toolkit-platform/src/main/resources/alfresco/extension/templates/webscripts/org/alfresco/extension/pdftoolkit/pageschemes.get_pt_BR.properties create mode 100644 pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/alfresco-global.properties create mode 100644 pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/context/actions-context.xml create mode 100644 pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/context/alfresco-pdf-toolkit-context.xml create mode 100644 pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/context/bootstrap-context.xml create mode 100644 pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/context/custom-form-services-context.xml create mode 100644 pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/context/pdftoolkit-config.properties create mode 100644 pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/context/service-context.xml create mode 100644 pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/context/webscript-context.xml create mode 100644 pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/log4j.properties create mode 100644 pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/messages/content-model.properties create mode 100644 pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/messages/pdf-toolkit.properties create mode 100644 pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/messages/pdf-toolkit_de.properties create mode 100644 pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/messages/pdf-toolkit_en.properties create mode 100644 pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/messages/pdf-toolkit_pt_BR.properties create mode 100644 pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/messages/workflow-messages.properties create mode 100644 pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/model/pdftoolkitModel.xml create mode 100644 pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/module-context.xml create mode 100644 pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/module.properties create mode 100644 pdf-toolkit-share-docker/pom.xml create mode 100644 pdf-toolkit-share-docker/src/main/docker/Dockerfile create mode 100644 pdf-toolkit-share-docker/src/main/docker/hotswap-agent.properties rename {pdf-toolkit-share/src/test/resources/share => pdf-toolkit-share-docker/src/main/docker}/log4j.properties (97%) create mode 100644 pdf-toolkit-share-docker/src/main/docker/share-config-custom.xml delete mode 100644 pdf-toolkit-share/README.md delete mode 100644 pdf-toolkit-share/debug.bat delete mode 100644 pdf-toolkit-share/debug.sh delete mode 100644 pdf-toolkit-share/run.bat delete mode 100755 pdf-toolkit-share/run.sh create mode 100644 pdf-toolkit-share/src/main/resources/META-INF/pdftoolkit/components/doclib/rule-config-action-custom.js create mode 100644 pdf-toolkit-share/src/main/resources/META-INF/resources/pdf-toolkit-share/js/tutorials/widgets/TemplateWidget.js create mode 100644 pdf-toolkit-share/src/main/resources/META-INF/resources/pdf-toolkit-share/js/tutorials/widgets/css/TemplateWidget.css create mode 100644 pdf-toolkit-share/src/main/resources/META-INF/resources/pdf-toolkit-share/js/tutorials/widgets/i18n/TemplateWidget.properties create mode 100644 pdf-toolkit-share/src/main/resources/META-INF/resources/pdf-toolkit-share/js/tutorials/widgets/templates/TemplateWidget.html create mode 100644 pdf-toolkit-share/src/main/resources/alfresco/module/pdf-toolkit-share/log4j.properties create mode 100644 pdf-toolkit-share/src/main/resources/alfresco/web-extension/messages/pdf-toolkit-share.properties rename pdf-toolkit-share/src/main/resources/alfresco/web-extension/{pdftoolkit-context.xml => pdf-toolkit-share-slingshot-application-context.xml} (51%) create mode 100644 pdf-toolkit-share/src/main/resources/alfresco/web-extension/site-data/extensions/pdf-toolkit-share-example-widgets.xml create mode 100644 pdf-toolkit-share/src/main/resources/alfresco/web-extension/site-webscripts/com/example/pages/simple-page.get.desc.xml create mode 100644 pdf-toolkit-share/src/main/resources/alfresco/web-extension/site-webscripts/com/example/pages/simple-page.get.html.ftl create mode 100644 pdf-toolkit-share/src/main/resources/alfresco/web-extension/site-webscripts/com/example/pages/simple-page.get.js create mode 100644 pdf-toolkit-share/src/main/resources/alfresco/web-extension/site-webscripts/org/alfresco/README.md create mode 100644 pdf-toolkit-share/src/main/resources/alfresco/web-extension/site-webscripts/org/alfresco/components/rules/config/rule-config-action.get.config.xml create mode 100644 pdf-toolkit-share/src/main/resources/alfresco/web-extension/site-webscripts/org/alfresco/components/rules/config/rule-config-action.get.properties create mode 100644 pdf-toolkit-share/src/main/resources/alfresco/web-extension/site-webscripts/org/alfresco/components/rules/rule-details.get.html.ftl create mode 100644 pdf-toolkit-share/src/main/resources/alfresco/web-extension/site-webscripts/org/alfresco/components/rules/rule-edit.get.html.ftl create mode 100644 run.bat create mode 100755 run.sh diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml new file mode 100644 index 0000000..514a818 --- /dev/null +++ b/docker/docker-compose.yml @@ -0,0 +1,59 @@ +version: '3.4' +services: + pdf-toolkit-share: + image: alfresco-share-pdf-toolkit:development + build: + dockerfile: ./Dockerfile + context: ../../../pdf-toolkit-share-docker/target + environment: + CATALINA_OPTS: "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=0.0.0.0:8888" + REPO_HOST: pdf-toolkit-acs + REPO_PORT: 8080 + ports: + - "${share.port}:8080" + - "${share.debug.port}:8888" + pdf-toolkit-acs: + image: alfresco-content-services-pdf-toolkit:development + build: + dockerfile: ./Dockerfile + context: ../../../pdf-toolkit-platform-docker/target + environment: + CATALINA_OPTS: "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=0.0.0.0:8888" + ports: + - "${acs.port}:8080" + - "${acs.debug.port}:8888" + volumes: + - pdf-toolkit-acs-volume:/usr/local/tomcat/alf_data + depends_on: + - pdf-toolkit-postgres + pdf-toolkit-postgres: + image: postgres:9.6 + environment: + POSTGRES_DB: alfresco + POSTGRES_USER: alfresco + POSTGRES_PASSWORD: alfresco + command: postgres -c max_connections=300 -c log_min_messages=LOG + ports: + - "${postgres.port}:5432" + volumes: + - pdf-toolkit-db-volume:/var/lib/postgresql/data + pdf-toolkit-ass: + image: alfresco/alfresco-search-services:1.2.0 + environment: + SOLR_ALFRESCO_HOST: pdf-toolkit-acs + SOLR_ALFRESCO_PORT: 8080 + SOLR_SOLR_HOST: pdf-toolkit-ass + SOLR_SOLR_PORT: 8983 + SOLR_CREATE_ALFRESCO_DEFAULTS: alfresco,archive + ports: + - "8983:8983" + volumes: + - pdf-toolkit-ass-volume:/opt/alfresco-search-services/contentstore + - pdf-toolkit-ass-volume:/opt/alfresco-search-services/data +volumes: + pdf-toolkit-acs-volume: + external: true + pdf-toolkit-db-volume: + external: true + pdf-toolkit-ass-volume: + external: true \ No newline at end of file diff --git a/pdf-toolkit-integration-tests/pom.xml b/pdf-toolkit-integration-tests/pom.xml new file mode 100644 index 0000000..8d320ac --- /dev/null +++ b/pdf-toolkit-integration-tests/pom.xml @@ -0,0 +1,76 @@ + + + 4.0.0 + pdf-toolkit-integration-tests + Integration Tests Module + Integration Tests module for in-container integration testing - part of AIO - SDK 4.0 + jar + + + org.alfresco.extension + alfresco-pdf-toolkit + 1.0-SNAPSHOT + + + + + + + + + org.alfresco.extension + pdf-toolkit-platform + 1.0-SNAPSHOT + test + + + + + + + + src/test/resources + true + + + + + + + org.zeroturnaround + jrebel-maven-plugin + + ${project.build.testOutputDirectory} + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + test-jar + + + + + + + + org.apache.maven.plugins + maven-failsafe-plugin + + + ${test.acs.endpoint.path} + + + + + + diff --git a/pdf-toolkit-platform-docker/pom.xml b/pdf-toolkit-platform-docker/pom.xml new file mode 100644 index 0000000..fea6052 --- /dev/null +++ b/pdf-toolkit-platform-docker/pom.xml @@ -0,0 +1,130 @@ + + + 4.0.0 + pdf-toolkit-platform-docker + Alfresco Platform/Repository Docker Module + Platform/Repo Docker Module to generate the final Docker image + jar + + + org.alfresco.extension + alfresco-pdf-toolkit + 1.0-SNAPSHOT + + + + + + + + org.alfresco.extension + pdf-toolkit-platform + 1.0-SNAPSHOT + + + org.alfresco.extension + pdf-toolkit-integration-tests + 1.0-SNAPSHOT + test + tests + + + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + + collect-test-artifacts + pre-integration-test + + copy-dependencies + + + ${project.build.directory}/extensions + compile + + + + + collect-extensions + package + + copy-dependencies + + + ${project.build.directory}/extensions + runtime + + + + + + + + org.apache.maven.plugins + maven-resources-plugin + + + copy-and-filter-docker-resources + validate + + copy-resources + + + ${project.build.directory} + + + src/main/docker + true + + **/*.jar + **/*.so + **/*.gz + + + + + + + copy-and-filter-docker-resources-non-filtered + validate + + copy-resources + + + ${project.build.directory} + + + src/main/docker + false + + **/*.jar + **/*.so + **/*.gz + + + + + + + + + + diff --git a/pdf-toolkit-platform-docker/src/main/docker/Dockerfile b/pdf-toolkit-platform-docker/src/main/docker/Dockerfile new file mode 100644 index 0000000..385d77a --- /dev/null +++ b/pdf-toolkit-platform-docker/src/main/docker/Dockerfile @@ -0,0 +1,22 @@ +FROM ${docker.acs.image}:${alfresco.platform.version} + +ARG TOMCAT_DIR=/usr/local/tomcat + +USER root + +# Copy Dockerfile to avoid an error if no JARs exist +COPY Dockerfile extensions/*.jar $TOMCAT_DIR/webapps/alfresco/WEB-INF/lib/ + +# Copy Dockerfile to avoid an error if no AMPs exist +COPY Dockerfile extensions/*.amp $TOMCAT_DIR/amps/ +RUN java -jar $TOMCAT_DIR/alfresco-mmt/alfresco-mmt*.jar install \ + $TOMCAT_DIR/amps $TOMCAT_DIR/webapps/alfresco -directory -nobackup -force + +COPY alfresco-global.properties $TOMCAT_DIR/shared/classes/alfresco-global.properties +COPY dev-log4j.properties $TOMCAT_DIR/shared/classes/alfresco/extension +COPY disable-webscript-caching-context.xml $TOMCAT_DIR/shared/classes/alfresco/extension + +# Copy Dockerfile to avoid an error if no license file exists +COPY Dockerfile license/*.* $TOMCAT_DIR/webapps/alfresco/WEB-INF/classes/alfresco/extension/license/ + +USER ${USERNAME} \ No newline at end of file diff --git a/pdf-toolkit-platform-docker/src/main/docker/alfresco-global.properties b/pdf-toolkit-platform-docker/src/main/docker/alfresco-global.properties new file mode 100644 index 0000000..4e2f795 --- /dev/null +++ b/pdf-toolkit-platform-docker/src/main/docker/alfresco-global.properties @@ -0,0 +1,84 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# RUN TIME PROPERTIES +# ------------------- + +# +# Alfresco configuration for running locally with PostgreSQL Database +# +# Configuration when running Tomcat embedded from Maven. +# Property values from the POM but it can also be edited here. +# + +# Alfresco Repo Webapp (alfresco.war) context, ports etc +alfresco.context=alfresco +alfresco.host=localhost +alfresco.port=8080 +alfresco.protocol=http + +# Alfresco Share Webapp (share.war) context, ports etc +share.context=share +share.host=localhost +share.port=8180 +share.protocol=http + +# Don't try and recover any index +index.recovery.mode=NONE + +# These jobs seem to require Lucene (Unsupported Operation with Solr) so we disable them / set to future date +# See https://forums.alfresco.com/en/viewtopic.php?f=52&t=41597 +# If you want to enable them (and so full WQS functionality), please also set index.subsystem.name=lucene +wcmqs.dynamicCollectionProcessor.schedule=0 30 2 * * ? 2060 +wcmqs.feedbackProcessor.schedule=0 40 2 * * ? 2060 +wcmqs.publishQueueProcessor.schedule=0 50 2 * * ? 2060 + +# Fail or not when there are node integrity checker errors +integrity.failOnError=true + +# Alfresco Repository PostgreSQL Database configuration. +# The PostgreSQL Driver is brought in via the tomcat7-maven-plugin as a dependency. +db.driver=org.postgresql.Driver + +# This Alfresco Platform Configuration file should be used for custom properties that are introduced by this module. +# Define default values for all properties here. +# System Administrators can override these values in environment specific configurations in +# alfresco/tomcat/shared/classes/alfresco-global.properties. +# +index.subsystem.name=solr6 +solr.host=pdf-toolkit-ass +solr.port=8983 +solr.secureComms=none + +db.username=alfresco +db.password=alfresco +db.pool.initial=10 +db.pool.max=100 + +db.url=jdbc:postgresql://pdf-toolkit-postgres:5432/alfresco + +# File servers related properties +# For local runs we disable CIFS and FTP +cifs.enabled=false +ftp.enabled=false + +csrf.filter.enabled=false + +# Embedded broker without persistence +messaging.broker.url=vm://localhost?broker.persistent=false + +# Disable ATS +transform.service.enabled=false +local.transform.service.enabled=false +legacy.transform.service.enabled=false diff --git a/pdf-toolkit-platform-docker/src/main/docker/dev-log4j.properties b/pdf-toolkit-platform-docker/src/main/docker/dev-log4j.properties new file mode 100644 index 0000000..a954274 --- /dev/null +++ b/pdf-toolkit-platform-docker/src/main/docker/dev-log4j.properties @@ -0,0 +1,267 @@ +# Set root logger level to error +log4j.rootLogger=error, Console, File + + +# All outputs currently set to be a ConsoleAppender. +log4j.appender.Console=org.apache.log4j.ConsoleAppender +log4j.appender.Console.layout=org.apache.log4j.PatternLayout + +# use log4j NDC to replace %x with tenant domain / username +log4j.appender.Console.layout.ConversionPattern=%d{ISO8601} %x %-5p [%c{3}] [%t] %m%n +#log4j.appender.Console.layout.ConversionPattern=%d{ABSOLUTE} %-5p [%c] %m%n + +log4j.appender.File=org.apache.log4j.DailyRollingFileAppender +log4j.appender.File.File=alfresco.log +log4j.appender.File.Append=true +log4j.appender.File.DatePattern='.'yyyy-MM-dd +log4j.appender.File.layout=org.apache.log4j.PatternLayout +log4j.appender.File.layout.ConversionPattern=%d{yyyy-MM-dd} %d{ABSOLUTE} %-5p [%c] [%t] %m%n + +#log4j.appender.file=org.apache.log4j.FileAppender +#log4j.appender.file.File=hibernate.log +#log4j.appender.file.layout=org.apache.log4j.PatternLayout +#log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n + + +# Commented-in loggers will be exposed as JMX MBeans (refer to org.alfresco.repo.admin.Log4JHierarchyInit) +# Hence, generally useful loggers should be listed with at least ERROR level to allow simple runtime +# control of the level via a suitable JMX Console. Also, any other loggers can be added transiently via +# Log4j addLoggerMBean as long as the logger exists and has been loaded. + +# Hibernate +log4j.logger.org.hibernate=error +log4j.logger.org.hibernate.util.JDBCExceptionReporter=fatal +log4j.logger.org.hibernate.event.def.AbstractFlushingEventListener=fatal +log4j.logger.org.hibernate.type=warn +log4j.logger.org.hibernate.cfg.SettingsFactory=warn + +# Spring +log4j.logger.org.springframework=warn +# Turn off Spring remoting warnings that should really be info or debug. +log4j.logger.org.springframework.remoting.support=error +log4j.logger.org.springframework.util=error + +# Axis/WSS4J +log4j.logger.org.apache.axis=info +log4j.logger.org.apache.ws=info + +# CXF +log4j.logger.org.apache.cxf=error + +# MyFaces +log4j.logger.org.apache.myfaces.util.DebugUtils=info +log4j.logger.org.apache.myfaces.el.VariableResolverImpl=error +log4j.logger.org.apache.myfaces.application.jsp.JspViewHandlerImpl=error +log4j.logger.org.apache.myfaces.taglib=error + +# OpenOfficeConnection +log4j.logger.net.sf.jooreports.openoffice.connection=fatal + +# log prepared statement cache activity log4j.logger.org.hibernate.ps.PreparedStatementCache=info + +# Alfresco +log4j.logger.org.alfresco=error +log4j.logger.org.alfresco.repo.admin=info +log4j.logger.org.alfresco.repo.transaction=warn +log4j.logger.org.alfresco.repo.cache.TransactionalCache=warn +log4j.logger.org.alfresco.repo.model.filefolder=warn +log4j.logger.org.alfresco.repo.tenant=info +log4j.logger.org.alfresco.config=warn +log4j.logger.org.alfresco.config.JndiObjectFactoryBean=warn +log4j.logger.org.alfresco.config.JBossEnabledWebApplicationContext=warn +log4j.logger.org.alfresco.repo.management.subsystems=warn +log4j.logger.org.alfresco.repo.management.subsystems.ChildApplicationContextFactory=info +log4j.logger.org.alfresco.repo.management.subsystems.ChildApplicationContextFactory$ChildApplicationContext=warn +log4j.logger.org.alfresco.repo.security.sync=info +log4j.logger.org.alfresco.repo.security.person=info + +log4j.logger.org.alfresco.sample=info +log4j.logger.org.alfresco.web=info +#log4j.logger.org.alfresco.web.app.AlfrescoNavigationHandler=debug +#log4j.logger.org.alfresco.web.ui.repo.component.UIActions=debug +#log4j.logger.org.alfresco.web.ui.repo.tag.PageTag=debug +#log4j.logger.org.alfresco.web.bean.clipboard=debug +log4j.logger.org.alfresco.service.descriptor.DescriptorService=info +#log4j.logger.org.alfresco.web.page=debug + +log4j.logger.org.alfresco.repo.importer.ImporterBootstrap=error +#log4j.logger.org.alfresco.repo.importer.ImporterBootstrap=info + +log4j.logger.org.alfresco.repo.admin.patch.PatchExecuter=info +log4j.logger.org.alfresco.repo.domain.patch.ibatis.PatchDAOImpl=info + +# Specific patches +log4j.logger.org.alfresco.repo.admin.patch.impl.DeploymentMigrationPatch=info +log4j.logger.org.alfresco.repo.version.VersionMigrator=info + +log4j.logger.org.alfresco.repo.module.ModuleServiceImpl=info +log4j.logger.org.alfresco.repo.domain.schema.SchemaBootstrap=info +log4j.logger.org.alfresco.repo.admin.ConfigurationChecker=info +log4j.logger.org.alfresco.repo.node.index.AbstractReindexComponent=warn +log4j.logger.org.alfresco.repo.node.index.IndexTransactionTracker=warn +log4j.logger.org.alfresco.repo.node.index.FullIndexRecoveryComponent=info +log4j.logger.org.alfresco.util.OpenOfficeConnectionTester=info +log4j.logger.org.alfresco.repo.node.db.hibernate.HibernateNodeDaoServiceImpl=warn +log4j.logger.org.alfresco.repo.domain.hibernate.DirtySessionMethodInterceptor=warn +log4j.logger.org.alfresco.repo.transaction.RetryingTransactionHelper=warn +log4j.logger.org.alfresco.util.transaction.SpringAwareUserTransaction.trace=warn +log4j.logger.org.alfresco.util.AbstractTriggerBean=warn +log4j.logger.org.alfresco.enterprise.repo.cluster=info +log4j.logger.org.alfresco.repo.version.Version2ServiceImpl=warn + +#log4j.logger.org.alfresco.web.app.DebugPhaseListener=debug +log4j.logger.org.alfresco.repo.node.db.NodeStringLengthWorker=info + +log4j.logger.org.alfresco.repo.workflow=info + +# CIFS server debugging +log4j.logger.org.alfresco.smb.protocol=error +#log4j.logger.org.alfresco.smb.protocol.auth=debug +#log4j.logger.org.alfresco.acegi=debug + +# FTP server debugging +log4j.logger.org.alfresco.ftp.protocol=error +#log4j.logger.org.alfresco.ftp.server=debug + +# WebDAV debugging +#log4j.logger.org.alfresco.webdav.protocol=debug +log4j.logger.org.alfresco.webdav.protocol=info + +# NTLM servlet filters +#log4j.logger.org.alfresco.web.app.servlet.NTLMAuthenticationFilter=debug +#log4j.logger.org.alfresco.repo.webdav.auth.NTLMAuthenticationFilter=debug + +# Kerberos servlet filters +#log4j.logger.org.alfresco.web.app.servlet.KerberosAuthenticationFilter=debug +#log4j.logger.org.alfresco.repo.webdav.auth.KerberosAuthenticationFilter=debug + +# File servers +log4j.logger.org.alfresco.fileserver=warn + +# Repo filesystem debug logging +#log4j.logger.org.alfresco.filesys.repo.ContentDiskDriver=debug + +# Integrity message threshold - if 'failOnViolation' is off, then WARNINGS are generated +log4j.logger.org.alfresco.repo.node.integrity=ERROR + +# Indexer debugging +log4j.logger.org.alfresco.repo.search.Indexer=error +#log4j.logger.org.alfresco.repo.search.Indexer=debug + +log4j.logger.org.alfresco.repo.search.impl.lucene.index=error +log4j.logger.org.alfresco.repo.search.impl.lucene.fts.FullTextSearchIndexerImpl=warn +#log4j.logger.org.alfresco.repo.search.impl.lucene.index=DEBUG + +# Audit debugging +# log4j.logger.org.alfresco.repo.audit=DEBUG +# log4j.logger.org.alfresco.repo.audit.model=DEBUG + +# Property sheet and modelling debugging +# change to error to hide the warnings about missing properties and associations +log4j.logger.alfresco.missingProperties=warn + +# Dictionary/Model debugging +log4j.logger.org.alfresco.repo.dictionary=warn +log4j.logger.org.alfresco.repo.dictionary.types.period=warn + +# Virtualization Server Registry +log4j.logger.org.alfresco.mbeans.VirtServerRegistry=error + +# Spring context runtime property setter +log4j.logger.org.alfresco.util.RuntimeSystemPropertiesSetter=info + +# Debugging options for clustering +log4j.logger.org.alfresco.repo.content.ReplicatingContentStore=error +log4j.logger.org.alfresco.repo.content.replication=error + +#log4j.logger.org.alfresco.repo.deploy.DeploymentServiceImpl=debug + +# Activity service +log4j.logger.org.alfresco.repo.activities=warn + +# User usage tracking +log4j.logger.org.alfresco.repo.usage=info + +# Sharepoint +log4j.logger.org.alfresco.module.vti=info + +# Forms Engine +log4j.logger.org.alfresco.web.config.forms=info +log4j.logger.org.alfresco.web.scripts.forms=info + +# CMIS +log4j.logger.org.alfresco.opencmis=error +log4j.logger.org.alfresco.opencmis.AlfrescoCmisServiceInterceptor=error +log4j.logger.org.alfresco.cmis=error +log4j.logger.org.alfresco.cmis.dictionary=warn +log4j.logger.org.apache.chemistry.opencmis=info +log4j.logger.org.apache.chemistry.opencmis.server.impl.browser.CmisBrowserBindingServlet=OFF +log4j.logger.org.apache.chemistry.opencmis.server.impl.atompub.CmisAtomPubServlet=OFF + +# IMAP +log4j.logger.org.alfresco.repo.imap=info + +# JBPM +# Note: non-fatal errors (eg. logged during job execution) should be handled by Alfresco's retrying transaction handler +log4j.logger.org.jbpm.graph.def.GraphElement=fatal + +#log4j.logger.org.alfresco.repo.googledocs=debug + + +# Web Framework +log4j.logger.org.springframework.extensions.webscripts=info +log4j.logger.org.springframework.extensions.webscripts.ScriptLogger=warn +log4j.logger.org.springframework.extensions.webscripts.ScriptDebugger=off + +# Repository +log4j.logger.org.alfresco.repo.web.scripts=warn +log4j.logger.org.alfresco.repo.web.scripts.BaseWebScriptTest=info +log4j.logger.org.alfresco.repo.web.scripts.AlfrescoRhinoScriptDebugger=off +log4j.logger.org.alfresco.repo.jscript=error +log4j.logger.org.alfresco.repo.jscript.ScriptLogger=warn +log4j.logger.org.alfresco.repo.cmis.rest.CMISTest=info + +log4j.logger.org.alfresco.repo.domain.schema.script.ScriptBundleExecutorImpl=off +log4j.logger.org.alfresco.repo.domain.schema.script.ScriptExecutorImpl=info + +log4j.logger.org.alfresco.repo.search.impl.solr.facet.SolrFacetServiceImpl=info + +# Bulk Filesystem Import Tool +log4j.logger.org.alfresco.repo.bulkimport=warn + +# Freemarker +# Note the freemarker.runtime logger is used to log non-fatal errors that are handled by Alfresco's retrying transaction handler +log4j.logger.freemarker.runtime= + +# Metadata extraction +log4j.logger.org.alfresco.repo.content.metadata.AbstractMappingMetadataExtracter=warn + +# Reduces PDFont error level due to ALF-7105 +log4j.logger.org.apache.pdfbox.pdmodel.font.PDSimpleFont=fatal +log4j.logger.org.apache.pdfbox.pdmodel.font.PDFont=fatal +log4j.logger.org.apache.pdfbox.pdmodel.font.PDCIDFont=fatal + +# no index support +log4j.logger.org.alfresco.repo.search.impl.noindex.NoIndexIndexer=fatal +log4j.logger.org.alfresco.repo.search.impl.noindex.NoIndexSearchService=fatal + +# lucene index warnings +log4j.logger.org.alfresco.repo.search.impl.lucene.index.IndexInfo=warn + +# Warn about RMI socket bind retries. +log4j.logger.org.alfresco.util.remote.server.socket.HostConfigurableSocketFactory=warn + +log4j.logger.org.alfresco.repo.usage.RepoUsageMonitor=info + +# Authorization +log4j.logger.org.alfresco.enterprise.repo.authorization.AuthorizationService=info +log4j.logger.org.alfresco.enterprise.repo.authorization.AuthorizationsConsistencyMonitor=warn + +#----------------------------------------------------------------------- +# Platform module logging +#----------------------------------------------------------------------- +log4j.logger.org.alfresco.extension.platformsample.DemoComponent=debug +log4j.logger.org.alfresco.extension.platformsample.HelloWorldWebScript=debug + + + diff --git a/pdf-toolkit-platform-docker/src/main/docker/disable-webscript-caching-context.xml b/pdf-toolkit-platform-docker/src/main/docker/disable-webscript-caching-context.xml new file mode 100644 index 0000000..07829ea --- /dev/null +++ b/pdf-toolkit-platform-docker/src/main/docker/disable-webscript-caching-context.xml @@ -0,0 +1,63 @@ + + + + + + + + javascript + + + js + + + + false + + + + + true + + + + + + + + + + ${spaces.store} + + + ${spaces.company_home.childname} + + + + + diff --git a/pdf-toolkit-share/src/test/resources/share-hotswap-agent.properties b/pdf-toolkit-platform-docker/src/main/docker/hotswap-agent.properties similarity index 89% rename from pdf-toolkit-share/src/test/resources/share-hotswap-agent.properties rename to pdf-toolkit-platform-docker/src/main/docker/hotswap-agent.properties index 53bb263..e3288d6 100644 --- a/pdf-toolkit-share/src/test/resources/share-hotswap-agent.properties +++ b/pdf-toolkit-platform-docker/src/main/docker/hotswap-agent.properties @@ -10,8 +10,8 @@ autoHotswap=true # classes from built JAR file. # i.e. monitor /target/classes # should work with extraClasspath=${project.build.outputDirectory} -# If not try -extraClasspath=${project.build.outputDirectory};${project.build.testOutputDirectory} +# If not try +extraClasspath=/usr/local/tomcat/hotswap-agent # Comma separated list of disabled plugins # Use plugin name - e.g. @@ -23,12 +23,12 @@ disabledPlugins=Hibernate,Spring # # Load web application resources (such as HTML, JSP, CSS, ...) from this directory prior to default processing. # Use this setting to set to serve resources from source directory directly (e.g. src/main/webapp). -extraWebappContext=${project.build.outputDirectory}/META-INF/resources +extraWebappContext=/usr/local/tomcat/hotswap-agent/pdf-toolkit-platform/target/classes/META-INF/resources; # Load static web resources from different directory. # # This setting is dependent on application server plugin(Jetty, Tomcat, JBoss, ...) -webappDir=${project.build.outputDirectory}/META-INF/resources +webappDir=/usr/local/tomcat/hotswap-agent/pdf-toolkit-platform/target/classes/META-INF/resources; # Watch for changes in a directory (resources only). # diff --git a/pdf-toolkit-platform-docker/src/main/docker/license/README.md b/pdf-toolkit-platform-docker/src/main/docker/license/README.md new file mode 100644 index 0000000..996f1bd --- /dev/null +++ b/pdf-toolkit-platform-docker/src/main/docker/license/README.md @@ -0,0 +1,6 @@ +# Enterprise License location + +Put the Alfresco Enterprise license file in this directory. +It will then be copied into the ACS container in the +$TOMCAT_DIR/WEB-INF/classes/alfresco/extension/license directory. + diff --git a/pdf-toolkit-platform/pom.xml b/pdf-toolkit-platform/pom.xml new file mode 100644 index 0000000..3919cd6 --- /dev/null +++ b/pdf-toolkit-platform/pom.xml @@ -0,0 +1,43 @@ + + + 4.0.0 + pdf-toolkit-platform + Alfresco Platform/Repository JAR Module + Platform/Repo JAR Module (to be included in the alfresco.war) - part of AIO - SDK 4.0 + + jar + + + org.alfresco.extension + alfresco-pdf-toolkit + 1.0-SNAPSHOT + + + + + + + + com.itextpdf + itextpdf + 5.5.13 + + + + org.apache.pdfbox + pdfbox + 2.0.8 + provided + + + + + + + org.apache.maven.plugins + maven-assembly-plugin + + + + + diff --git a/pdf-toolkit-platform/src/main/assembly/amp.xml b/pdf-toolkit-platform/src/main/assembly/amp.xml new file mode 100644 index 0000000..097775f --- /dev/null +++ b/pdf-toolkit-platform/src/main/assembly/amp.xml @@ -0,0 +1,66 @@ + + + + + build-amp-file + + + amp + + + false + + + + + src/main/resources/alfresco/module/${project.artifactId}/module.properties + true + + + + src/main/assembly/file-mapping.properties + false + + + + src/main/resources/alfresco/module/${project.artifactId}/log4j.properties + false + + + + + + + src/main/assembly/web + web + true + + README.md + + + + + + + + lib + + + + \ No newline at end of file diff --git a/pdf-toolkit-platform/src/main/assembly/file-mapping.properties b/pdf-toolkit-platform/src/main/assembly/file-mapping.properties new file mode 100644 index 0000000..501b3d6 --- /dev/null +++ b/pdf-toolkit-platform/src/main/assembly/file-mapping.properties @@ -0,0 +1,27 @@ +# Custom AMP to WAR location mappings + +# +# The following property can be used to include the standard set of mappings. +# The contents of this file will override any defaults. The default is +# 'true', i.e. the default mappings will be augmented or modified by values in +# this file. +# +# Default mappings are: +# +# /config=/WEB-INF/classes +# /lib=/WEB-INF/lib +# /licenses=/WEB-INF/licenses +# /web/jsp=/jsp +# /web/css=/css +# /web/images=/images +# /web/scripts=/scripts +# /web/php=/php +# +include.default=true + +# +# Custom mappings. If 'include.default' is false, then this is the complete set. +# Map /web to / in AMP so we can override things like favicon.ico +# +/web=/ + diff --git a/pdf-toolkit-platform/src/main/assembly/web/README.md b/pdf-toolkit-platform/src/main/assembly/web/README.md new file mode 100644 index 0000000..e3b1a7c --- /dev/null +++ b/pdf-toolkit-platform/src/main/assembly/web/README.md @@ -0,0 +1,22 @@ +# Web resources that should override out-of-the-box files + +Put here any web resources that should override out-of-the-box +web resources, such as favicon.ico. They will then end up in the +*/web* directory in the AMP, and applied to the WAR, and override +any existing web resources in the Alfresco.WAR. + +**Note**. Module dependency needs to be set to amp for the web resources to be applied by MMT: + +` + + ${project.groupId} + some-platform + ${project.version} + amp + +` + +**Important**. New web resources should not be located here, but instead + in the usual place in the *src/main/resources/META-INF/resources* directory. + + diff --git a/pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/constants/PDFToolkitConstants.java b/pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/constants/PDFToolkitConstants.java new file mode 100644 index 0000000..32c9fd4 --- /dev/null +++ b/pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/constants/PDFToolkitConstants.java @@ -0,0 +1,91 @@ +package org.alfresco.extension.pdftoolkit.constants; + +import com.itextpdf.text.pdf.BaseFont; + +public abstract class PDFToolkitConstants +{ + public static final String PARAM_INPLACE = "inplace"; + public static final String PARAM_DESTINATION_FOLDER = "destination-folder"; + public static final String PARAM_DESTINATION_NAME = "destination-name"; + public static final String PARAM_CREATE_NEW = "create-new"; + public static final String PARAM_POSITION = "position"; + public static final String PARAM_LOCATION_X = "location-x"; + public static final String PARAM_LOCATION_Y = "location-y"; + public static final String PARAM_PAGE = "page"; + + public static final String PARAM_TARGET_NODE = "target-node"; + + public static final String PARAM_USER_PASSWORD = "user-password"; + public static final String PARAM_OWNER_PASSWORD = "owner-password"; + public static final String PARAM_ALLOW_PRINT = "allow-print"; + public static final String PARAM_ALLOW_COPY = "allow-copy"; + public static final String PARAM_ALLOW_CONTENT_MODIFICATION = "allow-content-modification"; + public static final String PARAM_ALLOW_ANNOTATION_MODIFICATION = "allow-annotation-modification"; + public static final String PARAM_ALLOW_FORM_FILL = "allow-form-fill"; + public static final String PARAM_ALLOW_SCREEN_READER = "allow-screen-reader"; + public static final String PARAM_ALLOW_DEGRADED_PRINT = "allow-degraded-print"; + public static final String PARAM_ALLOW_ASSEMBLY = "allow-assembly"; + public static final String PARAM_ENCRYPTION_LEVEL = "encryption-level"; + public static final String PARAM_EXCLUDE_METADATA = "exclude-metadata"; + public static final String PARAM_OPTIONS_LEVEL = "level-options"; + + public static final String PARAM_INSERT_CONTENT = "insert-content"; + + public static final String PARAM_DEGREES = "degrees"; + + public static final String PARAM_PRIVATE_KEY = "private-key"; + public static final String PARAM_VISIBILITY = "visibility"; + public static final String PARAM_LOCATION = "location"; + public static final String PARAM_REASON = "reason"; + public static final String PARAM_KEY_PASSWORD = "key-password"; + public static final String PARAM_WIDTH = "width"; + public static final String PARAM_HEIGHT = "height"; + public static final String PARAM_KEY_TYPE = "key-type"; + public static final String PARAM_ALIAS = "alias"; + public static final String PARAM_STORE_PASSWORD = "store-password"; + public static final String PARAM_NEW_REVISION = "new-revision"; + + public static final String PARAM_SPLIT_FREQUENCY = "split-frequency"; + + public static final String PARAM_WATERMARK_IMAGE = "watermark-image"; + public static final String PARAM_WATERMARK_DEPTH = "watermark-depth"; + public static final String PARAM_WATERMARK_TYPE = "watermark-type"; + public static final String PARAM_WATERMARK_TEXT = "watermark-text"; + public static final String PARAM_WATERMARK_FONT = "watermark-font"; + public static final String PARAM_WATERMARK_SIZE = "watermark-size"; + + public static final String VISIBILITY_HIDDEN = "hidden"; + public static final String VISIBILITY_VISIBLE = "visible"; + + public static final String KEY_TYPE_PKCS12 = "pkcs12"; + public static final String KEY_TYPE_DEFAULT = "default"; + + public static final String DEPTH_UNDER = "under"; + public static final String DEPTH_OVER = "over"; + + public static final String TYPE_IMAGE = "image"; + public static final String TYPE_TEXT = "text"; + + public static final String FONT_OPTION_HELVETICA = BaseFont.HELVETICA; + public static final String FONT_OPTION_COURIER = BaseFont.COURIER; + public static final String FONT_OPTION_TIMES_ROMAN = BaseFont.TIMES_ROMAN; + + public static final float PAD = 15; + + public static final String PAGE_ALL = "all"; + public static final String PAGE_ODD = "odd"; + public static final String PAGE_EVEN = "even"; + public static final String PAGE_FIRST = "first"; + public static final String PAGE_LAST = "last"; + + public static final String POSITION_CENTER = "center"; + public static final String POSITION_TOPLEFT = "topleft"; + public static final String POSITION_TOPRIGHT = "topright"; + public static final String POSITION_BOTTOMLEFT = "bottomleft"; + public static final String POSITION_BOTTOMRIGHT = "bottomright"; + public static final String POSITION_MANUAL = "manual"; + + public static final String FILE_EXTENSION = ".pdf"; + public static final String FILE_MIMETYPE = "application/pdf"; + public static final String PDF = "pdf"; +} diff --git a/pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/constraints/MapConstraint.java b/pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/constraints/MapConstraint.java new file mode 100644 index 0000000..13f4d99 --- /dev/null +++ b/pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/constraints/MapConstraint.java @@ -0,0 +1,58 @@ +/* + * Copyright 2008-2012 Alfresco Software Limited. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + * + * This file is part of an unsupported extension to Alfresco. + */ + +package org.alfresco.extension.pdftoolkit.constraints; + + +import java.util.HashMap; +import java.util.Map; + +import org.alfresco.repo.action.constraint.BaseParameterConstraint; + + +public class MapConstraint + extends BaseParameterConstraint +{ + + // public static final String NAME = "pdfc-visibility"; + private HashMap cm = new HashMap(); + + + public MapConstraint() + { + } + + + public void setConstraintMap(Map m) + { + cm.putAll(m); + } + + + public Map getAllowableValues() + { + return cm; + } + + + @Override + protected Map getAllowableValuesImpl() + { + return cm; + } +} diff --git a/pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/form/PDFActionFormFilter.java b/pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/form/PDFActionFormFilter.java new file mode 100644 index 0000000..94c845c --- /dev/null +++ b/pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/form/PDFActionFormFilter.java @@ -0,0 +1,102 @@ +package org.alfresco.extension.pdftoolkit.form; + +import java.util.List; +import java.util.Map; + +import org.alfresco.extension.pdftoolkit.constants.PDFToolkitConstants; +import org.alfresco.extension.pdftoolkit.repo.action.executer.PDFWatermarkActionExecuter; +import org.alfresco.repo.action.ActionDefinitionImpl; +import org.alfresco.repo.forms.Form; +import org.alfresco.repo.forms.FormData; +import org.alfresco.repo.forms.FormData.FieldData; +import org.alfresco.repo.forms.processor.AbstractFilter; +import org.alfresco.repo.forms.processor.action.ActionFormResult; +import org.alfresco.repo.model.Repository; +import org.alfresco.service.ServiceRegistry; +import org.alfresco.service.cmr.repository.NodeService; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +public class PDFActionFormFilter extends AbstractFilter { + + private static Log logger = LogFactory.getLog(PDFActionFormFilter.class); + private String WATERMARK_IMAGE_FIELD = "assoc_watermark-image_added"; + private String DESTINATION_FOLDER_FIELD = "assoc_destination-folder_added"; + private String INPLACE_PARAM = "prop_" + PDFToolkitConstants.PARAM_INPLACE; + + private ServiceRegistry serviceRegistry; + private Repository repositoryHelper; + + @Override + public void afterGenerate(Object obj, List fields, + List forcedFields, Form form, Map context) { + logger.debug("afterGenerate"); + //NTM - nothing to do here at the moment + } + + @Override + public void afterPersist(Object obj, FormData formData, ActionFormResult result) { + logger.debug("afterPersist"); + //NTM - nothing to do here at the moment. + } + + @Override + public void beforeGenerate(Object obj, List fields, + List forcedFields, Form form, Map context) { + logger.debug("beforeGenerate"); + //NTM - nothing to do here at the moment + } + + @Override + public void beforePersist(Object obj, FormData formData) { + logger.debug("beforePersist"); + + //check the action, is it one we need to handle? + if(obj != null) + { + /* + * For all pdf-toolkit actions, check for the "in place" parameter. If it is + * set to true, rewrite the destination folder field value so Alfresco will + * let the form action pass. + */ + FieldData inplace = formData.getFieldData(INPLACE_PARAM); + if(inplace != null && Boolean.valueOf(String.valueOf(inplace.getValue()))) + { + formData.addFieldData(DESTINATION_FOLDER_FIELD, repositoryHelper.getCompanyHome(), true); + } + + ActionDefinitionImpl act = (ActionDefinitionImpl)obj; + if(act.getName().equals(PDFWatermarkActionExecuter.NAME)) + { + /* + * fix form data to prevent formProcessor complaining about + * invalid nodeRef (watermark action). Even if the watermark-image + * action param is optional, Alfresco barks if the field value + * is not a syntactically valid noderef. + */ + FieldData data = formData.getFieldData(WATERMARK_IMAGE_FIELD); + if(data.getValue() == null || data.getValue().toString().equals("")) + { + /* + * set the field value = to the destination folder. This value isn't + * actually used, it is just required to get the form validated. Is this an + * Alfresco bug? Should non-mandatory fields require a valid NodeRef? + */ + FieldData dest = formData.getFieldData(DESTINATION_FOLDER_FIELD); + formData.addFieldData(WATERMARK_IMAGE_FIELD, dest.getValue(), true); + } + } + } + logger.debug("exit beforePersist"); + } + + public void setServiceRegistry(ServiceRegistry serviceRegistry) + { + this.serviceRegistry = serviceRegistry; + } + + public void setRepositoryHelper(Repository repositoryHelper) + { + this.repositoryHelper = repositoryHelper; + } +} diff --git a/pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/model/PDFToolkitModel.java b/pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/model/PDFToolkitModel.java new file mode 100644 index 0000000..93a6512 --- /dev/null +++ b/pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/model/PDFToolkitModel.java @@ -0,0 +1,22 @@ +package org.alfresco.extension.pdftoolkit.model; + +import org.alfresco.service.namespace.QName; + +public interface PDFToolkitModel +{ + //namespace + static final String PDFTOOLKIT_MODEL_1_0_URI = "http://www.alfresco.com/model/pdftoolkit/1.0"; + + //signed aspect and properties + static final QName ASPECT_SIGNED = QName.createQName(PDFTOOLKIT_MODEL_1_0_URI, "signed"); + static final QName PROP_SIGNATUREDATE = QName.createQName(PDFTOOLKIT_MODEL_1_0_URI, "signaturedate"); + static final QName PROP_REASON = QName.createQName(PDFTOOLKIT_MODEL_1_0_URI, "reason"); + static final QName PROP_LOCATION = QName.createQName(PDFTOOLKIT_MODEL_1_0_URI, "location"); + static final QName PROP_SIGNEDBY = QName.createQName(PDFTOOLKIT_MODEL_1_0_URI, "signedby"); + + //encrypted aspect and properties + static final QName ASPECT_ENCRYPTED = QName.createQName(PDFTOOLKIT_MODEL_1_0_URI, "encrypted"); + static final QName PROP_ENCRYPTIONDATE = QName.createQName(PDFTOOLKIT_MODEL_1_0_URI, "encryptiondate"); + static final QName PROP_ENCRYPTEDBY = QName.createQName(PDFTOOLKIT_MODEL_1_0_URI, "encryptedby"); + +} diff --git a/pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/repo/action/executer/BasePDFActionExecuter.java b/pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/repo/action/executer/BasePDFActionExecuter.java new file mode 100644 index 0000000..4e0d05b --- /dev/null +++ b/pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/repo/action/executer/BasePDFActionExecuter.java @@ -0,0 +1,73 @@ +/* + * Copyright 2008-2012 Alfresco Software Limited. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + * + * This file is part of an unsupported extension to Alfresco. + */ + +package org.alfresco.extension.pdftoolkit.repo.action.executer; + + +import java.util.List; + +import org.alfresco.extension.pdftoolkit.constants.PDFToolkitConstants; +import org.alfresco.extension.pdftoolkit.service.PDFToolkitService; +import org.alfresco.repo.action.ParameterDefinitionImpl; +import org.alfresco.repo.action.executer.ActionExecuterAbstractBase; +import org.alfresco.service.ServiceRegistry; +import org.alfresco.service.cmr.action.ParameterDefinition; +import org.alfresco.service.cmr.dictionary.DataTypeDefinition; + + +public abstract class BasePDFActionExecuter + extends ActionExecuterAbstractBase +{ + + protected ServiceRegistry serviceRegistry; + protected PDFToolkitService pdfToolkitService; + + //Default number of map entries at creation + protected static final int INITIAL_OPTIONS = 5; + + + /** + * Set a service registry to use, this will do away with all of the + * individual service registrations + * + * @param serviceRegistry + */ + public void setServiceRegistry(ServiceRegistry serviceRegistry) + { + this.serviceRegistry = serviceRegistry; + } + + /** + * Add parameter definitions + */ + @Override + protected void addParameterDefinitions(List paramList) + { + paramList.add(new ParameterDefinitionImpl(PDFToolkitConstants.PARAM_INPLACE, DataTypeDefinition.BOOLEAN, false, getParamDisplayLabel(PDFToolkitConstants.PARAM_INPLACE), false)); + paramList.add(new ParameterDefinitionImpl(PDFToolkitConstants.PARAM_CREATE_NEW, DataTypeDefinition.BOOLEAN, false, getParamDisplayLabel(PDFToolkitConstants.PARAM_CREATE_NEW), false)); + } + /** + * @param actionedUponNodeRef + * @return + */ + + public void setPDFToolkitService(PDFToolkitService pdfToolkitService) + { + this.pdfToolkitService = pdfToolkitService; + } +} diff --git a/pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/repo/action/executer/BasePDFStampActionExecuter.java b/pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/repo/action/executer/BasePDFStampActionExecuter.java new file mode 100644 index 0000000..84fec4b --- /dev/null +++ b/pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/repo/action/executer/BasePDFStampActionExecuter.java @@ -0,0 +1,62 @@ +/* + * Copyright 2008-2012 Alfresco Software Limited. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + * + * This file is part of an unsupported extension to Alfresco. + */ + +package org.alfresco.extension.pdftoolkit.repo.action.executer; + +import java.util.HashMap; +import java.util.List; + +import org.alfresco.extension.pdftoolkit.constants.PDFToolkitConstants; +import org.alfresco.extension.pdftoolkit.constraints.MapConstraint; +import org.alfresco.repo.action.ParameterDefinitionImpl; +import org.alfresco.service.cmr.action.ParameterDefinition; +import org.alfresco.service.cmr.dictionary.DataTypeDefinition; + +public abstract class BasePDFStampActionExecuter extends BasePDFActionExecuter +{ + + public static HashMap pageConstraint = new HashMap(); + public static HashMap positionConstraint = new HashMap(); + + /** + * Constraints + */ + public void setPositionConstraint(MapConstraint mc) + { + positionConstraint.putAll(mc.getAllowableValues()); + } + + public void setPageConstraint(MapConstraint mc) + { + pageConstraint.putAll(mc.getAllowableValues()); + } + + /** + * Add parameter definitions + */ + @Override + protected void addParameterDefinitions(List paramList) + { + paramList.add(new ParameterDefinitionImpl(PDFToolkitConstants.PARAM_POSITION, DataTypeDefinition.TEXT, false, getParamDisplayLabel(PDFToolkitConstants.PARAM_POSITION), false, "pdfc-position")); + paramList.add(new ParameterDefinitionImpl(PDFToolkitConstants.PARAM_LOCATION_X, DataTypeDefinition.TEXT, false, getParamDisplayLabel(PDFToolkitConstants.PARAM_LOCATION_X))); + paramList.add(new ParameterDefinitionImpl(PDFToolkitConstants.PARAM_LOCATION_Y, DataTypeDefinition.TEXT, false, getParamDisplayLabel(PDFToolkitConstants.PARAM_LOCATION_Y))); + paramList.add(new ParameterDefinitionImpl(PDFToolkitConstants.PARAM_PAGE, DataTypeDefinition.TEXT, false, getParamDisplayLabel(PDFToolkitConstants.PARAM_PAGE), false)); + + super.addParameterDefinitions(paramList); + } +} diff --git a/pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/repo/action/executer/PDFAppendActionExecuter.java b/pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/repo/action/executer/PDFAppendActionExecuter.java new file mode 100644 index 0000000..44dcdf6 --- /dev/null +++ b/pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/repo/action/executer/PDFAppendActionExecuter.java @@ -0,0 +1,78 @@ +/* + * Copyright 2008-2012 Alfresco Software Limited. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + * + * This file is part of an unsupported extension to Alfresco. + */ + +package org.alfresco.extension.pdftoolkit.repo.action.executer; + + +import java.util.List; + +import org.alfresco.extension.pdftoolkit.constants.PDFToolkitConstants; +import org.alfresco.repo.action.ParameterDefinitionImpl; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.action.ParameterDefinition; +import org.alfresco.service.cmr.dictionary.DataTypeDefinition; +import org.alfresco.service.cmr.repository.NodeRef; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + + +/** + * Append PDF action executer + * + * @author Jared Ottley + * + */ + +public class PDFAppendActionExecuter extends BasePDFActionExecuter +{ + + /** + * The logger + */ + private static Log logger = LogFactory.getLog(PDFAppendActionExecuter.class); + + /** + * Action constants + */ + public static final String NAME = "pdf-append"; + + /** + * Add parameter definitions + */ + @Override + protected void addParameterDefinitions(List paramList) + { + paramList.add(new ParameterDefinitionImpl(PDFToolkitConstants.PARAM_TARGET_NODE, DataTypeDefinition.NODE_REF, true, getParamDisplayLabel(PDFToolkitConstants.PARAM_TARGET_NODE))); + paramList.add(new ParameterDefinitionImpl(PDFToolkitConstants.PARAM_DESTINATION_FOLDER, DataTypeDefinition.NODE_REF, false, getParamDisplayLabel(PDFToolkitConstants.PARAM_DESTINATION_FOLDER))); + paramList.add(new ParameterDefinitionImpl(PDFToolkitConstants.PARAM_DESTINATION_NAME, DataTypeDefinition.TEXT, false, getParamDisplayLabel(PDFToolkitConstants.PARAM_DESTINATION_NAME))); + + super.addParameterDefinitions(paramList); + } + + /** + * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.repository.NodeRef, + * org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + protected void executeImpl(Action action, NodeRef actionedUponNodeRef) + { + // Do the work....split the PDF + NodeRef result = pdfToolkitService.appendPDF(actionedUponNodeRef, action.getParameterValues()); + action.setParameterValue(PARAM_RESULT, result); + } +} diff --git a/pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/repo/action/executer/PDFDecryptionActionExecuter.java b/pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/repo/action/executer/PDFDecryptionActionExecuter.java new file mode 100644 index 0000000..1def1ec --- /dev/null +++ b/pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/repo/action/executer/PDFDecryptionActionExecuter.java @@ -0,0 +1,40 @@ +package org.alfresco.extension.pdftoolkit.repo.action.executer; + +import java.util.List; + +import org.alfresco.extension.pdftoolkit.constants.PDFToolkitConstants; +import org.alfresco.repo.action.ParameterDefinitionImpl; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.action.ParameterDefinition; +import org.alfresco.service.cmr.dictionary.DataTypeDefinition; +import org.alfresco.service.cmr.repository.NodeRef; + +public class PDFDecryptionActionExecuter extends BasePDFActionExecuter +{ + + /** + * Action constants + */ + public static final String NAME = "pdf-decryption"; + + /** + * Add parameter definitions + */ + @Override + protected void addParameterDefinitions(List paramList) + { + + paramList.add(new ParameterDefinitionImpl(PDFToolkitConstants.PARAM_DESTINATION_FOLDER, DataTypeDefinition.NODE_REF, false, getParamDisplayLabel(PDFToolkitConstants.PARAM_DESTINATION_FOLDER))); + paramList.add(new ParameterDefinitionImpl(PDFToolkitConstants.PARAM_OWNER_PASSWORD, DataTypeDefinition.TEXT, true, getParamDisplayLabel(PDFToolkitConstants.PARAM_OWNER_PASSWORD))); + paramList.add(new ParameterDefinitionImpl(PDFToolkitConstants.PARAM_DESTINATION_NAME, DataTypeDefinition.TEXT, false, getParamDisplayLabel(PDFToolkitConstants.PARAM_DESTINATION_NAME))); + + super.addParameterDefinitions(paramList); + } + + @Override + protected void executeImpl(Action action, NodeRef actionedUponNodeRef) + { + NodeRef result = pdfToolkitService.decryptPDF(actionedUponNodeRef, action.getParameterValues()); + action.setParameterValue(PARAM_RESULT, result); + } +} diff --git a/pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/repo/action/executer/PDFDeletePageActionExecuter.java b/pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/repo/action/executer/PDFDeletePageActionExecuter.java new file mode 100644 index 0000000..4862c0e --- /dev/null +++ b/pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/repo/action/executer/PDFDeletePageActionExecuter.java @@ -0,0 +1,45 @@ +package org.alfresco.extension.pdftoolkit.repo.action.executer; + +import java.util.List; + +import org.alfresco.extension.pdftoolkit.constants.PDFToolkitConstants; +import org.alfresco.repo.action.ParameterDefinitionImpl; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.action.ParameterDefinition; +import org.alfresco.service.cmr.dictionary.DataTypeDefinition; +import org.alfresco.service.cmr.repository.NodeRef; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +public class PDFDeletePageActionExecuter extends BasePDFActionExecuter { + + /** + * The logger + */ + private static Log logger = LogFactory.getLog(PDFDeletePageActionExecuter.class); + + /** + * Action constants + */ + public static final String NAME = "pdf-delete-page"; + + /** + * Add parameter definitions + */ + @Override + protected void addParameterDefinitions(List paramList) + { + paramList.add(new ParameterDefinitionImpl(PDFToolkitConstants.PARAM_DESTINATION_FOLDER, DataTypeDefinition.NODE_REF, false, getParamDisplayLabel(PDFToolkitConstants.PARAM_DESTINATION_FOLDER))); + paramList.add(new ParameterDefinitionImpl(PDFToolkitConstants.PARAM_PAGE, DataTypeDefinition.TEXT, true, getParamDisplayLabel(PDFToolkitConstants.PARAM_PAGE))); + paramList.add(new ParameterDefinitionImpl(PDFToolkitConstants.PARAM_DESTINATION_NAME, DataTypeDefinition.TEXT, false, getParamDisplayLabel(PDFToolkitConstants.PARAM_DESTINATION_NAME))); + + super.addParameterDefinitions(paramList); + } + + @Override + protected void executeImpl(Action action, NodeRef actionedUponNodeRef) + { + NodeRef result = pdfToolkitService.deletePagesFromPDF(actionedUponNodeRef, action.getParameterValues()); + action.setParameterValue(PARAM_RESULT, result); + } +} diff --git a/pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/repo/action/executer/PDFEncryptionActionExecuter.java b/pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/repo/action/executer/PDFEncryptionActionExecuter.java new file mode 100644 index 0000000..81b16d3 --- /dev/null +++ b/pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/repo/action/executer/PDFEncryptionActionExecuter.java @@ -0,0 +1,99 @@ +/* + * Copyright 2008-2012 Alfresco Software Limited. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + * + * This file is part of an unsupported extension to Alfresco. + */ + +package org.alfresco.extension.pdftoolkit.repo.action.executer; + + +import java.util.HashMap; +import java.util.List; + +import org.alfresco.extension.pdftoolkit.constants.PDFToolkitConstants; +import org.alfresco.extension.pdftoolkit.constraints.MapConstraint; +import org.alfresco.repo.action.ParameterDefinitionImpl; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.action.ParameterDefinition; +import org.alfresco.service.cmr.dictionary.DataTypeDefinition; +import org.alfresco.service.cmr.repository.NodeRef; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + + +public class PDFEncryptionActionExecuter extends BasePDFActionExecuter +{ + + /** + * The logger + */ + private static Log logger = LogFactory.getLog(PDFEncryptionActionExecuter.class); + + /** + * Constraints + */ + public static HashMap encryptionLevelConstraint = new HashMap(); + + /** + * Action constants + */ + public static final String NAME = "pdf-encryption"; + + /** + * Setter for constraint bean + * + * @param encryptionLevelConstraint + */ + public void setEncryptionLevelConstraint(MapConstraint mc) + { + encryptionLevelConstraint.putAll(mc.getAllowableValues()); + } + + /** + * Add parameter definitions + */ + @Override + protected void addParameterDefinitions(List paramList) + { + + paramList.add(new ParameterDefinitionImpl(PDFToolkitConstants.PARAM_DESTINATION_FOLDER, DataTypeDefinition.NODE_REF, false, getParamDisplayLabel(PDFToolkitConstants.PARAM_DESTINATION_FOLDER))); + paramList.add(new ParameterDefinitionImpl(PDFToolkitConstants.PARAM_USER_PASSWORD, DataTypeDefinition.TEXT, true, getParamDisplayLabel(PDFToolkitConstants.PARAM_USER_PASSWORD))); + paramList.add(new ParameterDefinitionImpl(PDFToolkitConstants.PARAM_OWNER_PASSWORD, DataTypeDefinition.TEXT, true, getParamDisplayLabel(PDFToolkitConstants.PARAM_OWNER_PASSWORD))); + paramList.add(new ParameterDefinitionImpl(PDFToolkitConstants.PARAM_ALLOW_PRINT, DataTypeDefinition.BOOLEAN, true, getParamDisplayLabel(PDFToolkitConstants.PARAM_ALLOW_PRINT))); + paramList.add(new ParameterDefinitionImpl(PDFToolkitConstants.PARAM_ALLOW_COPY, DataTypeDefinition.BOOLEAN, true, getParamDisplayLabel(PDFToolkitConstants.PARAM_ALLOW_COPY))); + paramList.add(new ParameterDefinitionImpl(PDFToolkitConstants.PARAM_ALLOW_CONTENT_MODIFICATION, DataTypeDefinition.BOOLEAN, true, getParamDisplayLabel(PDFToolkitConstants.PARAM_ALLOW_CONTENT_MODIFICATION))); + paramList.add(new ParameterDefinitionImpl(PDFToolkitConstants.PARAM_ALLOW_ANNOTATION_MODIFICATION, DataTypeDefinition.BOOLEAN, true, getParamDisplayLabel(PDFToolkitConstants.PARAM_ALLOW_ANNOTATION_MODIFICATION))); + paramList.add(new ParameterDefinitionImpl(PDFToolkitConstants.PARAM_ALLOW_FORM_FILL, DataTypeDefinition.BOOLEAN, true, getParamDisplayLabel(PDFToolkitConstants.PARAM_ALLOW_FORM_FILL))); + paramList.add(new ParameterDefinitionImpl(PDFToolkitConstants.PARAM_ALLOW_SCREEN_READER, DataTypeDefinition.BOOLEAN, true, getParamDisplayLabel(PDFToolkitConstants.PARAM_ALLOW_SCREEN_READER))); + paramList.add(new ParameterDefinitionImpl(PDFToolkitConstants.PARAM_ALLOW_DEGRADED_PRINT, DataTypeDefinition.BOOLEAN, true, getParamDisplayLabel(PDFToolkitConstants.PARAM_ALLOW_DEGRADED_PRINT))); + paramList.add(new ParameterDefinitionImpl(PDFToolkitConstants.PARAM_ALLOW_ASSEMBLY, DataTypeDefinition.BOOLEAN, true, getParamDisplayLabel(PDFToolkitConstants.PARAM_ALLOW_ASSEMBLY))); + paramList.add(new ParameterDefinitionImpl(PDFToolkitConstants.PARAM_ENCRYPTION_LEVEL, DataTypeDefinition.TEXT, true, getParamDisplayLabel(PDFToolkitConstants.PARAM_ENCRYPTION_LEVEL), false, "pdfc-encryptionlevel")); + paramList.add(new ParameterDefinitionImpl(PDFToolkitConstants.PARAM_EXCLUDE_METADATA, DataTypeDefinition.BOOLEAN, true, getParamDisplayLabel(PDFToolkitConstants.PARAM_EXCLUDE_METADATA))); + paramList.add(new ParameterDefinitionImpl(PDFToolkitConstants.PARAM_DESTINATION_NAME, DataTypeDefinition.TEXT, false, getParamDisplayLabel(PDFToolkitConstants.PARAM_DESTINATION_NAME))); + + super.addParameterDefinitions(paramList); + } + + /** + * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.repository.NodeRef, + * org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + protected void executeImpl(Action action, NodeRef actionedUponNodeRef) + { + NodeRef result = pdfToolkitService.encryptPDF(actionedUponNodeRef, action.getParameterValues()); + action.setParameterValue(PARAM_RESULT, result); + } +} diff --git a/pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/repo/action/executer/PDFExtractPageActionExecuter.java b/pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/repo/action/executer/PDFExtractPageActionExecuter.java new file mode 100644 index 0000000..d1fd741 --- /dev/null +++ b/pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/repo/action/executer/PDFExtractPageActionExecuter.java @@ -0,0 +1,45 @@ +package org.alfresco.extension.pdftoolkit.repo.action.executer; + +import java.util.List; + +import org.alfresco.extension.pdftoolkit.constants.PDFToolkitConstants; +import org.alfresco.repo.action.ParameterDefinitionImpl; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.action.ParameterDefinition; +import org.alfresco.service.cmr.dictionary.DataTypeDefinition; +import org.alfresco.service.cmr.repository.NodeRef; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +public class PDFExtractPageActionExecuter extends BasePDFActionExecuter { + + /** + * The logger + */ + private static Log logger = LogFactory.getLog(PDFExtractPageActionExecuter.class); + + /** + * Action constants + */ + public static final String NAME = "pdf-extract-page"; + + /** + * Add parameter definitions + */ + @Override + protected void addParameterDefinitions(List paramList) + { + paramList.add(new ParameterDefinitionImpl(PDFToolkitConstants.PARAM_DESTINATION_FOLDER, DataTypeDefinition.NODE_REF, true, getParamDisplayLabel(PDFToolkitConstants.PARAM_DESTINATION_FOLDER))); + paramList.add(new ParameterDefinitionImpl(PDFToolkitConstants.PARAM_PAGE, DataTypeDefinition.TEXT, true, getParamDisplayLabel(PDFToolkitConstants.PARAM_PAGE))); + paramList.add(new ParameterDefinitionImpl(PDFToolkitConstants.PARAM_DESTINATION_NAME, DataTypeDefinition.TEXT, true, getParamDisplayLabel(PDFToolkitConstants.PARAM_DESTINATION_NAME))); + + super.addParameterDefinitions(paramList); + } + + @Override + protected void executeImpl(Action action, NodeRef actionedUponNodeRef) + { + NodeRef result = pdfToolkitService.extractPagesFromPDF(actionedUponNodeRef, action.getParameterValues()); + action.setParameterValue(PARAM_RESULT, result); + } +} diff --git a/pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/repo/action/executer/PDFInsertAtPageActionExecuter.java b/pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/repo/action/executer/PDFInsertAtPageActionExecuter.java new file mode 100644 index 0000000..d45139d --- /dev/null +++ b/pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/repo/action/executer/PDFInsertAtPageActionExecuter.java @@ -0,0 +1,78 @@ +/* + * Copyright 2008-2012 Alfresco Software Limited. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + * + * This file is part of an unsupported extension to Alfresco. + */ + +package org.alfresco.extension.pdftoolkit.repo.action.executer; + + +import java.util.List; + +import org.alfresco.extension.pdftoolkit.constants.PDFToolkitConstants; +import org.alfresco.repo.action.ParameterDefinitionImpl; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.action.ParameterDefinition; +import org.alfresco.service.cmr.dictionary.DataTypeDefinition; +import org.alfresco.service.cmr.repository.NodeRef; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + + +/** + * Insert PDF action executer + * + * @author Jared Ottley + * + */ + +public class PDFInsertAtPageActionExecuter extends BasePDFActionExecuter +{ + + /** + * The logger + */ + private static Log logger = LogFactory.getLog(PDFInsertAtPageActionExecuter.class); + + /** + * Action constants + */ + public static final String NAME = "pdf-insert-at-page"; + + /** + * Add parameter definitions + */ + @Override + protected void addParameterDefinitions(List paramList) + { + paramList.add(new ParameterDefinitionImpl(PDFToolkitConstants.PARAM_DESTINATION_FOLDER, DataTypeDefinition.NODE_REF, false, getParamDisplayLabel(PDFToolkitConstants.PARAM_DESTINATION_FOLDER))); + paramList.add(new ParameterDefinitionImpl(PDFToolkitConstants.PARAM_PAGE, DataTypeDefinition.TEXT, false, getParamDisplayLabel(PDFToolkitConstants.PARAM_PAGE))); + paramList.add(new ParameterDefinitionImpl(PDFToolkitConstants.PARAM_INSERT_CONTENT, DataTypeDefinition.NODE_REF, true, getParamDisplayLabel(PDFToolkitConstants.PARAM_INSERT_CONTENT))); + paramList.add(new ParameterDefinitionImpl(PDFToolkitConstants.PARAM_DESTINATION_NAME, DataTypeDefinition.TEXT, false, getParamDisplayLabel(PDFToolkitConstants.PARAM_DESTINATION_NAME))); + + super.addParameterDefinitions(paramList); + } + + /** + * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.repository.NodeRef, + * org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + protected void executeImpl(Action action, NodeRef actionedUponNodeRef) + { + NodeRef result = pdfToolkitService.insertPDF(actionedUponNodeRef, action.getParameterValues()); + action.setParameterValue(PARAM_RESULT, result); + } +} diff --git a/pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/repo/action/executer/PDFRotateActionExecuter.java b/pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/repo/action/executer/PDFRotateActionExecuter.java new file mode 100644 index 0000000..d5dcdb7 --- /dev/null +++ b/pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/repo/action/executer/PDFRotateActionExecuter.java @@ -0,0 +1,46 @@ +package org.alfresco.extension.pdftoolkit.repo.action.executer; + +import java.util.List; + +import org.alfresco.extension.pdftoolkit.constants.PDFToolkitConstants; +import org.alfresco.repo.action.ParameterDefinitionImpl; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.action.ParameterDefinition; +import org.alfresco.service.cmr.dictionary.DataTypeDefinition; +import org.alfresco.service.cmr.repository.NodeRef; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +public class PDFRotateActionExecuter extends BasePDFActionExecuter { + + /** + * The logger + */ + private static Log logger = LogFactory.getLog(PDFRotateActionExecuter.class); + + /** + * Action constants + */ + public static final String NAME = "pdf-rotate"; + + @Override + protected void executeImpl(Action action, NodeRef actionedUponNodeRef) + { + NodeRef result = pdfToolkitService.rotatePDF(actionedUponNodeRef, action.getParameterValues()); + action.setParameterValue(PARAM_RESULT, result); + } + + /** + * Add parameter definitions + */ + @Override + protected void addParameterDefinitions(List paramList) + { + paramList.add(new ParameterDefinitionImpl(PDFToolkitConstants.PARAM_DESTINATION_FOLDER, DataTypeDefinition.NODE_REF, false, getParamDisplayLabel(PDFToolkitConstants.PARAM_DESTINATION_FOLDER))); + paramList.add(new ParameterDefinitionImpl(PDFToolkitConstants.PARAM_DEGREES, DataTypeDefinition.TEXT, true, getParamDisplayLabel(PDFToolkitConstants.PARAM_DEGREES))); + paramList.add(new ParameterDefinitionImpl(PDFToolkitConstants.PARAM_DESTINATION_NAME, DataTypeDefinition.TEXT, false, getParamDisplayLabel(PDFToolkitConstants.PARAM_DESTINATION_NAME))); + paramList.add(new ParameterDefinitionImpl(PDFToolkitConstants.PARAM_PAGE, DataTypeDefinition.TEXT, false, getParamDisplayLabel(PDFToolkitConstants.PARAM_PAGE), false)); + + super.addParameterDefinitions(paramList); + } +} diff --git a/pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/repo/action/executer/PDFSignatureActionExecuter.java b/pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/repo/action/executer/PDFSignatureActionExecuter.java new file mode 100644 index 0000000..6ea9d13 --- /dev/null +++ b/pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/repo/action/executer/PDFSignatureActionExecuter.java @@ -0,0 +1,106 @@ +/* + * Copyright 2008-2012 Alfresco Software Limited. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + * + * This file is part of an unsupported extension to Alfresco. + */ + +package org.alfresco.extension.pdftoolkit.repo.action.executer; + + +import java.util.HashMap; +import java.util.List; + +import org.alfresco.extension.pdftoolkit.constants.PDFToolkitConstants; +import org.alfresco.extension.pdftoolkit.constraints.MapConstraint; +import org.alfresco.repo.action.ParameterDefinitionImpl; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.action.ParameterDefinition; +import org.alfresco.service.cmr.dictionary.DataTypeDefinition; +import org.alfresco.service.cmr.repository.NodeRef; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + + +public class PDFSignatureActionExecuter extends BasePDFStampActionExecuter +{ + + /** + * The logger + */ + private static Log logger = LogFactory.getLog(PDFSignatureActionExecuter.class); + + /** + * Constraints + */ + public static HashMap visibilityConstraint = new HashMap(); + public static HashMap keyTypeConstraint = new HashMap(); + + /** + * Action constants + */ + public static final String NAME = "pdf-signature"; + + /** + * Constraint beans + * + * @param mc + */ + public void setKeyTypeConstraint(MapConstraint mc) + { + keyTypeConstraint.putAll(mc.getAllowableValues()); + } + + public void setVisibilityConstraint(MapConstraint mc) + { + visibilityConstraint.putAll(mc.getAllowableValues()); + } + + /** + * Add parameter definitions + */ + @Override + protected void addParameterDefinitions(List paramList) + { + + paramList.add(new ParameterDefinitionImpl(PDFToolkitConstants.PARAM_DESTINATION_FOLDER, DataTypeDefinition.NODE_REF, false, getParamDisplayLabel(PDFToolkitConstants.PARAM_DESTINATION_FOLDER))); + paramList.add(new ParameterDefinitionImpl(PDFToolkitConstants.PARAM_PRIVATE_KEY, DataTypeDefinition.NODE_REF, true, getParamDisplayLabel(PDFToolkitConstants.PARAM_PRIVATE_KEY))); + paramList.add(new ParameterDefinitionImpl(PDFToolkitConstants.PARAM_VISIBILITY, DataTypeDefinition.TEXT, true, getParamDisplayLabel(PDFToolkitConstants.PARAM_VISIBILITY), false, "pdfc-visibility")); + paramList.add(new ParameterDefinitionImpl(PDFToolkitConstants.PARAM_LOCATION, DataTypeDefinition.TEXT, false, getParamDisplayLabel(PDFToolkitConstants.PARAM_LOCATION))); + paramList.add(new ParameterDefinitionImpl(PDFToolkitConstants.PARAM_REASON, DataTypeDefinition.TEXT, false, getParamDisplayLabel(PDFToolkitConstants.PARAM_REASON))); + paramList.add(new ParameterDefinitionImpl(PDFToolkitConstants.PARAM_KEY_PASSWORD, DataTypeDefinition.TEXT, true, getParamDisplayLabel(PDFToolkitConstants.PARAM_KEY_PASSWORD))); + paramList.add(new ParameterDefinitionImpl(PDFToolkitConstants.PARAM_WIDTH, DataTypeDefinition.INT, false, getParamDisplayLabel(PDFToolkitConstants.PARAM_WIDTH))); + paramList.add(new ParameterDefinitionImpl(PDFToolkitConstants.PARAM_HEIGHT, DataTypeDefinition.INT, false, getParamDisplayLabel(PDFToolkitConstants.PARAM_HEIGHT))); + paramList.add(new ParameterDefinitionImpl(PDFToolkitConstants.PARAM_KEY_TYPE, DataTypeDefinition.TEXT, true, getParamDisplayLabel(PDFToolkitConstants.PARAM_KEY_TYPE), false, "pdfc-keytype")); + paramList.add(new ParameterDefinitionImpl(PDFToolkitConstants.PARAM_ALIAS, DataTypeDefinition.TEXT, true, getParamDisplayLabel(PDFToolkitConstants.PARAM_ALIAS))); + paramList.add(new ParameterDefinitionImpl(PDFToolkitConstants.PARAM_STORE_PASSWORD, DataTypeDefinition.TEXT, true, getParamDisplayLabel(PDFToolkitConstants.PARAM_STORE_PASSWORD))); + paramList.add(new ParameterDefinitionImpl(PDFToolkitConstants.PARAM_DESTINATION_NAME, DataTypeDefinition.TEXT, false, getParamDisplayLabel(PDFToolkitConstants.PARAM_DESTINATION_NAME))); + paramList.add(new ParameterDefinitionImpl(PDFToolkitConstants.PARAM_NEW_REVISION, DataTypeDefinition.BOOLEAN, false, getParamDisplayLabel(PDFToolkitConstants.PARAM_NEW_REVISION), false)); + + super.addParameterDefinitions(paramList); + + } + + + /** + * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.repository.NodeRef, + * org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + protected void executeImpl(Action action, NodeRef actionedUponNodeRef) + { + NodeRef result = pdfToolkitService.signPDF(actionedUponNodeRef, action.getParameterValues()); + action.setParameterValue(PARAM_RESULT, result); + } +} diff --git a/pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/repo/action/executer/PDFSplitActionExecuter.java b/pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/repo/action/executer/PDFSplitActionExecuter.java new file mode 100644 index 0000000..b7bda92 --- /dev/null +++ b/pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/repo/action/executer/PDFSplitActionExecuter.java @@ -0,0 +1,76 @@ +/* + * Copyright 2008-2012 Alfresco Software Limited. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + * + * This file is part of an unsupported extension to Alfresco. + */ + +package org.alfresco.extension.pdftoolkit.repo.action.executer; + + +import java.util.List; +import org.alfresco.extension.pdftoolkit.constants.PDFToolkitConstants; +import org.alfresco.repo.action.ParameterDefinitionImpl; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.action.ParameterDefinition; +import org.alfresco.service.cmr.dictionary.DataTypeDefinition; +import org.alfresco.service.cmr.repository.NodeRef; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + + +/** + * Split PDF action executer + * + * @author Jared Ottley + * + */ + +public class PDFSplitActionExecuter extends BasePDFActionExecuter +{ + + /** + * The logger + */ + private static Log logger = LogFactory.getLog(PDFSplitActionExecuter.class); + + /** + * Action constants + */ + public static final String NAME = "pdf-split"; + + /** + * Add parameter definitions + */ + @Override + protected void addParameterDefinitions(List paramList) + { + paramList.add(new ParameterDefinitionImpl(PDFToolkitConstants.PARAM_DESTINATION_FOLDER, DataTypeDefinition.NODE_REF, true, getParamDisplayLabel(PDFToolkitConstants.PARAM_DESTINATION_FOLDER))); + paramList.add(new ParameterDefinitionImpl(PDFToolkitConstants.PARAM_SPLIT_FREQUENCY, DataTypeDefinition.TEXT, false, getParamDisplayLabel(PDFToolkitConstants.PARAM_SPLIT_FREQUENCY))); + + super.addParameterDefinitions(paramList); + } + + + /** + * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.repository.NodeRef, + * org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + protected void executeImpl(Action action, NodeRef actionedUponNodeRef) + { + NodeRef result = pdfToolkitService.splitPDF(actionedUponNodeRef, action.getParameterValues()); + action.setParameterValue(PARAM_RESULT, result); + } +} diff --git a/pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/repo/action/executer/PDFSplitAtPageActionExecuter.java b/pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/repo/action/executer/PDFSplitAtPageActionExecuter.java new file mode 100644 index 0000000..83d3502 --- /dev/null +++ b/pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/repo/action/executer/PDFSplitAtPageActionExecuter.java @@ -0,0 +1,75 @@ +/* + * Copyright 2008-2012 Alfresco Software Limited. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + * + * This file is part of an unsupported extension to Alfresco. + */ + +package org.alfresco.extension.pdftoolkit.repo.action.executer; + + +import java.util.List; +import org.alfresco.extension.pdftoolkit.constants.PDFToolkitConstants; +import org.alfresco.repo.action.ParameterDefinitionImpl; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.action.ParameterDefinition; +import org.alfresco.service.cmr.dictionary.DataTypeDefinition; +import org.alfresco.service.cmr.repository.NodeRef; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + + +/** + * Split PDF action executer + * + * @author Jared Ottley + * + */ + +public class PDFSplitAtPageActionExecuter extends BasePDFActionExecuter +{ + + /** + * The logger + */ + private static Log logger = LogFactory.getLog(PDFSplitAtPageActionExecuter.class); + + /** + * Action constants + */ + public static final String NAME = "pdf-split-at-page"; + + /** + * Add parameter definitions + */ + @Override + protected void addParameterDefinitions(List paramList) + { + paramList.add(new ParameterDefinitionImpl(PDFToolkitConstants.PARAM_DESTINATION_FOLDER, DataTypeDefinition.NODE_REF, true, getParamDisplayLabel(PDFToolkitConstants.PARAM_DESTINATION_FOLDER))); + paramList.add(new ParameterDefinitionImpl(PDFToolkitConstants.PARAM_PAGE, DataTypeDefinition.TEXT, false, getParamDisplayLabel(PDFToolkitConstants.PARAM_PAGE))); + + super.addParameterDefinitions(paramList); + } + + /** + * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.repository.NodeRef, + * org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + protected void executeImpl(Action action, NodeRef actionedUponNodeRef) + { + NodeRef result = pdfToolkitService.splitPDFAtPage(actionedUponNodeRef, action.getParameterValues()); + action.setParameterValue(PARAM_RESULT, result); + } +} diff --git a/pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/repo/action/executer/PDFWatermarkActionExecuter.java b/pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/repo/action/executer/PDFWatermarkActionExecuter.java new file mode 100644 index 0000000..9093636 --- /dev/null +++ b/pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/repo/action/executer/PDFWatermarkActionExecuter.java @@ -0,0 +1,106 @@ +/* + * Copyright 2008-2012 Alfresco Software Limited. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + * + * This file is part of an unsupported extension to Alfresco. + */ + +package org.alfresco.extension.pdftoolkit.repo.action.executer; + + +import java.util.HashMap; +import java.util.List; + +import org.alfresco.extension.pdftoolkit.constants.PDFToolkitConstants; +import org.alfresco.extension.pdftoolkit.constraints.MapConstraint; +import org.alfresco.repo.action.ParameterDefinitionImpl; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.action.ParameterDefinition; +import org.alfresco.service.cmr.dictionary.DataTypeDefinition; +import org.alfresco.service.cmr.repository.NodeRef; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + + +public class PDFWatermarkActionExecuter extends BasePDFStampActionExecuter +{ + /** + * The logger + */ + private static Log logger = LogFactory.getLog(PDFWatermarkActionExecuter.class); + + public static HashMap fontConstraint = new HashMap(); + public static HashMap depthConstraint = new HashMap(); + public static HashMap typeConstraint = new HashMap(); + public static HashMap fontSizeConstraint = new HashMap(); + + /** + * Action constants + */ + public static final String NAME = "pdf-watermark"; + + /** + * setters for constraint beans + * + * @param fontConstraint + */ + public void setFontConstraint(MapConstraint mc) + { + fontConstraint.putAll(mc.getAllowableValues()); + } + + public void setDepthConstraint(MapConstraint mc) + { + depthConstraint.putAll(mc.getAllowableValues()); + } + + public void setTypeConstraint(MapConstraint mc) + { + typeConstraint.putAll(mc.getAllowableValues()); + } + + public void setFontSizeConstraint(MapConstraint mc) + { + fontSizeConstraint.putAll(mc.getAllowableValues()); + } + + /** + * Add parameter definitions + */ + @Override + protected void addParameterDefinitions(List paramList) + { + paramList.add(new ParameterDefinitionImpl(PDFToolkitConstants.PARAM_DESTINATION_FOLDER, DataTypeDefinition.NODE_REF, false, getParamDisplayLabel(PDFToolkitConstants.PARAM_DESTINATION_FOLDER))); + paramList.add(new ParameterDefinitionImpl(PDFToolkitConstants.PARAM_WATERMARK_IMAGE, DataTypeDefinition.NODE_REF, false, getParamDisplayLabel(PDFToolkitConstants.PARAM_WATERMARK_IMAGE))); + paramList.add(new ParameterDefinitionImpl(PDFToolkitConstants.PARAM_WATERMARK_DEPTH, DataTypeDefinition.TEXT, true, getParamDisplayLabel(PDFToolkitConstants.PARAM_WATERMARK_DEPTH), false, "pdfc-depth")); + paramList.add(new ParameterDefinitionImpl(PDFToolkitConstants.PARAM_WATERMARK_TEXT, DataTypeDefinition.TEXT, false, getParamDisplayLabel(PDFToolkitConstants.PARAM_WATERMARK_TEXT))); + paramList.add(new ParameterDefinitionImpl(PDFToolkitConstants.PARAM_WATERMARK_FONT, DataTypeDefinition.TEXT, false, getParamDisplayLabel(PDFToolkitConstants.PARAM_WATERMARK_FONT), false, "pdfc-font")); + paramList.add(new ParameterDefinitionImpl(PDFToolkitConstants.PARAM_WATERMARK_SIZE, DataTypeDefinition.TEXT, false, getParamDisplayLabel(PDFToolkitConstants.PARAM_WATERMARK_SIZE), false, "pdfc-fontsize")); + paramList.add(new ParameterDefinitionImpl(PDFToolkitConstants.PARAM_WATERMARK_TYPE, DataTypeDefinition.TEXT, true, getParamDisplayLabel(PDFToolkitConstants.PARAM_WATERMARK_TYPE), false, "pdfc-watermarktype")); + paramList.add(new ParameterDefinitionImpl(PDFToolkitConstants.PARAM_DESTINATION_NAME, DataTypeDefinition.TEXT, false, getParamDisplayLabel(PDFToolkitConstants.PARAM_DESTINATION_NAME))); + + super.addParameterDefinitions(paramList); + } + + /** + * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.repository.NodeRef, + * org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + protected void executeImpl(Action action, NodeRef actionedUponNodeRef) + { + NodeRef result = pdfToolkitService.watermarkPDF(actionedUponNodeRef, action.getParameterValues()); + action.setParameterValue(PARAM_RESULT, result); + } +} diff --git a/pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/service/PDFToolkitService.java b/pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/service/PDFToolkitService.java new file mode 100644 index 0000000..235c16c --- /dev/null +++ b/pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/service/PDFToolkitService.java @@ -0,0 +1,116 @@ +/* + * Copyright 2008-2012 Alfresco Software Limited. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + * + * This file is part of an unsupported extension to Alfresco. + */ + +package org.alfresco.extension.pdftoolkit.service; + +import java.io.Serializable; +import java.util.Map; + +import org.alfresco.service.cmr.repository.NodeRef; + +public interface PDFToolkitService +{ + // the actual action code + /** + * Appends one PDF document to another + * @param targetNodeRef + * @param params + * @return a NodeRef containing the appended PDF + */ + public NodeRef appendPDF(NodeRef targetNodeRef, Map params); + + /** + * Encrypts a PDF document, returns + * @param targetNodeRef + * @param params + * @return a NodeRef pointing to the encrypted PDF + */ + public NodeRef encryptPDF(NodeRef targetNodeRef, Map params); + + /** + * Decrypts a PDF document, given the owner password + * @param targetNodeRef + * @param params + * @return a NodeRef pointing to the decrypted PDF + */ + public NodeRef decryptPDF(NodeRef targetNodeRef, Map params); + + /** + * Applies a digital signature to a PDF document + * @param targetNodeRef + * @param params + * @return a NodeRef pointing to the signed PDF + */ + public NodeRef signPDF(NodeRef targetNodeRef, Map params); + + /** + * Applies a text or image watermark to a PDF document + * @param targetNodeRef + * @param params + * @return a NodeRef pointing to the watermarked PDF + */ + public NodeRef watermarkPDF(NodeRef targetNodeRef, Map params); + + /** + * Splits a PDF document into single pages + * @param targetNodeRef + * @param params + * @return a NodeRef pointing to the folder containing the split PDF + */ + public NodeRef splitPDF(NodeRef targetNodeRef, Map params); + + /** + * Splits a PDF document at a specific page + * @param targetNodeRef + * @param params + * @return a NodeRef pointing to the folder containing the split PDF + */ + public NodeRef splitPDFAtPage(NodeRef targetNodeRef, Map params); + + /** + * Inserts one PDF document into another at a specific location + * @param targetNodeRef + * @param params + * @return a NodeRef pointing to the combined PDF + */ + public NodeRef insertPDF(NodeRef targetNodeRef, Map params); + + /** + * Deletes selected pages from a PDF document + * @param targetNodeRef + * @param params + * @return a NodeRef pointing to the resulting PDF + */ + public NodeRef deletePagesFromPDF(NodeRef targetNodeRef, Map params); + + /** + * Extracts selected pages from a PDF document + * @param targetNodeRef + * @param params + * @return a NodeRef pointing to the PDF containing the extracted pages + */ + public NodeRef extractPagesFromPDF(NodeRef targetNodeRef, Map params); + + /** + * Rotates a PDF document + * @param targetNodeRef + * @param params + * @return a NodeRef pointing to the rotated PDF + */ + public NodeRef rotatePDF(NodeRef targetNodeRef, Map params); +} diff --git a/pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/service/PDFToolkitServiceImpl.java b/pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/service/PDFToolkitServiceImpl.java new file mode 100644 index 0000000..154813e --- /dev/null +++ b/pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/service/PDFToolkitServiceImpl.java @@ -0,0 +1,2142 @@ +package org.alfresco.extension.pdftoolkit.service; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.Serializable; +import java.io.StringWriter; +import java.nio.charset.Charset; +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import java.security.PrivateKey; +import java.security.UnrecoverableKeyException; +import java.security.cert.Certificate; +import java.security.cert.CertificateException; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.StringTokenizer; +import java.util.Vector; + +import javax.imageio.ImageIO; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.extension.pdftoolkit.constants.PDFToolkitConstants; +import org.alfresco.extension.pdftoolkit.model.PDFToolkitModel; +import org.alfresco.model.ContentModel; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.template.FreeMarkerProcessor; +import org.alfresco.repo.template.TemplateNode; +import org.alfresco.service.ServiceRegistry; +import org.alfresco.service.cmr.dictionary.DictionaryService; +import org.alfresco.service.cmr.model.FileExistsException; +import org.alfresco.service.cmr.model.FileFolderService; +import org.alfresco.service.cmr.model.FileInfo; +import org.alfresco.service.cmr.model.FileNotFoundException; +import org.alfresco.service.cmr.repository.ContentIOException; +import org.alfresco.service.cmr.repository.ContentReader; +import org.alfresco.service.cmr.repository.ContentService; +import org.alfresco.service.cmr.repository.ContentWriter; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.cmr.security.AuthenticationService; +import org.alfresco.service.cmr.security.PersonService; +import org.alfresco.service.namespace.QName; +import org.alfresco.util.TempFileProvider; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.pdfbox.multipdf.PDFMergerUtility; +import org.apache.pdfbox.multipdf.Splitter; +import org.apache.pdfbox.pdmodel.PDDocument; +import org.springframework.extensions.surf.util.I18NUtil; + +import com.itextpdf.text.Document; +import com.itextpdf.text.DocumentException; +import com.itextpdf.text.Image; +import com.itextpdf.text.Rectangle; +import com.itextpdf.text.pdf.BaseFont; +import com.itextpdf.text.pdf.PdfContentByte; +import com.itextpdf.text.pdf.PdfCopy; +import com.itextpdf.text.pdf.PdfDate; +import com.itextpdf.text.pdf.PdfDictionary; +import com.itextpdf.text.pdf.PdfName; +import com.itextpdf.text.pdf.PdfNumber; +import com.itextpdf.text.pdf.PdfReader; +import com.itextpdf.text.pdf.PdfSignature; +import com.itextpdf.text.pdf.PdfSignatureAppearance; +import com.itextpdf.text.pdf.PdfStamper; +import com.itextpdf.text.pdf.PdfWriter; + +public class PDFToolkitServiceImpl extends PDFToolkitConstants implements PDFToolkitService +{ + private final static String MSGID_PAGE_NUMBERING_PATTERN_MULTIPLE="pdftoolkit.split-page-numbering-pattern-multiple"; + private final static String MSGID_PAGE_NUMBERING_PATTERN_SINGLE="pdftoolkit.split-page-numbering-pattern-single"; + + private ServiceRegistry serviceRegistry; + private NodeService ns; + private ContentService cs; + private FileFolderService ffs; + private DictionaryService ds; + private PersonService ps; + private AuthenticationService as; + + private FreeMarkerProcessor freemarkerProcessor = new FreeMarkerProcessor(); + + private static Log logger = LogFactory.getLog(PDFToolkitServiceImpl.class); + + // do we need to apply the encryption aspect when we encrypt? + private boolean useEncryptionAspect = true; + + // do we need to apply the signature aspect when we sign? + private boolean useSignatureAspect = true; + + // when we create a new document, do we actually create a new one, or copy the source? + private boolean createNew = false; + + @Override + public NodeRef appendPDF(NodeRef targetNodeRef, Map params) + { + PDDocument pdf = null; + PDDocument pdfTarget = null; + InputStream is = null; + InputStream tis = null; + File tempDir = null; + ContentWriter writer = null; + NodeRef destinationNode = null; + + try + { + NodeRef toAppend = (NodeRef)params.get(PARAM_TARGET_NODE); + Boolean inplace = Boolean.valueOf(String.valueOf(params.get(PARAM_INPLACE))); + ContentReader append = getReader(toAppend); + is = append.getContentInputStream(); + + ContentReader targetReader = getReader(targetNodeRef); + tis = targetReader.getContentInputStream(); + + String fileName = getFilename(params, targetNodeRef); + + // stream the document in + pdf = PDDocument.load(is); + pdfTarget = PDDocument.load(tis); + + // Append the PDFs + PDFMergerUtility merger = new PDFMergerUtility(); + merger.appendDocument(pdfTarget, pdf); + merger.setDestinationFileName(fileName); + merger.mergeDocuments(); + + // build a temp dir name based on the ID of the noderef we are + // importing + File alfTempDir = TempFileProvider.getTempDir(); + tempDir = new File(alfTempDir.getPath() + File.separatorChar + targetNodeRef.getId()); + tempDir.mkdir(); + + pdfTarget.save(tempDir + "" + File.separatorChar + fileName); + + for (File file : tempDir.listFiles()) + { + try + { + if (file.isFile()) + { + // Get a writer and prep it for putting it back into the repo + destinationNode = createDestinationNode(fileName, + (NodeRef)params.get(PARAM_DESTINATION_FOLDER), targetNodeRef, inplace); + writer = cs.getWriter(destinationNode, ContentModel.PROP_CONTENT, true); + + writer.setEncoding(targetReader.getEncoding()); // original + // encoding + writer.setMimetype(FILE_MIMETYPE); + + // Put it in the repo + writer.putContent(file); + + // Clean up + file.delete(); + } + } + catch (FileExistsException e) + { + throw new AlfrescoRuntimeException("Failed to process file.", e); + } + } + } + catch (IOException e) + { + throw new AlfrescoRuntimeException(e.getMessage(), e); + } + + finally + { + if (pdf != null) + { + try + { + pdf.close(); + } + catch (IOException e) + { + throw new AlfrescoRuntimeException(e.getMessage(), e); + } + } + if (pdfTarget != null) + { + try + { + pdfTarget.close(); + } + catch (IOException e) + { + throw new AlfrescoRuntimeException(e.getMessage(), e); + } + } + if (is != null) + { + try + { + is.close(); + } + catch (IOException e) + { + throw new AlfrescoRuntimeException(e.getMessage(), e); + } + } + + if (tempDir != null) + { + tempDir.delete(); + } + } + + return destinationNode; + } + + @Override + public NodeRef encryptPDF(NodeRef targetNodeRef, Map params) + { + PdfStamper stamp = null; + File tempDir = null; + ContentWriter writer = null; + ContentReader targetReader = null; + NodeRef destinationNode = null; + + try + { + // get the parameters + String userPassword = (String)params.get(PARAM_USER_PASSWORD); + String ownerPassword = (String)params.get(PARAM_OWNER_PASSWORD); + Boolean inplace = Boolean.valueOf(String.valueOf(params.get(PARAM_INPLACE))); + int permissions = buildPermissionMask(params); + int encryptionType = Integer.parseInt((String)params.get(PARAM_ENCRYPTION_LEVEL)); + + // if metadata is excluded, alter encryption type + if ((Boolean)params.get(PARAM_EXCLUDE_METADATA)) + { + encryptionType = encryptionType | PdfWriter.DO_NOT_ENCRYPT_METADATA; + } + + // get temp file + File alfTempDir = TempFileProvider.getTempDir(); + tempDir = new File(alfTempDir.getPath() + File.separatorChar + targetNodeRef.getId()); + tempDir.mkdir(); + File file = new File(tempDir, ffs.getFileInfo(targetNodeRef).getName()); + + // get the PDF input stream and create a reader for iText + targetReader = getReader(targetNodeRef); + PdfReader reader = new PdfReader(targetReader.getContentInputStream()); + stamp = new PdfStamper(reader, new FileOutputStream(file)); + + // encrypt PDF + stamp.setEncryption(userPassword.getBytes(Charset.forName("UTF-8")), ownerPassword.getBytes(Charset.forName("UTF-8")), permissions, encryptionType); + stamp.close(); + + String fileName = getFilename(params, targetNodeRef); + + // write out to destination + destinationNode = createDestinationNode(fileName, + (NodeRef)params.get(PARAM_DESTINATION_FOLDER), targetNodeRef, inplace); + writer = cs.getWriter(destinationNode, ContentModel.PROP_CONTENT, true); + + writer.setEncoding(targetReader.getEncoding()); + writer.setMimetype(FILE_MIMETYPE); + writer.putContent(file); + file.delete(); + + //if useAspect is true, store some additional info about the signature in the props + if(useEncryptionAspect) + { + ns.addAspect(destinationNode, PDFToolkitModel.ASPECT_ENCRYPTED, new HashMap()); + ns.setProperty(destinationNode, PDFToolkitModel.PROP_ENCRYPTIONDATE, new java.util.Date()); + ns.setProperty(destinationNode, PDFToolkitModel.PROP_ENCRYPTEDBY, AuthenticationUtil.getRunAsUser()); + } + + } + catch (IOException e) + { + throw new AlfrescoRuntimeException(e.getMessage(), e); + } + catch (DocumentException e) + { + throw new AlfrescoRuntimeException(e.getMessage(), e); + } + finally + { + if (tempDir != null) + { + try + { + tempDir.delete(); + } + catch (Exception ex) + { + throw new AlfrescoRuntimeException(ex.getMessage(), ex); + } + } + + if (stamp != null) + { + try + { + stamp.close(); + } + catch (Exception ex) + { + throw new AlfrescoRuntimeException(ex.getMessage(), ex); + } + } + } + + return destinationNode; + } + + @Override + public NodeRef decryptPDF(NodeRef targetNodeRef, Map params) + { + PdfStamper stamp = null; + File tempDir = null; + ContentWriter writer = null; + ContentReader targetReader = null; + NodeRef destinationNode = null; + + try + { + // get the parameters + String ownerPassword = (String)params.get(PARAM_OWNER_PASSWORD); + Boolean inplace = Boolean.valueOf(String.valueOf(params.get(PARAM_INPLACE))); + + // get temp file + File alfTempDir = TempFileProvider.getTempDir(); + tempDir = new File(alfTempDir.getPath() + File.separatorChar + targetNodeRef.getId()); + tempDir.mkdir(); + File file = new File(tempDir, ffs.getFileInfo(targetNodeRef).getName()); + + // get the PDF input stream and create a reader for iText + targetReader = getReader(targetNodeRef); + PdfReader reader = new PdfReader(targetReader.getContentInputStream(), ownerPassword.getBytes()); + stamp = new PdfStamper(reader, new FileOutputStream(file)); + stamp.close(); + + String fileName = getFilename(params, targetNodeRef); + + // write out to destination + destinationNode = createDestinationNode(fileName, + (NodeRef)params.get(PARAM_DESTINATION_FOLDER), targetNodeRef, inplace); + writer = cs.getWriter(destinationNode, ContentModel.PROP_CONTENT, true); + + writer.setEncoding(targetReader.getEncoding()); + writer.setMimetype(FILE_MIMETYPE); + writer.putContent(file); + file.delete(); + + //if useAspect is true, store some additional info about the signature in the props + if(useEncryptionAspect) + { + ns.removeAspect(destinationNode, PDFToolkitModel.ASPECT_ENCRYPTED); + } + } + catch (IOException e) + { + throw new AlfrescoRuntimeException(e.getMessage(), e); + } + catch (DocumentException e) + { + throw new AlfrescoRuntimeException(e.getMessage(), e); + } + finally + { + if (tempDir != null) + { + try + { + tempDir.delete(); + } + catch (Exception ex) + { + throw new AlfrescoRuntimeException(ex.getMessage(), ex); + } + } + + if (stamp != null) + { + try + { + stamp.close(); + } + catch (Exception ex) + { + throw new AlfrescoRuntimeException(ex.getMessage(), ex); + } + } + } + + return destinationNode; + } + + @Override + public NodeRef signPDF(NodeRef targetNodeRef, Map params) + { + NodeRef privateKey = (NodeRef)params.get(PARAM_PRIVATE_KEY); + String location = (String)params.get(PARAM_LOCATION); + String position = (String)params.get(PARAM_POSITION); + String reason = (String)params.get(PARAM_REASON); + String visibility = (String)params.get(PARAM_VISIBILITY); + String keyPassword = (String)params.get(PARAM_KEY_PASSWORD); + String keyType = (String)params.get(PARAM_KEY_TYPE); + int height = getInteger(params.get(PARAM_HEIGHT)); + int width = getInteger(params.get(PARAM_WIDTH)); + int pageNumber = getInteger(params.get(PARAM_PAGE)); + + // By default, append the signature as a new PDF revision to avoid + // invalidating any signatures that might already exist on the doc + boolean appendToExisting = true; + if (params.get(PARAM_NEW_REVISION) != null) { + appendToExisting = Boolean.valueOf(String.valueOf(params.get(PARAM_NEW_REVISION))); + } + + // New keystore parameters + String alias = (String)params.get(PARAM_ALIAS); + String storePassword = (String)params.get(PARAM_STORE_PASSWORD); + + int locationX = getInteger(params.get(PARAM_LOCATION_X)); + int locationY = getInteger(params.get(PARAM_LOCATION_Y)); + + Boolean inplace = Boolean.valueOf(String.valueOf(params.get(PARAM_INPLACE))); + + File tempDir = null; + ContentWriter writer = null; + KeyStore ks = null; + + NodeRef destinationNode = null; + + try + { + // get a keystore instance by + if (keyType == null || keyType.equalsIgnoreCase(KEY_TYPE_DEFAULT)) + { + ks = KeyStore.getInstance(KeyStore.getDefaultType()); + } + else if (keyType.equalsIgnoreCase(KEY_TYPE_PKCS12)) + { + ks = KeyStore.getInstance("pkcs12"); + } + else + { + throw new AlfrescoRuntimeException("Unknown key type " + keyType + " specified"); + } + + // open the reader to the key and load it + ContentReader keyReader = getReader(privateKey); + ks.load(keyReader.getContentInputStream(), storePassword.toCharArray()); + + // set alias + // String alias = (String) ks.aliases().nextElement(); + + PrivateKey key = (PrivateKey)ks.getKey(alias, keyPassword.toCharArray()); + Certificate[] chain = ks.getCertificateChain(alias); + + // open original pdf + ContentReader pdfReader = getReader(targetNodeRef); + PdfReader reader = new PdfReader(pdfReader.getContentInputStream()); + + // If the page number is 0 because it couldn't be parsed or for + // some other reason, set it to the first page, which is 1. + // If the page number is negative, assume the intent is to "wrap". + // For example, -1 would always be the last page. + int numPages = reader.getNumberOfPages(); + if (pageNumber < 1 && pageNumber == 0) { + pageNumber = 1; // use the first page + } else { + // page number is negative + pageNumber = numPages + 1 + pageNumber; + if (pageNumber <= 0) pageNumber = 1; + } + + // if the page number specified is more than the num of pages, + // use the last page + if (pageNumber > numPages) { + pageNumber = numPages; + } + + // create temp dir to store file + File alfTempDir = TempFileProvider.getTempDir(); + tempDir = new File(alfTempDir.getPath() + File.separatorChar + targetNodeRef.getId()); + tempDir.mkdir(); + File file = new File(tempDir, ffs.getFileInfo(targetNodeRef).getName()); + + FileOutputStream fout = new FileOutputStream(file); + + // When adding a second signature, append must be called on PdfStamper.createSignature + // to avoid invalidating previous signatures + PdfStamper stamp = null; + if (appendToExisting) { + stamp = PdfStamper.createSignature(reader, fout, '\0', tempDir, true); + } else { + stamp = PdfStamper.createSignature(reader, fout, '\0'); + } + + PdfSignatureAppearance sap = stamp.getSignatureAppearance(); + // set reason for signature and location of signer + sap.setReason(reason); + sap.setLocation(location); + + PdfSignature dic = new PdfSignature( + PdfName.ADOBE_PPKLITE, PdfName.ADBE_PKCS7_DETACHED); + dic.setReason(sap.getReason()); + dic.setLocation(sap.getLocation()); + dic.setContact(sap.getContact()); + dic.setDate(new PdfDate(sap.getSignDate())); + + //sap.setCrypto(key, chain, null, PdfSignatureAppearance.WINCER_SIGNED); + + if (visibility.equalsIgnoreCase(VISIBILITY_VISIBLE)) + { + //create the signature rectangle using either the provided position or + //the exact coordinates, if provided + if(position != null && !position.trim().equalsIgnoreCase("") + && !position.trim().equalsIgnoreCase(POSITION_MANUAL)) + { + Rectangle pageRect = reader.getPageSizeWithRotation(pageNumber); + sap.setVisibleSignature(positionSignature(position, pageRect, width, height), pageNumber, null); + } + else + { + sap.setVisibleSignature(new Rectangle(locationX, locationY, locationX + width, locationY - height), pageNumber, null); + } + } + + sap.setCryptoDictionary(dic); + + stamp.close(); + + String fileName = getFilename(params, targetNodeRef); + + destinationNode = createDestinationNode(fileName, + (NodeRef)params.get(PARAM_DESTINATION_FOLDER), targetNodeRef, inplace); + writer = cs.getWriter(destinationNode, ContentModel.PROP_CONTENT, true); + + writer.setEncoding(pdfReader.getEncoding()); + writer.setMimetype(FILE_MIMETYPE); + writer.putContent(file); + + file.delete(); + + //if useAspect is true, store some additional info about the signature in the props + if(useSignatureAspect) + { + ns.addAspect(destinationNode, PDFToolkitModel.ASPECT_SIGNED, new HashMap()); + ns.setProperty(destinationNode, PDFToolkitModel.PROP_REASON, reason); + ns.setProperty(destinationNode, PDFToolkitModel.PROP_LOCATION, location); + ns.setProperty(destinationNode, PDFToolkitModel.PROP_SIGNATUREDATE, new java.util.Date()); + ns.setProperty(destinationNode, PDFToolkitModel.PROP_SIGNEDBY, AuthenticationUtil.getRunAsUser()); + } + + } + catch (IOException e) + { + throw new AlfrescoRuntimeException(e.getMessage(), e); + } + catch (KeyStoreException e) + { + throw new AlfrescoRuntimeException(e.getMessage(), e); + } + catch (ContentIOException e) + { + throw new AlfrescoRuntimeException(e.getMessage(), e); + } + catch (NoSuchAlgorithmException e) + { + throw new AlfrescoRuntimeException(e.getMessage(), e); + } + catch (CertificateException e) + { + throw new AlfrescoRuntimeException(e.getMessage(), e); + } + catch (UnrecoverableKeyException e) + { + throw new AlfrescoRuntimeException(e.getMessage(), e); + } + catch (DocumentException e) + { + throw new AlfrescoRuntimeException(e.getMessage(), e); + } + finally + { + if (tempDir != null) + { + try + { + tempDir.delete(); + } + catch (Exception ex) + { + throw new AlfrescoRuntimeException(ex.getMessage(), ex); + } + } + } + + return destinationNode; + } + + @Override + public NodeRef watermarkPDF(NodeRef targetNodeRef, Map params) + { + + NodeRef destinationNode = null; + + try + { + ContentReader targetReader = getReader(targetNodeRef); + + if (params.get(PARAM_WATERMARK_TYPE) != null + && params.get(PARAM_WATERMARK_TYPE).equals(TYPE_IMAGE)) + { + + NodeRef watermarkNodeRef = (NodeRef)params.get(PARAM_WATERMARK_IMAGE); + ContentReader watermarkContentReader = getReader(watermarkNodeRef); + destinationNode = this.imageAction(params, targetNodeRef, watermarkNodeRef, targetReader, watermarkContentReader); + + } + else if (params.get(PARAM_WATERMARK_TYPE) != null + && params.get(PARAM_WATERMARK_TYPE).equals(TYPE_TEXT)) + { + destinationNode = this.textAction(params, targetNodeRef, targetReader); + } + } + catch (AlfrescoRuntimeException e) + { + throw new AlfrescoRuntimeException(e.getMessage(), e); + } + + return destinationNode; + } + + @Override + public NodeRef splitPDF(NodeRef targetNodeRef, Map params) + { + PDDocument pdf = null; + InputStream is = null; + File tempDir = null; + ContentWriter writer = null; + NodeRef destinationFolder; + + try + { + destinationFolder = (NodeRef)params.get(PARAM_DESTINATION_FOLDER); + + ContentReader targetReader = getReader(targetNodeRef); + + // Get the split frequency + int splitFrequency = 0; + + String splitFrequencyString = params.get(PARAM_SPLIT_FREQUENCY).toString(); + if (!splitFrequencyString.equals("")) + { + splitFrequency = Integer.valueOf(splitFrequencyString); + } + + // Get contentReader inputStream + is = targetReader.getContentInputStream(); + // stream the document in + pdf = PDDocument.load(is); + // split the PDF and put the pages in a list + Splitter splitter = new Splitter(); + // if the default split is not every page, then set it to the right + // frequency + if (splitFrequency > 0) + { + splitter.setSplitAtPage(splitFrequency); + } + // Split the pages + List pdfs = splitter.split(pdf); + + // Lets get reading to walk the list + Iterator it = pdfs.iterator(); + + // Start page split numbering at + int page = 1; + int endPage = 0; + + // build a temp dir name based on the ID of the noderef we are + // importing + File alfTempDir = TempFileProvider.getTempDir(); + tempDir = new File(alfTempDir.getPath() + File.separatorChar + targetNodeRef.getId()); + tempDir.mkdir(); + + while (it.hasNext()) + { + // Get the split document and save it into the temp dir with new + // name + PDDocument splitpdf = (PDDocument)it.next(); + + int pagesInPDF = splitpdf.getNumberOfPages(); + + if (splitFrequency > 0) + { + endPage = endPage + pagesInPDF; + } + + // put together the name and save the PDF + String fileNameSansExt = getFilenameSansExt(targetNodeRef, FILE_EXTENSION); + splitpdf.save(tempDir + "" + File.separatorChar + fileNameSansExt + formatPageNumbering(page, endPage) + FILE_EXTENSION); + + // increment page count + if (splitFrequency > 0) + { + page = (page++) + pagesInPDF; + } + else + { + page++; + } + + try + { + splitpdf.close(); + } + catch (IOException e) + { + throw new AlfrescoRuntimeException(e.getMessage(), e); + } + + } + + for (File file : tempDir.listFiles()) + { + try + { + if (file.isFile()) + { + + // Get a writer and prep it for putting it back into the + // repo + NodeRef destinationNode = createDestinationNode(file.getName(), + destinationFolder, targetNodeRef, false); + writer = cs.getWriter(destinationNode, ContentModel.PROP_CONTENT, true); + + writer.setEncoding(targetReader.getEncoding()); // original + // encoding + writer.setMimetype(FILE_MIMETYPE); + + // Put it in the repo + writer.putContent(file); + + // Clean up + file.delete(); + } + } + catch (FileExistsException e) + { + throw new AlfrescoRuntimeException("Failed to process file.", e); + } + } + } + catch (IOException e) + { + throw new AlfrescoRuntimeException(e.getMessage(), e); + } + + finally + { + if (pdf != null) + { + try + { + pdf.close(); + } + catch (IOException e) + { + throw new AlfrescoRuntimeException(e.getMessage(), e); + } + } + if (is != null) + { + try + { + is.close(); + } + catch (IOException e) + { + throw new AlfrescoRuntimeException(e.getMessage(), e); + } + } + + if (tempDir != null) + { + tempDir.delete(); + } + } + + return destinationFolder; + } + + @Override + public NodeRef splitPDFAtPage(NodeRef targetNodeRef, Map params) + { + PDDocument pdf = null; + InputStream is = null; + File tempDir = null; + ContentWriter writer = null; + NodeRef destinationFolder; + + try + { + destinationFolder = (NodeRef)params.get(PARAM_DESTINATION_FOLDER); + ContentReader targetReader = getReader(targetNodeRef); + + // Get the split frequency + int splitPageNumber = 0; + + String splitPage = params.get(PARAM_PAGE).toString(); + if (!splitPage.equals("")) + { + try + { + splitPageNumber = Integer.valueOf(splitPage); + } + catch (NumberFormatException e) + { + throw new AlfrescoRuntimeException(e.getMessage(), e); + } + } + + // Get contentReader inputStream + is = targetReader.getContentInputStream(); + // stream the document in + pdf = PDDocument.load(is); + // split the PDF and put the pages in a list + Splitter splitter = new Splitter(); + // Need to adjust the input value to get the split at the right page + splitter.setSplitAtPage(splitPageNumber - 1); + + // Split the pages + List pdfs = splitter.split(pdf); + + // Start page split numbering at + int page = 1; + + // build a temp dir, name based on the ID of the noderef we are + // importing + File alfTempDir = TempFileProvider.getTempDir(); + tempDir = new File(alfTempDir.getPath() + File.separatorChar + targetNodeRef.getId()); + tempDir.mkdir(); + + // FLAG: This is ugly.....get the first PDF. + PDDocument firstPDF = (PDDocument)pdfs.remove(0); + + int pagesInFirstPDF = firstPDF.getNumberOfPages(); + + int lastPage = 0; + + if (pagesInFirstPDF > 1) + { + lastPage = pagesInFirstPDF; + } + + String fileNameSansExt = getFilenameSansExt(targetNodeRef, FILE_EXTENSION); + firstPDF.save(tempDir + "" + File.separatorChar + fileNameSansExt + formatPageNumbering(page, lastPage) + FILE_EXTENSION); + + try + { + firstPDF.close(); + } + catch (IOException e) + { + throw new AlfrescoRuntimeException(e.getMessage(), e); + } + + // FLAG: Like I said: "_UGLY_" ..... and it gets worse + PDDocument secondPDF = null; + + Iterator its = pdfs.iterator(); + + int pagesInSecondPDF = 0; + + while (its.hasNext()) + { + if (secondPDF != null) + { + // Get the split document and save it into the temp dir with + // new name + PDDocument splitpdf = (PDDocument)its.next(); + + int pagesInThisPDF = splitpdf.getNumberOfPages(); + pagesInSecondPDF = pagesInSecondPDF + pagesInThisPDF; + + PDFMergerUtility merger = new PDFMergerUtility(); + merger.appendDocument(secondPDF, splitpdf); + merger.mergeDocuments(); + + try + { + splitpdf.close(); + } + catch (IOException e) + { + throw new AlfrescoRuntimeException(e.getMessage(), e); + } + } + else + { + secondPDF = (PDDocument)its.next(); + pagesInSecondPDF = secondPDF.getNumberOfPages(); + } + } + + if (pagesInSecondPDF > 1) + { + lastPage = pagesInSecondPDF + pagesInFirstPDF; + } + else + { + lastPage = 0; + } + + // This is where we should save the appended PDF + // put together the name and save the PDF + secondPDF.save(tempDir + "" + File.separatorChar + fileNameSansExt + formatPageNumbering(splitPageNumber, lastPage) + FILE_EXTENSION); + + for (File file : tempDir.listFiles()) + { + try + { + if (file.isFile()) + { + // Get a writer and prep it for putting it back into the + // repo + NodeRef destinationNode = createDestinationNode(file.getName(), + destinationFolder, targetNodeRef, false); + writer = cs.getWriter(destinationNode, ContentModel.PROP_CONTENT, true); + + writer.setEncoding(targetReader.getEncoding()); // original + // encoding + writer.setMimetype(FILE_MIMETYPE); + + // Put it in the repo + writer.putContent(file); + + // Clean up + file.delete(); + } + } + catch (FileExistsException e) + { + throw new AlfrescoRuntimeException("Failed to process file.", e); + } + } + } + catch (IOException e) + { + throw new AlfrescoRuntimeException(e.getMessage(), e); + } + + finally + { + if (pdf != null) + { + try + { + pdf.close(); + } + catch (IOException e) + { + throw new AlfrescoRuntimeException(e.getMessage(), e); + } + } + if (is != null) + { + try + { + is.close(); + } + catch (IOException e) + { + throw new AlfrescoRuntimeException(e.getMessage(), e); + } + } + + if (tempDir != null) + { + tempDir.delete(); + } + } + return destinationFolder; + } + + @Override + public NodeRef insertPDF(NodeRef targetNodeRef, Map params) + { + PDDocument pdf = null; + PDDocument insertContentPDF = null; + InputStream is = null; + InputStream cis = null; + File tempDir = null; + ContentWriter writer = null; + NodeRef destinationNode = null; + + try + { + + ContentReader targetReader = getReader(targetNodeRef); + ContentReader insertReader = getReader((NodeRef)params.get(PARAM_INSERT_CONTENT)); + int insertAt = Integer.valueOf((String)params.get(PARAM_PAGE)).intValue(); + Boolean inplace = Boolean.valueOf(String.valueOf(params.get(PARAM_INPLACE))); + + // Get contentReader inputStream + is = targetReader.getContentInputStream(); + // Get insertContentReader inputStream + cis = insertReader.getContentInputStream(); + // stream the target document in + pdf = PDDocument.load(is); + // stream the insert content document in + insertContentPDF = PDDocument.load(cis); + + // split the PDF and put the pages in a list + Splitter splitter = new Splitter(); + + // Split the pages + List pdfs = splitter.split(pdf); + + // Build the output PDF + PDFMergerUtility merger = new PDFMergerUtility(); + + PDDocument newDocument = new PDDocument(); + + for (int i = 0; i < pdfs.size(); i++) { + + if (i == insertAt -1) { + merger.appendDocument(newDocument, insertContentPDF); + } + + merger.appendDocument(newDocument, (PDDocument)pdfs.get(i)); + } + + merger.setDestinationFileName(params.get(PARAM_DESTINATION_NAME).toString()); + merger.mergeDocuments(); + + // build a temp dir, name based on the ID of the noderef we are + // importing + File alfTempDir = TempFileProvider.getTempDir(); + tempDir = new File(alfTempDir.getPath() + File.separatorChar + targetNodeRef.getId()); + tempDir.mkdir(); + + String fileName = params.get(PARAM_DESTINATION_NAME).toString(); + + PDDocument completePDF = newDocument; + + completePDF.save(tempDir + "" + File.separatorChar + fileName + FILE_EXTENSION); + + try + { + completePDF.close(); + newDocument.close(); + } + catch (IOException e) + { + throw new AlfrescoRuntimeException(e.getMessage(), e); + } + + for (File file : tempDir.listFiles()) + { + try + { + if (file.isFile()) + { + + // Get a writer and prep it for putting it back into the + // repo + destinationNode = createDestinationNode(file.getName(), + (NodeRef)params.get(PARAM_DESTINATION_FOLDER), targetNodeRef, inplace); + writer = cs.getWriter(destinationNode, ContentModel.PROP_CONTENT, true); + + writer.setEncoding(targetReader.getEncoding()); // original + // encoding + writer.setMimetype(FILE_MIMETYPE); + + // Put it in the repo + writer.putContent(file); + + // Clean up + file.delete(); + } + } + catch (FileExistsException e) + { + throw new AlfrescoRuntimeException("Failed to process file.", e); + } + } + } + // TODO add better handling + catch (IOException e) + { + throw new AlfrescoRuntimeException(e.getMessage(), e); + } + + finally + { + if (pdf != null) + { + try + { + pdf.close(); + } + catch (IOException e) + { + throw new AlfrescoRuntimeException(e.getMessage(), e); + } + } + if (is != null) + { + try + { + is.close(); + } + catch (IOException e) + { + throw new AlfrescoRuntimeException(e.getMessage(), e); + } + } + + if (tempDir != null) + { + tempDir.delete(); + } + } + + return destinationNode; + } + + @Override + public NodeRef deletePagesFromPDF(NodeRef targetNodeRef, Map params) + { + String pages = String.valueOf(params.get(PARAM_PAGE)); + return subsetPDFDocument(targetNodeRef, params, pages, true); + } + + @Override + public NodeRef extractPagesFromPDF(NodeRef targetNodeRef, Map params) + { + String pages = String.valueOf(params.get(PARAM_PAGE)); + return subsetPDFDocument(targetNodeRef, params, pages, false); + } + + @Override + public NodeRef rotatePDF(NodeRef targetNodeRef, Map params) + { + InputStream is = null; + File tempDir = null; + ContentWriter writer = null; + PdfReader pdfReader = null; + NodeRef destinationNode = null; + + try + { + ContentReader targetReader = getReader(targetNodeRef); + is = targetReader.getContentInputStream(); + + File alfTempDir = TempFileProvider.getTempDir(); + tempDir = new File(alfTempDir.getPath() + File.separatorChar + targetNodeRef.getId()); + tempDir.mkdir(); + + Boolean inplace = Boolean.valueOf(String.valueOf(params.get(PARAM_INPLACE))); + Integer degrees = Integer.valueOf(String.valueOf(params.get(PARAM_DEGREES))); + String pages = String.valueOf(params.get(PARAM_PAGE)); + + if(degrees % 90 != 0) + { + throw new AlfrescoRuntimeException("Rotation degres must be a multiple of 90 (90, 180, 270, etc)"); + } + + String fileName = getFilename(params, targetNodeRef); + + File file = new File(tempDir, ffs.getFileInfo(targetNodeRef).getName()); + + pdfReader = new PdfReader(is); + PdfStamper stamp = new PdfStamper(pdfReader, new FileOutputStream(file)); + + int rotation = 0; + PdfDictionary pageDictionary; + int numPages = pdfReader.getNumberOfPages(); + for (int pageNum = 1; pageNum <= numPages; pageNum++) + { + // only apply stamp to requested pages + if (checkPage(pages, pageNum, numPages)) + { + rotation = pdfReader.getPageRotation(pageNum); + pageDictionary = pdfReader.getPageN(pageNum); + pageDictionary.put(PdfName.ROTATE, new PdfNumber(rotation + degrees)); + } + } + + stamp.close(); + pdfReader.close(); + + destinationNode = createDestinationNode(fileName, + (NodeRef)params.get(PARAM_DESTINATION_FOLDER), targetNodeRef, inplace); + writer = cs.getWriter(destinationNode, ContentModel.PROP_CONTENT, true); + + writer.setEncoding(targetReader.getEncoding()); + writer.setMimetype(FILE_MIMETYPE); + + // Put it in the repository + writer.putContent(file); + + // Clean up + file.delete(); + + } + catch (IOException e) + { + throw new AlfrescoRuntimeException(e.getMessage(), e); + } + catch (DocumentException e) + { + throw new AlfrescoRuntimeException(e.getMessage(), e); + } + catch (Exception e) + { + throw new AlfrescoRuntimeException(e.getMessage(), e); + } + finally + { + if (pdfReader != null) + { + pdfReader.close(); + } + if (is != null) + { + try + { + is.close(); + } + catch (IOException e) + { + throw new AlfrescoRuntimeException(e.getMessage(), e); + } + } + + if (tempDir != null) + { + tempDir.delete(); + } + } + return destinationNode; + } + + private NodeRef subsetPDFDocument(NodeRef targetNodeRef, Map params, String pages, boolean delete) + { + InputStream is = null; + File tempDir = null; + ContentWriter writer = null; + PdfReader pdfReader = null; + NodeRef destinationNode = null; + + try + { + ContentReader targetReader = getReader(targetNodeRef); + is = targetReader.getContentInputStream(); + + File alfTempDir = TempFileProvider.getTempDir(); + tempDir = new File(alfTempDir.getPath() + File.separatorChar + targetNodeRef.getId()); + tempDir.mkdir(); + + Boolean inplace = Boolean.valueOf(String.valueOf(params.get(PARAM_INPLACE))); + + String fileName = getFilename(params, targetNodeRef); + + File file = new File(tempDir, ffs.getFileInfo(targetNodeRef).getName()); + + pdfReader = new PdfReader(is); + Document doc = new Document(pdfReader.getPageSizeWithRotation(1)); + PdfCopy copy = new PdfCopy(doc, new FileOutputStream(file)); + doc.open(); + + List pagelist = parsePageList(pages); + + for (int pageNum = 1; pageNum <= pdfReader.getNumberOfPages(); pageNum++) + { + if (pagelist.contains(pageNum) && !delete) + { + copy.addPage(copy.getImportedPage(pdfReader, pageNum)); + } + else if (!pagelist.contains(pageNum) && delete) + { + copy.addPage(copy.getImportedPage(pdfReader, pageNum)); + } + } + doc.close(); + + destinationNode = createDestinationNode(fileName, + (NodeRef)params.get(PARAM_DESTINATION_FOLDER), targetNodeRef, inplace); + writer = cs.getWriter(destinationNode, ContentModel.PROP_CONTENT, true); + + writer.setEncoding(targetReader.getEncoding()); + writer.setMimetype(FILE_MIMETYPE); + + // Put it in the repository + writer.putContent(file); + + // Clean up + file.delete(); + + } + catch (IOException e) + { + throw new AlfrescoRuntimeException(e.getMessage(), e); + } + catch (DocumentException e) + { + throw new AlfrescoRuntimeException(e.getMessage(), e); + } + catch (Exception e) + { + throw new AlfrescoRuntimeException(e.getMessage(), e); + } + finally + { + if (pdfReader != null) + { + pdfReader.close(); + } + if (is != null) + { + try + { + is.close(); + } + catch (IOException e) + { + throw new AlfrescoRuntimeException(e.getMessage(), e); + } + } + + if (tempDir != null) + { + tempDir.delete(); + } + } + return destinationNode; + } + + private ContentReader getReader(NodeRef nodeRef) + { + // first, make sure the node exists + if (ns.exists(nodeRef) == false) + { + // node doesn't exist - can't do anything + throw new AlfrescoRuntimeException("NodeRef: " + nodeRef + " does not exist"); + } + + // Next check that the node is a sub-type of content + QName typeQName = ns.getType(nodeRef); + if (ds.isSubClass(typeQName, ContentModel.TYPE_CONTENT) == false) + { + // it is not content, so can't transform + throw new AlfrescoRuntimeException("The selected node is not a content node"); + } + + // Get the content reader. If it is null, can't do anything here + ContentReader contentReader = cs.getReader(nodeRef, ContentModel.PROP_CONTENT); + + if(contentReader == null) + { + throw new AlfrescoRuntimeException("The content reader for NodeRef: " + nodeRef + "is null"); + } + + return contentReader; + } + + /** + * @param ruleAction + * @param filename + * @return + */ + private NodeRef createDestinationNode(String filename, NodeRef destinationParent, NodeRef target, boolean inplace) + { + + NodeRef destinationNode; + + // if inplace mode is turned on, the destination for the modified content + // is the original node + if(inplace) + { + return target; + } + + if(createNew) + { + //create a file in the right location + FileInfo fileInfo = ffs.create(destinationParent, filename, ContentModel.TYPE_CONTENT); + destinationNode = fileInfo.getNodeRef(); + } + else + { + try + { + FileInfo fileInfo = ffs.copy(target, destinationParent, filename); + destinationNode = fileInfo.getNodeRef(); + } + catch(FileNotFoundException fnf) + { + throw new AlfrescoRuntimeException(fnf.getMessage(), fnf); + } + } + + return destinationNode; + } + + private int getInteger(Serializable val) + { + if(val == null) + { + return 0; + } + try + { + return Integer.parseInt(val.toString()); + } + catch(NumberFormatException nfe) + { + return 0; + } + } + + private File getTempFile(NodeRef nodeRef) + { + File alfTempDir = TempFileProvider.getTempDir(); + File toolkitTempDir = new File(alfTempDir.getPath() + File.separatorChar + nodeRef.getId()); + toolkitTempDir.mkdir(); + File file = new File(toolkitTempDir, ffs.getFileInfo(nodeRef).getName()); + + return file; + } + + private String getFilename(Map params, NodeRef targetNodeRef) + { + Serializable providedName = params.get(PARAM_DESTINATION_NAME); + String fileName = null; + if(providedName != null) + { + fileName = String.valueOf(providedName); + if(!fileName.endsWith(FILE_EXTENSION)) + { + fileName = fileName + FILE_EXTENSION; + } + } + else + { + fileName = String.valueOf(ns.getProperty(targetNodeRef, ContentModel.PROP_NAME)); + } + return fileName; + } + + /** + * Parses the list of pages or page ranges to delete and returns a list of page numbers + * + * @param list + * @return + */ + private List parsePageList(String list) + { + List pages = new ArrayList(); + String[] tokens = list.split(","); + for(String token : tokens) + { + //parse each, if one is not an int, log it but keep going + try + { + pages.add(Integer.parseInt(token)); + } + catch(NumberFormatException nfe) + { + logger.warn("Page list contains non-numeric values"); + } + } + return pages; + } + + /** + * Build the permissions mask for iText + * + * @param options + * @return + */ + private int buildPermissionMask(Map options) + { + int permissions = 0; + + if ((Boolean)options.get(PARAM_ALLOW_PRINT)) + { + permissions = permissions | PdfWriter.ALLOW_PRINTING; + } + if ((Boolean)options.get(PARAM_ALLOW_COPY)) + { + permissions = permissions | PdfWriter.ALLOW_COPY; + } + if ((Boolean)options.get(PARAM_ALLOW_CONTENT_MODIFICATION)) + { + permissions = permissions | PdfWriter.ALLOW_MODIFY_CONTENTS; + } + if ((Boolean)options.get(PARAM_ALLOW_ANNOTATION_MODIFICATION)) + { + permissions = permissions | PdfWriter.ALLOW_MODIFY_ANNOTATIONS; + } + if ((Boolean)options.get(PARAM_ALLOW_SCREEN_READER)) + { + permissions = permissions | PdfWriter.ALLOW_SCREENREADERS; + } + if ((Boolean)options.get(PARAM_ALLOW_DEGRADED_PRINT)) + { + permissions = permissions | PdfWriter.ALLOW_DEGRADED_PRINTING; + } + if ((Boolean)options.get(PARAM_ALLOW_ASSEMBLY)) + { + permissions = permissions | PdfWriter.ALLOW_ASSEMBLY; + } + if ((Boolean)options.get(PARAM_ALLOW_FORM_FILL)) + { + permissions = permissions | PdfWriter.ALLOW_FILL_IN; + } + + return permissions; + } + + /** + * Create a rectangle for the visible signature using the selected position and signature size + * + * @param position + * @param width + * @param height + * @return + */ + private Rectangle positionSignature(String position, Rectangle pageRect, int width, int height) + { + + float pageHeight = pageRect.getHeight(); + float pageWidth = pageRect.getWidth(); + + Rectangle r = null; + + if (position.equals(POSITION_BOTTOMLEFT)) + { + r = new Rectangle(0, height, width, 0); + } + else if (position.equals(POSITION_BOTTOMRIGHT)) + { + r = new Rectangle(pageWidth - width, height, pageWidth, 0); + } + else if (position.equals(POSITION_TOPLEFT)) + { + r = new Rectangle(0, pageHeight, width, pageHeight - height); + } + else if (position.equals(POSITION_TOPRIGHT)) + { + r = new Rectangle(pageWidth - width, pageHeight, pageWidth, pageHeight - height); + } + else if (position.equals(POSITION_CENTER)) + { + r = new Rectangle((pageWidth / 2) - (width / 2), (pageHeight / 2) - (height / 2), + (pageWidth / 2) + (width / 2), (pageHeight / 2) + (height / 2)); + } + + return r; + } + + /** + * @param fileName + * @param extension + * @return + */ + private String removeExtension(String fileName, String extension) + { + // Does the file have the extension? + if (fileName != null && fileName.contains(extension)) + { + // Where does the extension start? + int extensionStartsAt = fileName.indexOf(extension); + // Get the Filename sans the extension + return fileName.substring(0, extensionStartsAt); + } + + return fileName; + } + + private String getFilename(NodeRef targetNodeRef) + { + FileInfo fileInfo = ffs.getFileInfo(targetNodeRef); + String filename = fileInfo.getName(); + + return filename; + } + + private String getFilenameSansExt(NodeRef targetNodeRef, String extension) + { + String filenameSansExt; + filenameSansExt = removeExtension(getFilename(targetNodeRef), extension); + + return filenameSansExt; + } + + /** + * Applies an image watermark + * + * @param reader + * @param writer + * @param options + * @throws Exception + */ + private NodeRef imageAction(Map options, NodeRef targetNodeRef, NodeRef watermarkNodeRef, + ContentReader actionedUponContentReader, ContentReader watermarkContentReader) + { + + PdfStamper stamp = null; + File tempDir = null; + ContentWriter writer = null; + NodeRef destinationNode = null; + + try + { + File file = getTempFile(targetNodeRef); + + // get the PDF input stream and create a reader for iText + PdfReader reader = new PdfReader(actionedUponContentReader.getContentInputStream()); + stamp = new PdfStamper(reader, new FileOutputStream(file)); + PdfContentByte pcb; + + // get a com.itextpdf.text.Image object via java.imageio.ImageIO + Image img = Image.getInstance(ImageIO.read(watermarkContentReader.getContentInputStream()), null); + + // get the PDF pages and position + String pages = (String)options.get(PARAM_PAGE); + String position = (String)options.get(PARAM_POSITION); + String depth = (String)options.get(PARAM_WATERMARK_DEPTH); + Boolean inplace = Boolean.valueOf(String.valueOf(options.get(PARAM_INPLACE))); + + // get the manual positioning options (if provided) + int locationX = getInteger(options.get(PARAM_LOCATION_X)); + int locationY = getInteger(options.get(PARAM_LOCATION_Y)); + + // image requires absolute positioning or an exception will be + // thrown + // set image position according to parameter. Use + // PdfReader.getPageSizeWithRotation + // to get the canvas size for alignment. + img.setAbsolutePosition(100f, 100f); + + // stamp each page + int numpages = reader.getNumberOfPages(); + for (int i = 1; i <= numpages; i++) + { + Rectangle r = reader.getPageSizeWithRotation(i); + // set stamp position + if (position.equals(POSITION_BOTTOMLEFT)) + { + img.setAbsolutePosition(0, 0); + } + else if (position.equals(POSITION_BOTTOMRIGHT)) + { + img.setAbsolutePosition(r.getWidth() - img.getWidth(), 0); + } + else if (position.equals(POSITION_TOPLEFT)) + { + img.setAbsolutePosition(0, r.getHeight() - img.getHeight()); + } + else if (position.equals(POSITION_TOPRIGHT)) + { + img.setAbsolutePosition(r.getWidth() - img.getWidth(), r.getHeight() - img.getHeight()); + } + else if (position.equals(POSITION_CENTER)) + { + img.setAbsolutePosition(getCenterX(r, img), getCenterY(r, img)); + } + else if (position.equals(POSITION_MANUAL)) + { + img.setAbsolutePosition(locationX, locationY); + } + + // if this is an under-text stamp, use getUnderContent. + // if this is an over-text stamp, usse getOverContent. + if (depth.equals(DEPTH_OVER)) + { + pcb = stamp.getOverContent(i); + } + else + { + pcb = stamp.getUnderContent(i); + } + + // only apply stamp to requested pages + if (checkPage(pages, i, numpages)) + { + pcb.addImage(img); + } + } + + stamp.close(); + + String fileName = getFilename(options, targetNodeRef); + + // Get a writer and prep it for putting it back into the repo + //can't use BasePDFActionExecuter.getWriter here need the nodeRef of the destination + destinationNode = createDestinationNode(fileName, + (NodeRef)options.get(PARAM_DESTINATION_FOLDER), targetNodeRef, inplace); + writer = cs.getWriter(destinationNode, ContentModel.PROP_CONTENT, true); + + writer.setEncoding(actionedUponContentReader.getEncoding()); + writer.setMimetype(FILE_MIMETYPE); + + // Put it in the repo + writer.putContent(file); + + // delete the temp file + file.delete(); + } + catch (IOException e) + { + throw new AlfrescoRuntimeException(e.getMessage(), e); + } + catch (DocumentException e) + { + throw new AlfrescoRuntimeException(e.getMessage(), e); + } + finally + { + if (tempDir != null) + { + try + { + tempDir.delete(); + } + catch (Exception ex) + { + throw new AlfrescoRuntimeException(ex.getMessage(), ex); + } + } + + if (stamp != null) + { + try + { + stamp.close(); + } + catch (Exception ex) + { + throw new AlfrescoRuntimeException(ex.getMessage(), ex); + } + } + } + + return destinationNode; + } + + + /** + * Applies a text watermark (current date, user name, etc, depending on + * options) + * + * @param reader + * @param writer + * @param options + */ + private NodeRef textAction(Map options, NodeRef targetNodeRef, ContentReader actionedUponContentReader) + { + + PdfStamper stamp = null; + File tempDir = null; + ContentWriter writer = null; + String watermarkText; + StringTokenizer st; + Vector tokens = new Vector(); + NodeRef destinationNode = null; + + try + { + File file = getTempFile(targetNodeRef); + + // get the PDF input stream and create a reader for iText + PdfReader reader = new PdfReader(actionedUponContentReader.getContentInputStream()); + stamp = new PdfStamper(reader, new FileOutputStream(file)); + PdfContentByte pcb; + + // get the PDF pages and position + String pages = (String)options.get(PARAM_PAGE); + String position = (String)options.get(PARAM_POSITION); + String depth = (String)options.get(PARAM_WATERMARK_DEPTH); + int locationX = getInteger(options.get(PARAM_LOCATION_X)); + int locationY = getInteger(options.get(PARAM_LOCATION_Y)); + Boolean inplace = Boolean.valueOf(String.valueOf(options.get(PARAM_INPLACE))); + + // create the base font for the text stamp + BaseFont bf = BaseFont.createFont((String)options.get(PARAM_WATERMARK_FONT), BaseFont.CP1250, BaseFont.EMBEDDED); + + // get watermark text and process template with model + String templateText = (String)options.get(PARAM_WATERMARK_TEXT); + Map model = buildWatermarkTemplateModel(targetNodeRef); + StringWriter watermarkWriter = new StringWriter(); + freemarkerProcessor.processString(templateText, model, watermarkWriter); + watermarkText = watermarkWriter.getBuffer().toString(); + + // tokenize watermark text to support multiple lines and copy tokens + // to vector for re-use + st = new StringTokenizer(watermarkText, "\r\n", false); + while (st.hasMoreTokens()) + { + tokens.add(st.nextToken()); + } + + // stamp each page + int numpages = reader.getNumberOfPages(); + for (int i = 1; i <= numpages; i++) + { + Rectangle r = reader.getPageSizeWithRotation(i); + + // if this is an under-text stamp, use getUnderContent. + // if this is an over-text stamp, use getOverContent. + if (depth.equals(DEPTH_OVER)) + { + pcb = stamp.getOverContent(i); + } + else + { + pcb = stamp.getUnderContent(i); + } + + // set the font and size + float size = Float.parseFloat((String)options.get(PARAM_WATERMARK_SIZE)); + pcb.setFontAndSize(bf, size); + + // only apply stamp to requested pages + if (checkPage(pages, i, numpages)) + { + writeAlignedText(pcb, r, tokens, size, position, locationX, locationY); + } + } + + stamp.close(); + + String fileName = getFilename(options, targetNodeRef); + + // Get a writer and prep it for putting it back into the repo + //can't use BasePDFActionExecuter.getWriter here need the nodeRef of the destination + destinationNode = createDestinationNode(fileName, + (NodeRef)options.get(PARAM_DESTINATION_FOLDER), targetNodeRef, inplace); + writer = cs.getWriter(destinationNode, ContentModel.PROP_CONTENT, true); + writer.setEncoding(actionedUponContentReader.getEncoding()); + writer.setMimetype(FILE_MIMETYPE); + + // Put it in the repo + writer.putContent(file); + + // delete the temp file + file.delete(); + } + catch (IOException e) + { + throw new AlfrescoRuntimeException(e.getMessage(), e); + } + catch (DocumentException e) + { + throw new AlfrescoRuntimeException(e.getMessage(), e); + } + finally + { + if (tempDir != null) + { + try + { + tempDir.delete(); + } + catch (Exception ex) + { + throw new AlfrescoRuntimeException(ex.getMessage(), ex); + } + } + + if (stamp != null) + { + try + { + stamp.close(); + } + catch (Exception ex) + { + throw new AlfrescoRuntimeException(ex.getMessage(), ex); + } + } + } + + return destinationNode; + } + + + /** + * Writes text watermark to one of the 5 preconfigured locations + * + * @param pcb + * @param r + * @param tokens + * @param size + * @param position + */ + private void writeAlignedText(PdfContentByte pcb, Rectangle r, Vector tokens, float size, + String position, int locationX, int locationY) + { + // get the dimensions of our 'rectangle' for text + float height = size * tokens.size(); + float width = 0; + float centerX = 0, startY = 0; + for (int i = 0; i < tokens.size(); i++) + { + if (pcb.getEffectiveStringWidth(tokens.get(i), false) > width) + { + width = pcb.getEffectiveStringWidth(tokens.get(i), false); + } + } + + // now that we have the width and height, we can calculate the center + // position for + // the rectangle that will contain our text. + if (position.equals(POSITION_BOTTOMLEFT)) + { + centerX = width / 2 + PAD; + startY = 0 + PAD + height; + } + else if (position.equals(POSITION_BOTTOMRIGHT)) + { + centerX = r.getWidth() - (width / 2) - PAD; + startY = 0 + PAD + height; + } + else if (position.equals(POSITION_TOPLEFT)) + { + centerX = width / 2 + PAD; + startY = r.getHeight() - (PAD * 2); + } + else if (position.equals(POSITION_TOPRIGHT)) + { + centerX = r.getWidth() - (width / 2) - PAD; + startY = r.getHeight() - (PAD * 2); + } + else if (position.equals(POSITION_CENTER)) + { + centerX = r.getWidth() / 2; + startY = (r.getHeight() / 2) + (height / 2); + } + else if (position.equals(POSITION_MANUAL)) + { + centerX = r.getWidth() / 2 - locationX; + startY = locationY; + } + + // apply text to PDF + pcb.beginText(); + + for (int t = 0; t < tokens.size(); t++) + { + pcb.showTextAligned(PdfContentByte.ALIGN_CENTER, tokens.get(t), centerX, startY - (size * t), 0); + } + + pcb.endText(); + + } + + /** + * Builds a freemarker model which supports a subset of the default model. + * + * @param ref + * @return + */ + private Map buildWatermarkTemplateModel(NodeRef ref) + { + Map model = new HashMap(); + + NodeRef person = ps.getPerson(as.getCurrentUserName()); + model.put("person", new TemplateNode(person, serviceRegistry, null)); + NodeRef homespace = (NodeRef)ns.getProperty(person, ContentModel.PROP_HOMEFOLDER); + model.put("userhome", new TemplateNode(homespace, serviceRegistry, null)); + model.put("document", new TemplateNode(ref, serviceRegistry, null)); + NodeRef parent = ns.getPrimaryParent(ref).getParentRef(); + model.put("space", new TemplateNode(parent, serviceRegistry, null)); + model.put("date", new Date()); + + //also add all of the node properties to the model + model.put("properties", ns.getProperties(ref)); + + return model; + } + + /** + * Determines whether or not a watermark should be applied to a given page + * + * @param pages + * @param current + * @param numpages + * @return + */ + private boolean checkPage(String pages, int current, int numpages) + { + + + boolean markPage = false; + + if (pages.equals(PAGE_EVEN)) + { + if (current % 2 == 0) + { + markPage = true; + } + } + else if (pages.equals(PAGE_ODD)) + { + if (current % 2 != 0) + { + markPage = true; + } + } + else if (pages.equals(PAGE_FIRST)) + { + if (current == 1) + { + markPage = true; + } + } + else if (pages.equals(PAGE_LAST)) + { + if (current == numpages) + { + markPage = true; + } + } + else if (pages.equals(PAGE_ALL)) + { + markPage = true; + } + else + { + // if we get here, a scheme wasn't selected, so we can treat this like a page list + List pageList = parsePageList(pages); + if(pageList.contains(current)) + { + markPage = true; + } + } + + return markPage; + } + + /** + * Gets the X value for centering the watermark image + * + * @param r + * @param img + * @return + */ + private float getCenterX(Rectangle r, Image img) + { + float x = 0; + float pdfwidth = r.getWidth(); + float imgwidth = img.getWidth(); + + x = (pdfwidth - imgwidth) / 2; + + return x; + } + + /** + * Gets the Y value for centering the watermark image + * + * @param r + * @param img + * @return + */ + private float getCenterY(Rectangle r, Image img) + { + float y = 0; + float pdfheight = r.getHeight(); + float imgheight = img.getHeight(); + + y = (pdfheight - imgheight) / 2; + + return y; + } + + /** + * Format the page numbers according to the localized string in messages + * + * @param currentPage + * @param lastPage + * @return + */ + private String formatPageNumbering(int currentPage, int lastPage) + { + String text = ""; + if (lastPage==0) + { + text = I18NUtil.getMessage(MSGID_PAGE_NUMBERING_PATTERN_SINGLE, new Object[]{currentPage}); + } + else + { + text = I18NUtil.getMessage(MSGID_PAGE_NUMBERING_PATTERN_MULTIPLE, new Object[]{currentPage, lastPage}); + } + return text; + } + + /** + * @param serviceRegistry + */ + public void setServiceRegistry(ServiceRegistry serviceRegistry) + { + this.serviceRegistry = serviceRegistry; + ns = serviceRegistry.getNodeService(); + cs = serviceRegistry.getContentService(); + ffs = serviceRegistry.getFileFolderService(); + ds = serviceRegistry.getDictionaryService(); + ps = serviceRegistry.getPersonService(); + as = serviceRegistry.getAuthenticationService(); + } + + /** + * Sets whether a PDF action creates a new empty node or copies the source node, preserving + * the content type, applied aspects and properties + * + * @param createNew + */ + public void setCreateNew(boolean createNew) + { + this.createNew = createNew; + } + + public void setUseSignatureAspect(boolean useSignatureAspect) + { + this.useSignatureAspect = useSignatureAspect; + } + + public void setUseEncryptionAspect(boolean useEncryptionAspect) + { + this.useEncryptionAspect = useEncryptionAspect; + } +} diff --git a/pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/transformer/ITextTransformerTIFFToPDF.java b/pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/transformer/ITextTransformerTIFFToPDF.java new file mode 100644 index 0000000..5e47b72 --- /dev/null +++ b/pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/transformer/ITextTransformerTIFFToPDF.java @@ -0,0 +1,83 @@ +package org.alfresco.extension.pdftoolkit.transformer; + +import java.io.ByteArrayOutputStream; +import java.io.OutputStream; + +import org.alfresco.repo.content.MimetypeMap; +import org.alfresco.repo.content.transform.AbstractContentTransformer2; +import org.alfresco.service.cmr.repository.ContentReader; +import org.alfresco.service.cmr.repository.ContentWriter; +import org.alfresco.service.cmr.repository.TransformationOptions; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import com.itextpdf.text.Document; +import com.itextpdf.text.Image; +import com.itextpdf.text.PageSize; +import com.itextpdf.text.pdf.PdfWriter; +import com.itextpdf.text.pdf.RandomAccessFileOrArray; +import com.itextpdf.text.pdf.codec.TiffImage; + +public class ITextTransformerTIFFToPDF extends AbstractContentTransformer2 { + + public static final String MIMETYPE_IMAGE_TIFF = "image/tiff"; + private static final Log logger = LogFactory.getLog(ITextTransformerTIFFToPDF.class); + + @Override + public boolean isTransformable(String sourceMimetype, String targetMimetype, + TransformationOptions options) { + + //This transformer only supports image/tiff -> PDF transformations + if (!MIMETYPE_IMAGE_TIFF.equals(sourceMimetype) || !MimetypeMap.MIMETYPE_PDF.equals(targetMimetype)) + { + return false; + } + else + { + return true; + } + } + + @Override + /** + * This is a VERY basic transformer. Still a lot to do, such as: + * + * proper scaling + * landscape vs portrait + * multipage tiff + */ + protected void transformInternal(ContentReader contentReader, ContentWriter contentWriter, TransformationOptions options) + throws Exception + { + + //get an output stream for the PDF writer + OutputStream out = contentWriter.getContentOutputStream(); + + //create a byte array to hold the image data + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + + //set up a pdf document and writer + Document doc = new Document(PageSize.A4); + PdfWriter pdfWriter = PdfWriter.getInstance(doc, out); + pdfWriter.setStrictImageSequence(true); + + + //iText Image needs the byte array for the tiff, could be big + contentReader.getContent(baos); + + //open the doc and add the image + doc.open(); + Image tiff = null; + RandomAccessFileOrArray randomAccessFile = new RandomAccessFileOrArray(baos.toByteArray()); + int pages = TiffImage.getNumberOfPages(randomAccessFile); + for (int i = 1; i <= pages; i++) { + tiff = TiffImage.getTiffImage(randomAccessFile, i); + tiff.scaleToFit(PageSize.A4.getWidth(), PageSize.A4.getHeight()); + tiff.setAbsolutePosition(0, 0); + doc.add(tiff); + doc.newPage(); + } + doc.close(); + out.flush(); + } +} diff --git a/pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/transformer/ITextTransformerTextToPDF.java b/pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/transformer/ITextTransformerTextToPDF.java new file mode 100644 index 0000000..a9e927d --- /dev/null +++ b/pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/transformer/ITextTransformerTextToPDF.java @@ -0,0 +1,167 @@ +/* + * Copyright 2008-2012 Alfresco Software Limited. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + * + * This file is part of an unsupported extension to Alfresco. + */ + +package org.alfresco.extension.pdftoolkit.transformer; + + +import java.io.BufferedReader; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.nio.charset.Charset; + +import org.alfresco.repo.content.MimetypeMap; +import org.alfresco.repo.content.transform.AbstractContentTransformer2; +import org.alfresco.service.cmr.repository.ContentReader; +import org.alfresco.service.cmr.repository.ContentWriter; +import org.alfresco.service.cmr.repository.TransformationOptions; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import com.itextpdf.text.Document; +import com.itextpdf.text.Paragraph; +import com.itextpdf.text.pdf.PdfWriter; + + +/** + * This class is a transformer from Plain Text to PDF, powered by iText + * + * @author Nick Burch + */ +public class ITextTransformerTextToPDF + extends AbstractContentTransformer2 +{ + private static final Log logger = LogFactory.getLog(ITextTransformerTextToPDF.class); + + + /** + * Only supports Text to PDF + */ + public boolean isTransformable(String sourceMimetype, String targetMimetype, TransformationOptions options) + { + if ((!MimetypeMap.MIMETYPE_TEXT_PLAIN.equals(sourceMimetype) && !MimetypeMap.MIMETYPE_TEXT_CSV.equals(sourceMimetype) && !MimetypeMap.MIMETYPE_XML.equals(sourceMimetype)) + || !MimetypeMap.MIMETYPE_PDF.equals(targetMimetype)) + { + // only support (text/plain OR text/csv OR text/xml) to + // (application/pdf) + return false; + } + else + { + return true; + } + } + + + /** + * Do the transformation + */ + @Override + protected void transformInternal(ContentReader contentReader, ContentWriter contentWriter, TransformationOptions options) + throws Exception + { + Document document = null; + BufferedReader reader = null; + + try + { + // iText Setup + document = new Document(); + PdfWriter.getInstance(document, contentWriter.getContentOutputStream()); + document.open(); + + // Reader setup + reader = new BufferedReader(buildReader(contentReader)); + + // Process + String line; + while ((line = reader.readLine()) != null) + { + if (line.length() == 0) + { + // Blank line + document.add(new Paragraph(" ")); + } + else + { + // Paragraph text + document.add(new Paragraph(line)); + } + } + } + finally + { + if (document != null) + { + try + { + document.close(); + } + catch (Throwable e) + { + e.printStackTrace(); + } + } + if (reader != null) + { + try + { + reader.close(); + } + catch (Throwable e) + { + e.printStackTrace(); + } + } + } + } + + + /** + * Builds an InputStreamReader for the given Content Reader + */ + protected InputStreamReader buildReader(ContentReader reader) + { + // Grab the underlying stream + InputStream inp = reader.getContentInputStream(); + String node = reader.getContentUrl(); + + // If the file has an encoding, try to use it + String encoding = reader.getEncoding(); + if (encoding != null) + { + Charset charset = null; + try + { + charset = Charset.forName(encoding); + } + catch (Exception e) + { + logger.warn("JVM doesn't understand encoding '" + encoding + "' when transforming " + node); + } + if (charset != null) + { + logger.debug("Processing plain text in encoding " + charset.displayName()); + return new InputStreamReader(inp, charset); + } + } + + // Fall back on the system default + logger.debug("Processing plain text using system default encoding"); + return new InputStreamReader(inp); + } +} diff --git a/pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/webscripts/GetPageCount.java b/pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/webscripts/GetPageCount.java new file mode 100644 index 0000000..fe2ec74 --- /dev/null +++ b/pdf-toolkit-platform/src/main/java/org/alfresco/extension/pdftoolkit/webscripts/GetPageCount.java @@ -0,0 +1,53 @@ +package org.alfresco.extension.pdftoolkit.webscripts; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +import org.alfresco.model.ContentModel; +import org.alfresco.service.ServiceRegistry; +import org.alfresco.service.cmr.repository.ContentReader; +import org.alfresco.service.cmr.repository.NodeRef; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.DeclarativeWebScript; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptRequest; + +import com.itextpdf.text.pdf.PdfReader; + +public class GetPageCount extends DeclarativeWebScript +{ + private ServiceRegistry serviceRegistry; + private int count = -1; + private static final Log logger = LogFactory.getLog(GetPageCount.class); + + + public Map executeImpl(WebScriptRequest req, Status status, Cache cache) + { + String nodeRef = req.getParameter("nodeRef"); + Map model = new HashMap(); + + try + { + ContentReader reader = serviceRegistry + .getContentService().getReader(new NodeRef(nodeRef), ContentModel.PROP_CONTENT); + PdfReader pdfReader = new PdfReader(reader.getContentInputStream()); + count = pdfReader.getNumberOfPages(); + pdfReader.close(); + } + catch(IOException ioex) + { + logger.error("Error fetching page count for document: " + ioex); + } + + model.put("pageCount", count); + return model; + } + + public void setServiceRegistry(ServiceRegistry serviceRegistry) + { + this.serviceRegistry = serviceRegistry; + } +} diff --git a/pdf-toolkit-platform/src/main/resources/META-INF/resources/test.html b/pdf-toolkit-platform/src/main/resources/META-INF/resources/test.html new file mode 100644 index 0000000..29bc9b4 --- /dev/null +++ b/pdf-toolkit-platform/src/main/resources/META-INF/resources/test.html @@ -0,0 +1 @@ +Test 123 \ No newline at end of file diff --git a/pdf-toolkit-platform/src/main/resources/alfresco/extension/pdftoolkit/web/bean/actions/handlers/pdfappend-messages.properties b/pdf-toolkit-platform/src/main/resources/alfresco/extension/pdftoolkit/web/bean/actions/handlers/pdfappend-messages.properties new file mode 100644 index 0000000..b8291db --- /dev/null +++ b/pdf-toolkit-platform/src/main/resources/alfresco/extension/pdftoolkit/web/bean/actions/handlers/pdfappend-messages.properties @@ -0,0 +1,8 @@ +#PDF Append strings +pdf-append.title=Merge PDF +pdf-append.description=append PDF to another PDF +pdf-append.target-node.display-label=Append to +pdf-append.destination-folder.display-label=Destination folder +pdf-append.destination-name.display-label=Destination name +pdf-append.executeAsynchronously.display-label=Run in background +pdf-append.inplace.display-label=Execute in place \ No newline at end of file diff --git a/pdf-toolkit-platform/src/main/resources/alfresco/extension/pdftoolkit/web/bean/actions/handlers/pdfdelete-messages.properties b/pdf-toolkit-platform/src/main/resources/alfresco/extension/pdftoolkit/web/bean/actions/handlers/pdfdelete-messages.properties new file mode 100644 index 0000000..66404e9 --- /dev/null +++ b/pdf-toolkit-platform/src/main/resources/alfresco/extension/pdftoolkit/web/bean/actions/handlers/pdfdelete-messages.properties @@ -0,0 +1,7 @@ +pdf-delete-page.title=Delete PDF pages +pdf-delete-page.description=delete pages from a PDF document +pdf-delete-page.delete-pages.display-label=Pages to delete (comma separated) +pdf-delete-page.destination-folder.display-label=Destination folder +pdf-delete-page.destination-name.display-label=Destination name +pdf-delete-page.executeAsynchronously.display-label=Run in background +pdf-delete-page.inplace.display-label=Execute in place \ No newline at end of file diff --git a/pdf-toolkit-platform/src/main/resources/alfresco/extension/pdftoolkit/web/bean/actions/handlers/pdfencryption-messages.properties b/pdf-toolkit-platform/src/main/resources/alfresco/extension/pdftoolkit/web/bean/actions/handlers/pdfencryption-messages.properties new file mode 100644 index 0000000..ca72a26 --- /dev/null +++ b/pdf-toolkit-platform/src/main/resources/alfresco/extension/pdftoolkit/web/bean/actions/handlers/pdfencryption-messages.properties @@ -0,0 +1,17 @@ +pdf-encryption.title=Encrypt PDF +pdf-encryption.description=Encrypt PDF document and set permissions +pdf-encryption.destination-folder.display-label=Destination folder +pdf-encryption.user-password.display-label=User password +pdf-encryption.owner-password.display-label=Owner password +pdf-encryption.allow-print.display-label=Allow print +pdf-encryption.allow-copy.display-label=Allow copy +pdf-encryption.allow-content-modification.display-label=Allow content modification +pdf-encryption.allow-annotation-modification.display-label=Allow annotation modification +pdf-encryption.allow-form-fill.display-label=Allow form fill +pdf-encryption.allow-screen-reader.display-label=Allow screen reader +pdf-encryption.allow-degraded-print.display-label=Allow degraded print +pdf-encryption.allow-assembly.display-label=Allow document assembly +pdf-encryption.encryption-level.display-label=Encryption level +pdf-encryption.exclude-metadata.display-label=Exclude metadata from encryption +pdf-encryption.executeAsynchronously.display-label=Run in background +pdf-encryption.inplace.display-label=Execute in place \ No newline at end of file diff --git a/pdf-toolkit-platform/src/main/resources/alfresco/extension/pdftoolkit/web/bean/actions/handlers/pdfinsert-messages.properties b/pdf-toolkit-platform/src/main/resources/alfresco/extension/pdftoolkit/web/bean/actions/handlers/pdfinsert-messages.properties new file mode 100644 index 0000000..7f9c868 --- /dev/null +++ b/pdf-toolkit-platform/src/main/resources/alfresco/extension/pdftoolkit/web/bean/actions/handlers/pdfinsert-messages.properties @@ -0,0 +1,9 @@ +#PDF Append strings +pdf-insert-at-page.title=Insert PDF +pdf-insert-at-page.description=Insert PDF into another PDF +pdf-insert-at-page.destination-folder.display-label=Destination folder +pdf-insert-at-page.insert-at-page.display-label=Insert at page +pdf-insert-at-page.destination-name.display-label=Destination name +pdf-insert-at-page.insert-content.display-label=Content to insert +pdf-insert-at-page.executeAsynchronously.display-label=Run in background +pdf-insert-at-page.inplace.display-label=Execute in place \ No newline at end of file diff --git a/pdf-toolkit-platform/src/main/resources/alfresco/extension/pdftoolkit/web/bean/actions/handlers/pdfsignature-messages.properties b/pdf-toolkit-platform/src/main/resources/alfresco/extension/pdftoolkit/web/bean/actions/handlers/pdfsignature-messages.properties new file mode 100644 index 0000000..31ee8fa --- /dev/null +++ b/pdf-toolkit-platform/src/main/resources/alfresco/extension/pdftoolkit/web/bean/actions/handlers/pdfsignature-messages.properties @@ -0,0 +1,18 @@ +pdf-signature.title=Sign PDF +pdf-signature.description=Digitally sign a PDF document +pdf-signature.destination-folder.display-label=Destination Folder +pdf-signature.private-key.display-label=Private Key +pdf-signature.visibility.display-label=Apply visible signature +pdf-signature.location.display-label=Location +pdf-signature.reason.display-label=Reason +pdf-signature.key-password.display-label=Key Store Password +pdf-signature.width.display-label=Width +pdf-signature.height.display-label=Height +pdf-signature.key-type.display-label=Key Type +pdf-signature.alias.display-label=Alias +pdf-signature.store-password.display-label=Password +pdf-signature.location-x.display-label=Signature location x +pdf-signature.location-y.display-label=Signature location y +pdf-signature.position.display-label=Position +pdf-signature.executeAsynchronously.display-label=Run in background +pdf-signature.inplace.display-label=Execute in place \ No newline at end of file diff --git a/pdf-toolkit-platform/src/main/resources/alfresco/extension/pdftoolkit/web/bean/actions/handlers/pdfsplit-messages.properties b/pdf-toolkit-platform/src/main/resources/alfresco/extension/pdftoolkit/web/bean/actions/handlers/pdfsplit-messages.properties new file mode 100644 index 0000000..79a9c78 --- /dev/null +++ b/pdf-toolkit-platform/src/main/resources/alfresco/extension/pdftoolkit/web/bean/actions/handlers/pdfsplit-messages.properties @@ -0,0 +1,7 @@ +#PDF Split strings +pdf-split.title=Split PDF +pdf-split.description=Split PDF into individual pages +pdf-split.destination-folder.display-label=Destination folder +pdf-split.split-frequency.display-label=Split frequency +pdf-split.executeAsynchronously.display-label=Run in background +pdf-split.inplace.display-label=Execute in place \ No newline at end of file diff --git a/pdf-toolkit-platform/src/main/resources/alfresco/extension/pdftoolkit/web/bean/actions/handlers/pdfsplitatpage-messages.properties b/pdf-toolkit-platform/src/main/resources/alfresco/extension/pdftoolkit/web/bean/actions/handlers/pdfsplitatpage-messages.properties new file mode 100644 index 0000000..9e207e5 --- /dev/null +++ b/pdf-toolkit-platform/src/main/resources/alfresco/extension/pdftoolkit/web/bean/actions/handlers/pdfsplitatpage-messages.properties @@ -0,0 +1,7 @@ +#PDF Split At Page strings +pdf-split-at-page.title=Split PDF At Page +pdf-split-at-page.description=Split PDF at specific page +pdf-split-at-page.destination-folder.display-label=Destination folder +pdf-split-at-page.split-at-page.display-label=Split at page number +pdf-split-at-page.executeAsynchronously.display-label=Run in background +pdf-split-at-page.inplace.display-label=Execute in place diff --git a/pdf-toolkit-platform/src/main/resources/alfresco/extension/pdftoolkit/web/bean/actions/handlers/pdfwatermark-messages.properties b/pdf-toolkit-platform/src/main/resources/alfresco/extension/pdftoolkit/web/bean/actions/handlers/pdfwatermark-messages.properties new file mode 100644 index 0000000..cbcd089 --- /dev/null +++ b/pdf-toolkit-platform/src/main/resources/alfresco/extension/pdftoolkit/web/bean/actions/handlers/pdfwatermark-messages.properties @@ -0,0 +1,15 @@ +pdf-watermark.title=Watermark PDF +pdf-watermark.description=Add watermark to a PDF document +pdf-watermark.watermark-image.display-label=Watermark image +pdf-watermark.destination-folder.display-label=Destination folder +pdf-watermark.watermark-pages.display-label=Pages +pdf-watermark.watermark-depth.display-label=Depth +pdf-watermark.watermark-type.display-label=Type +pdf-watermark.watermark-text.display-label=Text +pdf-watermark.watermark-font.display-label=Font +pdf-watermark.watermark-size.display-label=Font size +pdf-watermark.location-x.display-label=Watermark location x +pdf-watermark.location-y.display-label=Watermark location y +pdf-watermark.position.display-label=Position +pdf-watermark.executeAsynchronously.display-label=Run in background +pdf-watermark.inplace.display-label=Execute in place \ No newline at end of file diff --git a/pdf-toolkit-platform/src/main/resources/alfresco/extension/templates/webscripts/org/alfresco/extension/pdftoolkit/pagecount.get.desc.xml b/pdf-toolkit-platform/src/main/resources/alfresco/extension/templates/webscripts/org/alfresco/extension/pdftoolkit/pagecount.get.desc.xml new file mode 100644 index 0000000..8c892d4 --- /dev/null +++ b/pdf-toolkit-platform/src/main/resources/alfresco/extension/templates/webscripts/org/alfresco/extension/pdftoolkit/pagecount.get.desc.xml @@ -0,0 +1,7 @@ + + Page Count + Get PDF document page count + /pdftoolkit/pagecount?{nodeRef} + extension + user + \ No newline at end of file diff --git a/pdf-toolkit-platform/src/main/resources/alfresco/extension/templates/webscripts/org/alfresco/extension/pdftoolkit/pagecount.get.json.ftl b/pdf-toolkit-platform/src/main/resources/alfresco/extension/templates/webscripts/org/alfresco/extension/pdftoolkit/pagecount.get.json.ftl new file mode 100644 index 0000000..1a464c1 --- /dev/null +++ b/pdf-toolkit-platform/src/main/resources/alfresco/extension/templates/webscripts/org/alfresco/extension/pdftoolkit/pagecount.get.json.ftl @@ -0,0 +1,3 @@ +{ + "pageCount":"${pageCount}" +} \ No newline at end of file diff --git a/pdf-toolkit-platform/src/main/resources/alfresco/extension/templates/webscripts/org/alfresco/extension/pdftoolkit/pageschemes.get.desc.xml b/pdf-toolkit-platform/src/main/resources/alfresco/extension/templates/webscripts/org/alfresco/extension/pdftoolkit/pageschemes.get.desc.xml new file mode 100644 index 0000000..67d7ec3 --- /dev/null +++ b/pdf-toolkit-platform/src/main/resources/alfresco/extension/templates/webscripts/org/alfresco/extension/pdftoolkit/pageschemes.get.desc.xml @@ -0,0 +1,7 @@ + + Page Schemes + Get PDF document page stamping schemes + /pdftoolkit/pageschemes?{nodeRef} + extension + user + \ No newline at end of file diff --git a/pdf-toolkit-platform/src/main/resources/alfresco/extension/templates/webscripts/org/alfresco/extension/pdftoolkit/pageschemes.get.json.ftl b/pdf-toolkit-platform/src/main/resources/alfresco/extension/templates/webscripts/org/alfresco/extension/pdftoolkit/pageschemes.get.json.ftl new file mode 100644 index 0000000..4433df7 --- /dev/null +++ b/pdf-toolkit-platform/src/main/resources/alfresco/extension/templates/webscripts/org/alfresco/extension/pdftoolkit/pageschemes.get.json.ftl @@ -0,0 +1,7 @@ +{ + "schemes": [ + {"name": "${msg("pdftoolkit.form.pagescheme.odd")}", "value":"odd"}, + {"name": "${msg("pdftoolkit.form.pagescheme.even")}", "value":"even"}, + {"name":"${msg("pdftoolkit.form.pagescheme.all")}", "value":"all"} + ] +} \ No newline at end of file diff --git a/pdf-toolkit-platform/src/main/resources/alfresco/extension/templates/webscripts/org/alfresco/extension/pdftoolkit/pageschemes.get_pt_BR.properties b/pdf-toolkit-platform/src/main/resources/alfresco/extension/templates/webscripts/org/alfresco/extension/pdftoolkit/pageschemes.get_pt_BR.properties new file mode 100644 index 0000000..d80f5ac --- /dev/null +++ b/pdf-toolkit-platform/src/main/resources/alfresco/extension/templates/webscripts/org/alfresco/extension/pdftoolkit/pageschemes.get_pt_BR.properties @@ -0,0 +1,3 @@ +property.all = Todos +property.odd = Impar +property.even = Par diff --git a/pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/alfresco-global.properties b/pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/alfresco-global.properties new file mode 100644 index 0000000..f566f22 --- /dev/null +++ b/pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/alfresco-global.properties @@ -0,0 +1,5 @@ +## This Alfresco Platform Configuration file should be used for custom properties that are introduced by this module. +## Define default values for all properties here. +## System Administrators can override these values in environment specific configurations in +## alfresco/tomcat/shared/classes/alfresco-global.properties. +## diff --git a/pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/context/actions-context.xml b/pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/context/actions-context.xml new file mode 100644 index 0000000..c71f261 --- /dev/null +++ b/pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/context/actions-context.xml @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/context/alfresco-pdf-toolkit-context.xml b/pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/context/alfresco-pdf-toolkit-context.xml new file mode 100644 index 0000000..eaf0db9 --- /dev/null +++ b/pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/context/alfresco-pdf-toolkit-context.xml @@ -0,0 +1,133 @@ + + + + + + + + + + + + + + + + + + + + + {http://www.alfresco.org/model/content/1.0}content + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/context/bootstrap-context.xml b/pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/context/bootstrap-context.xml new file mode 100644 index 0000000..d18d0f6 --- /dev/null +++ b/pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/context/bootstrap-context.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + alfresco/module/${project.artifactId}/model/pdftoolkitModel.xml + + + + + + + + + + alfresco/module/${project.artifactId}/messages/pdf-toolkit + + + + + + + + classpath:alfresco/module/${project.artifactId}/context/pdftoolkit-config.properties + + + + diff --git a/pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/context/custom-form-services-context.xml b/pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/context/custom-form-services-context.xml new file mode 100644 index 0000000..ec14c8d --- /dev/null +++ b/pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/context/custom-form-services-context.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + pdf-action + + + + + + + + + + + + + diff --git a/pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/context/pdftoolkit-config.properties b/pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/context/pdftoolkit-config.properties new file mode 100644 index 0000000..4518ccd --- /dev/null +++ b/pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/context/pdftoolkit-config.properties @@ -0,0 +1,8 @@ +# create new nodes when modifying PDFs, or copy existing nodes (to preserve metadata, etc) +pdftoolkit.createNew=true + +# apply the signature aspect and set properties when a document is signed? +pdftoolkit.useSignatureAspect=true + +# apply the encrypted aspect and set properties when a document is encrypted? +pdftoolkit.useEncryptionAspect=true \ No newline at end of file diff --git a/pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/context/service-context.xml b/pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/context/service-context.xml new file mode 100644 index 0000000..101e3dc --- /dev/null +++ b/pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/context/service-context.xml @@ -0,0 +1,64 @@ + + + + + + + + + + text/plain + application/pdf + + + text/csv + application/pdf + + + text/xml + application/pdf + + + + + + + + + + image/tiff + application/pdf + + + + + + + + + + + + diff --git a/pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/context/webscript-context.xml b/pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/context/webscript-context.xml new file mode 100644 index 0000000..edf40ec --- /dev/null +++ b/pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/context/webscript-context.xml @@ -0,0 +1,26 @@ + + + + + diff --git a/pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/log4j.properties b/pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/log4j.properties new file mode 100644 index 0000000..29523b4 --- /dev/null +++ b/pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/log4j.properties @@ -0,0 +1 @@ +# Add here module-specific custom log4j.properties configuration \ No newline at end of file diff --git a/pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/messages/content-model.properties b/pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/messages/content-model.properties new file mode 100644 index 0000000..775c584 --- /dev/null +++ b/pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/messages/content-model.properties @@ -0,0 +1,6 @@ +# This file should contain content model labels + +acme_contentModel.type.acme_document.title=ACME Document +acme_contentModel.aspect.acme_securityClassified.title=ACME Security Classified +acme_contentModel.property.acme_documentId.title=Document Id +acme_contentModel.property.acme_securityClassification.title=Security Classification diff --git a/pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/messages/pdf-toolkit.properties b/pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/messages/pdf-toolkit.properties new file mode 100644 index 0000000..ea82b61 --- /dev/null +++ b/pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/messages/pdf-toolkit.properties @@ -0,0 +1,192 @@ +#PDF Split strings +action_pdf_split=Splits PDF and copies pages into ''{0}'' +action_pdf_split_frequency=Splits PDF every ''{0}'' pages and copies pages into ''{1}'' +title_action_pdf_split=Split PDF +pdfsplit_frequency=Split every + +action_pdf_append=Append to ''{0}'' and save as ''{1}''.pdf in ''{2}'' +title_action_pdf_append=Append PDF +pdfappend_name=Appended Name +pdfappend_to=Append to + +action_pdf_split_at_page=Split PDF at Page ''{0}'', and copies into ''{1}'' +title_action_pdf_split_at_page=Split PDF at Page +pdfsplit_at_page=Split at page + +action_pdf_insert_at_page=Insert PDF ''{0}'' at Page ''{1}'', and copies into ''{2}'' +title_action_pdf_insert_at_page=Insert PDF at Page +pdfinsert_at_page=Insert at page +pdfinsert_name=Name +pdfinsert_content=Insert + +action_pdf_watermark=Watermark incoming PDF +title_action_pdf_watermark=Watermark PDF +pdfwatermark_image=Watermark Image +pdfwatermark_image_selector=Click here to select the watermark image +pdfwatermark_pages=Pages to watermark +pdfwatermark_depth=Watermark depth (over/under content) +pdfwatermark_type=Watermark Type +pdfwatermark_text=Watermark Text +pdfwatermark_font=Watermark Font +pdfwatermark_size=Watermark Font Size +pdfwatermark_inplace=Apply in-place +pdfwatermark_page=Watermark Page + +action_pdf_encryption=Encrypt PDF, set configured permissions and save resulting document in ''{0}'' +title_action_pdf_encryption=Encrypt PDF and set permissions +pdfencryption_userpassword=PDF user password +pdfencryption_ownerpassword=PDF owner password +pdfencryption_allowprint=Allow printing +pdfencryption_allowcopy=Allow copying +pdfencryption_allowcontentmodification=Allow modification of content +pdfencryption_allowannotationmodification=Allow modification of annotations +pdfencryption_allowformfill=Allow form fill +pdfencryption_allowscreenreader=Allow screen reader access +pdfencryption_allowdegradedprint=Allow degraded print +pdfencryption_allowassembly=Allow assembly +pdfencryption_encryptionlevel=Encryption level +pdfencryption_excludemetadata=Exclude metadata + +action_pdf_signature=Sign PDF +title_action_pdf_signature=Digitally sign PDF +#pdfsignature_private_key=Private key file +pdfsignature_private_key=Key Store file +pdfsignature_key_password=Password +pdfsignature_reason=Reason +pdfsignature_location=Location +pdfsignature_visibility=Apply visible signature +pdfsignature_width=Width +pdfsignature_height=Height +pdfsignature_key_type=Key Type + +pdfsignature_alias=Alias +pdfsignature_store_password=Key Store Password + +# common elements used by other stamp types +pdfstamp_position=Pre-defined position +pdfstamp_location_x=Absolute X (in pixels) +pdfstamp_location_y=Absolute Y (in pixels) + +action_pdf_delete=Delete pages from PDF document +pdfdelete_deletepages=Pages to Delete +pdfdelete_name=Destination File Name + + +##### These messages are the ones that appear in the Share forms ##### + +pdf-append.title=Append PDF +pdf-append.description=append PDF to another PDF +pdf-append.target-node.display-label=To append +pdf-append.destination-folder.display-label=Destination folder +pdf-append.destination-name.display-label=Destination name +pdf-append.inplace.display-label=Execute in place + +pdf-delete-page.title=Delete PDF pages +pdf-delete-page.description=delete pages from a PDF document +pdf-delete-page.page.display-label=Pages to delete (comma separated) +pdf-delete-page.destination-folder.display-label=Destination folder +pdf-delete-page.destination-name.display-label=Destination name +pdf-delete-page.inplace.display-label=Execute in place + +pdf-extract-page.title=Extract PDF pages +pdf-extract-page.description=extract pages from a PDF document +pdf-extract-page.page.display-label=Pages to extract (comma separated) +pdf-extract-page.destination-folder.display-label=Destination folder +pdf-extract-page.destination-name.display-label=Destination name + +pdf-rotate.title=Rotate PDF Document +pdf-rotate.description=Rotate the pages of this PDF document +pdf-rotate.degrees.display-label=Degrees of rotation (90, 180, 270) +pdf-rotate.destination-folder.display-label=Destination folder +pdf-rotate.destination-name.display-label=Destination name +pdf-rotate.inplace.display-label=Execute in place +pdf-rotate.page.display-label=Apply to page(s) + +pdf-encryption.title=Encrypt PDF +pdf-encryption.description=Encrypt PDF document and set permissions +pdf-encryption.destination-folder.display-label=Destination folder +pdf-encryption.destination-name.display-label=Destination name +pdf-encryption.user-password.display-label=User password +pdf-encryption.owner-password.display-label=Owner password +pdf-encryption.allow-print.display-label=Allow print +pdf-encryption.allow-copy.display-label=Allow copy +pdf-encryption.allow-content-modification.display-label=Allow content modification +pdf-encryption.allow-annotation-modification.display-label=Allow annotation modification +pdf-encryption.allow-form-fill.display-label=Allow form fill +pdf-encryption.allow-screen-reader.display-label=Allow screen reader +pdf-encryption.allow-degraded-print.display-label=Allow degraded print +pdf-encryption.allow-assembly.display-label=Allow document assembly +pdf-encryption.encryption-level.display-label=Encryption level +pdf-encryption.exclude-metadata.display-label=Exclude metadata from encryption +pdf-encryption.inplace.display-label=Execute in place + +pdf-decryption.title=Decrypt PDF +pdf-decryption.description=Decrypt PDF Document +pdf-decryption.destination-folder.display-label=Destination folder +pdf-decryption.destination-name.display-label=Destination name +pdf-decryption.owner-password.display-label=Owner password +pdf-decryption.inplace.display-label=Execute in place + +pdf-insert-at-page.title=Insert PDF +pdf-insert-at-page.description=Insert PDF into another PDF +pdf-insert-at-page.destination-folder.display-label=Destination folder +pdf-insert-at-page.page.display-label=Insert at page +pdf-insert-at-page.destination-name.display-label=Destination name +pdf-insert-at-page.insert-content.display-label=Content to insert +pdf-insert-at-page.inplace.display-label=Execute in place + +pdf-signature.title=Sign PDF +pdf-signature.description=Digitally sign a PDF document +pdf-signature.destination-folder.display-label=Destination Folder +pdf-signature.destination-name.display-label=Destination name +pdf-signature.private-key.display-label=Private Key +pdf-signature.visibility.display-label=Apply visible signature +pdf-signature.location.display-label=Location +pdf-signature.reason.display-label=Reason +pdf-signature.key-password.display-label=Key Store Password +pdf-signature.width.display-label=Width +pdf-signature.height.display-label=Height +pdf-signature.key-type.display-label=Key Type +pdf-signature.alias.display-label=Alias +pdf-signature.store-password.display-label=Password +pdf-signature.location-x.display-label=Signature location x +pdf-signature.location-y.display-label=Signature location y +pdf-signature.position.display-label=Position +pdf-signature.inplace.display-label=Execute in place +pdf-signature.page.display-label=Apply to page + +pdf-split.title=Split PDF +pdf-split.description=Split PDF into individual pages +pdf-split.destination-folder.display-label=Destination folder +pdf-split.split-frequency.display-label=Split frequency +pdf-split.inplace.display-label=Execute in place + +pdf-split-at-page.title=Split PDF At Page +pdf-split-at-page.description=Split PDF at specific page +pdf-split-at-page.destination-folder.display-label=Destination folder +pdf-split-at-page.page.display-label=Split at page number +pdf-split-at-page.inplace.display-label=Execute in place + +pdf-watermark.title=Watermark PDF +pdf-watermark.description=Add watermark to a PDF document +pdf-watermark.watermark-image.display-label=Watermark image +pdf-watermark.destination-folder.display-label=Destination folder +pdf-watermark.destination-name.display-label=Destination name +pdf-watermark.watermark-pages.display-label=Pages +pdf-watermark.watermark-depth.display-label=Depth +pdf-watermark.watermark-type.display-label=Type +pdf-watermark.watermark-text.display-label=Text +pdf-watermark.watermark-font.display-label=Font +pdf-watermark.watermark-size.display-label=Font size +pdf-watermark.location-x.display-label=Watermark location x +pdf-watermark.location-y.display-label=Watermark location y +pdf-watermark.position.display-label=Position +pdf-watermark.inplace.display-label=Execute in place +pdf-watermark.page.display-label=Apply to page(s) + +pdftoolkit.form.pagescheme.odd=odd +pdftoolkit.form.pagescheme.even=even +pdftoolkit.form.pagescheme.all=all + +pdftoolkit.split-page-numbering-pattern-multiple=_pgs{0}-{1} +pdftoolkit.split-page-numbering-pattern-single=_pg{0} diff --git a/pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/messages/pdf-toolkit_de.properties b/pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/messages/pdf-toolkit_de.properties new file mode 100644 index 0000000..2c4c60a --- /dev/null +++ b/pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/messages/pdf-toolkit_de.properties @@ -0,0 +1,192 @@ +#PDF Split strings +action_pdf_split=Teilt die PDF auf und kopiert die Seiten nach ''{0}'' +action_pdf_split_frequency=Teile PDF jde ''{0}'' Seite und kopiere die Seiten in ''{1}'' +title_action_pdf_split=PDF aufteilen +pdfsplit_frequency=Alle aufteilen + +action_pdf_append=H\u00e4nge PDF an ''{0}'' und speichere als ''{1}''.pdf in ''{2}'' +title_action_pdf_append=PDF anh\u00e4ngen +pdfappend_name=Anh\u00e4ngender Name +pdfappend_to=anh\u00e4ngen + +action_pdf_split_at_page=Teile PDF auf Seite ''{0}'', und kopiere in ''{1}'' +title_action_pdf_split_at_page=Teile PDF auf Seite +pdfsplit_at_page=Teile PDF auf Seite + +action_pdf_insert_at_page=PDF ''{0}'' einf\u00fcgen auf Seite ''{1}'', und kopiere in ''{2}'' +title_action_pdf_insert_at_page=PDF auf Seite einf\u00fcgen +pdfinsert_at_page=Einf\u00fcgen auf Seite +pdfinsert_name=Name +pdfinsert_content=Einf\u00fcgen + +action_pdf_watermark=Eingehende PDFs mit Wasserzeichen versehen. +title_action_pdf_watermark=Wasserzeichen PDF +pdfwatermark_image=Wasserzeichenbild +pdfwatermark_image_selector=Hier klicken um ein Waserzeichen auszuw\u00e4hlen +pdfwatermark_pages=Seiten mit einen Wasserzeichen versehen +pdfwatermark_depth=Wasserzeichen Tiefe (\u00fcber/unter Inhalt) +pdfwatermark_type=Typ +pdfwatermark_text=Text +pdfwatermark_font=Schriftart +pdfwatermark_size=Schriftgr\u00f6\u00dfe +pdfwatermark_inplace=Auf aktuelles Dokument ausf\u00fchren +pdfwatermark_page=Wasserzeichenseite + +action_pdf_encryption=Verschl\u00fcssle PDF, setze konfigurierte Berechtigungen und speichere das Dokument in ''{0}'' +title_action_pdf_encryption=PDF entschl\u00fcsseln und Rechte setzen +pdfencryption_userpassword=Benutzerpasswort +pdfencryption_ownerpassword=Rechteinhaber Passwort +pdfencryption_allowprint=Drucken erlauben +pdfencryption_allowcopy=Kopieren erlauben +pdfencryption_allowcontentmodification=\u00c4nderung der Dokumenteninhalte erlaubt +pdfencryption_allowannotationmodification=\u00c4nderung der Anmerkungen erlaubt +pdfencryption_allowformfill=Formular-Ausf\u00fcllung erlaubt +pdfencryption_allowscreenreader=Textzugriff f\u00fcr Screenreader +pdfencryption_allowdegradedprint=Drucken nur in eingeschr\u00e4nkter Qualit\u00e4t erlaubt +pdfencryption_allowassembly=Montage zulassen +pdfencryption_encryptionlevel=Verschl\u00fcsselungsstufe +pdfencryption_excludemetadata=Metadaten ausschlie\u00dfen + +action_pdf_signature=PDF signieren +title_action_pdf_signature=PDF digital signieren +#pdfsignature_private_key=Private key file +pdfsignature_private_key=Key-Store Datei +pdfsignature_key_password=Passwort +pdfsignature_reason=Grund +pdfsignature_location=Position +pdfsignature_visibility=Sichtbaren Signatur +pdfsignature_width=Breite +pdfsignature_height=H\u00f6he +pdfsignature_key_type=Schl\u00fcsselart + +pdfsignature_alias=Alias +pdfsignature_store_password=Key-Store Passwort + +# common elements used by other stamp types +pdfstamp_position=Vordefinierte Position +pdfstamp_location_x=Absolute X (in pixels) +pdfstamp_location_y=Absolute Y (in pixels) + +action_pdf_delete=L\u00f6schen Seiten aus PDF-Dokument +pdfdelete_deletepages=Seiten zum L\u00f6schen +pdfdelete_name=Ziel-Dateiname + + +##### These messages are the ones that appear in the Share forms ##### + +pdf-append.title=PDF anh\u00e4ngen +pdf-append.description=PDF an ein anderes PDF Dokument anh\u00e4ngen +pdf-append.target-node.display-label=Anh\u00e4ngen +pdf-append.destination-folder.display-label=Zielordner +pdf-append.destination-name.display-label=Ziel-Dateiname +pdf-append.inplace.display-label=Auf das aktuelle Dokument aus\u00fchren + +pdf-delete-page.title=PDF-Seiten l\u00f6schen +pdf-delete-page.description=Seiten aus einem PDF-Dokument l\u00f6schen +pdf-delete-page.page.display-label=Seiten zum L\u00f6schen (Komma getrennt) +pdf-delete-page.destination-folder.display-label=Zielordner +pdf-delete-page.destination-name.display-label=Ziel-Dateiname +pdf-delete-page.inplace.display-label=Auf das aktuelle Dokument aus\u00fchren + +pdf-extract-page.title=PDF-Seiten extrahieren +pdf-extract-page.description=Seiten aus einem PDF-Dokument extrahieren +pdf-extract-page.page.display-label=Seiten extrahieren (Komma getrennt) +pdf-extract-page.destination-folder.display-label=Zielordner +pdf-extract-page.destination-name.display-label=Ziel-Dateiname + +pdf-rotate.title=PDF-Dokument rotieren +pdf-rotate.description=Rotiert die Seiten eines PDF-Dokumentes +pdf-rotate.degrees.display-label=Grad der Drehung (90, 180, 270) +pdf-rotate.destination-folder.display-label=Zielordner +pdf-rotate.destination-name.display-label=Ziel-Dateiname +pdf-rotate.inplace.display-label=Auf das aktuelle Dokument aus\u00fchren +pdf-rotate.page.display-label=Auf Seite(n) anwenden + +pdf-encryption.title=PDF verschl\u00fcsseln +pdf-encryption.description=Verschl\u00fcsseln des PDF-Dokument und setzen von Berechtigungen +pdf-encryption.destination-folder.display-label=Zielordner +pdf-encryption.destination-name.display-label=Ziel-Dateiname +pdf-encryption.user-password.display-label=Benutzerpasswort +pdf-encryption.owner-password.display-label=Rechteinhaber Passwort +pdf-encryption.allow-print.display-label=Drucken erlauben +pdf-encryption.allow-copy.display-label=Kopieren erlauben +pdf-encryption.allow-content-modification.display-label=\u00c4nderung der Dokumenteninhalte erlaubt +pdf-encryption.allow-annotation-modification.display-label=\u00c4nderung der Anmerkungen erlaubt +pdf-encryption.allow-form-fill.display-label=Formular-Ausf\u00fcllung erlaubt +pdf-encryption.allow-screen-reader.display-label=Textzugriff f\u00fcr Screenreader +pdf-encryption.allow-degraded-print.display-label=Drucken nur in eingeschr\u00e4nkter Qualit\u00e4t erlaubt +pdf-encryption.allow-assembly.display-label=Montage zulassen +pdf-encryption.encryption-level.display-label=Verschl\u00fcsselungsstufe +pdf-encryption.exclude-metadata.display-label=Metadaten ausschlie\u00dfen +pdf-encryption.inplace.display-label=Auf das aktuelle Dokument aus\u00fchren + +pdf-decryption.title=PDF entschl\u00fcsseln +pdf-decryption.description=PDF-Dokument entschl\u00fcsseln +pdf-decryption.destination-folder.display-label=Zielordner +pdf-decryption.destination-name.display-label=Ziel-Dateiname +pdf-decryption.owner-password.display-label=Rechteinhaber Passwort +pdf-decryption.inplace.display-label=Auf das aktuelle Dokument aus\u00fchren + +pdf-insert-at-page.title=PDF einf\u00fcgen +pdf-insert-at-page.description=PDF in ein anderes PDF-Dokument einf\u00fcgen +pdf-insert-at-page.destination-folder.display-label=Zielordner +pdf-insert-at-page.page.display-label=Einf\u00fcgen auf Seite +pdf-insert-at-page.destination-name.display-label=Name +pdf-insert-at-page.insert-content.display-label=Inhalt zum Einf\u00fcgen +pdf-insert-at-page.inplace.display-label=Auf das aktuelle Dokument aus\u00fchren + +pdf-signature.title=PDF signieren +pdf-signature.description=PDF digital signieren +pdf-signature.destination-folder.display-label=Zielordner +pdf-signature.destination-name.display-label=Ziel-Dateiname +pdf-signature.private-key.display-label=Privater Schl\u00fcssel +pdf-signature.visibility.display-label=Sichtbaren Signatur +pdf-signature.location.display-label=Position +pdf-signature.reason.display-label=Grund +pdf-signature.key-password.display-label=Key-Store Passwort +pdf-signature.width.display-label=Breite +pdf-signature.height.display-label=H\u00f6he +pdf-signature.key-type.display-label=Schl\u00fcsseltyp +pdf-signature.alias.display-label=Alias +pdf-signature.store-password.display-label=Passwort +pdf-signature.location-x.display-label=Signaturposition x +pdf-signature.location-y.display-label=Signaturposition y +pdf-signature.position.display-label=Position +pdf-signature.inplace.display-label=Auf das aktuelle Dokument aus\u00fchren +pdf-signature.page.display-label=Auf Seite anwenden + +pdf-split.title=PDF aufteilen +pdf-split.description=Teilt eine PDF in individuelle Seiten +pdf-split.destination-folder.display-label=Zielordner +pdf-split.split-frequency.display-label=Aufteilung +pdf-split.inplace.display-label=Auf das aktuelle Dokument aus\u00fchren + +pdf-split-at-page.title=Teile PDF auf Seite +pdf-split-at-page.description=Teilt eine PDF ab einer definierten Seite. +pdf-split-at-page.destination-folder.display-label=Zielordner +pdf-split-at-page.page.display-label=Aufteilung ab Seite +pdf-split-at-page.inplace.display-label=Auf das aktuelle Dokument aus\u00fchren + +pdf-watermark.title=Wasserzeichen f\u00fcr ein PDF +pdf-watermark.description=F\u00fcgt einer PDF ein Wasserzeichen hinzu +pdf-watermark.watermark-image.display-label=Wasserzeichen (Bild) +pdf-watermark.destination-folder.display-label=Zielordner +pdf-watermark.destination-name.display-label=Name +pdf-watermark.watermark-pages.display-label=Seiten +pdf-watermark.watermark-depth.display-label=Tiefe +pdf-watermark.watermark-type.display-label=Typ +pdf-watermark.watermark-text.display-label=Text +pdf-watermark.watermark-font.display-label=Schriftart +pdf-watermark.watermark-size.display-label=Schriftgr\u00f6\u00dfe +pdf-watermark.location-x.display-label=Wasserzeichen Position x +pdf-watermark.location-y.display-label=Wasserzeichen Position y +pdf-watermark.position.display-label=Position +pdf-watermark.inplace.display-label=Auf das aktuelle Dokument aus\u00fchren +pdf-watermark.page.display-label=Auf alle Seiten anwenden + +pdftoolkit.form.pagescheme.odd=ungerade +pdftoolkit.form.pagescheme.even=gerade +pdftoolkit.form.pagescheme.all=alle + +pdftoolkit.split-page-numbering-pattern-multiple=_pgs{0}-{1} +pdftoolkit.split-page-numbering-pattern-single=_pg{0} \ No newline at end of file diff --git a/pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/messages/pdf-toolkit_en.properties b/pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/messages/pdf-toolkit_en.properties new file mode 100644 index 0000000..167f5bc --- /dev/null +++ b/pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/messages/pdf-toolkit_en.properties @@ -0,0 +1,192 @@ +#PDF Split strings +action_pdf_split=Splits PDF and copies pages into ''{0}'' +action_pdf_split_frequency=Splits PDF every ''{0}'' pages and copies pages into ''{1}'' +title_action_pdf_split=Split PDF +pdfsplit_frequency=Split every + +action_pdf_append=Append to ''{0}'' and save as ''{1}''.pdf in ''{2}'' +title_action_pdf_append=Append PDF +pdfappend_name=Appended Name +pdfappend_to=Append to + +action_pdf_split_at_page=Split PDF at Page ''{0}'', and copies into ''{1}'' +title_action_pdf_split_at_page=Split PDF at Page +pdfsplit_at_page=Split at page + +action_pdf_insert_at_page=Insert PDF ''{0}'' at Page ''{1}'', and copies into ''{2}'' +title_action_pdf_insert_at_page=Insert PDF at Page +pdfinsert_at_page=Insert at page +pdfinsert_name=Name +pdfinsert_content=Insert + +action_pdf_watermark=Watermark incoming PDF +title_action_pdf_watermark=Watermark PDF +pdfwatermark_image=Watermark Image +pdfwatermark_image_selector=Click here to select the watermark image +pdfwatermark_pages=Pages to watermark +pdfwatermark_depth=Watermark depth (over/under content) +pdfwatermark_type=Watermark Type +pdfwatermark_text=Watermark Text +pdfwatermark_font=Watermark Font +pdfwatermark_size=Watermark Font Size +pdfwatermark_inplace=Apply in-place +pdfwatermark_page=Watermark Page + +action_pdf_encryption=Encrypt PDF, set configured permissions and save resulting document in ''{0}'' +title_action_pdf_encryption=Encrypt PDF and set permissions +pdfencryption_userpassword=PDF user password +pdfencryption_ownerpassword=PDF owner password +pdfencryption_allowprint=Allow printing +pdfencryption_allowcopy=Allow copying +pdfencryption_allowcontentmodification=Allow modification of content +pdfencryption_allowannotationmodification=Allow modification of annotations +pdfencryption_allowformfill=Allow form fill +pdfencryption_allowscreenreader=Allow screen reader access +pdfencryption_allowdegradedprint=Allow degraded print +pdfencryption_allowassembly=Allow assembly +pdfencryption_encryptionlevel=Encryption level +pdfencryption_excludemetadata=Exclude metadata + +action_pdf_signature=Sign PDF +title_action_pdf_signature=Digitally sign PDF +#pdfsignature_private_key=Private key file +pdfsignature_private_key=Key Store file +pdfsignature_key_password=Password +pdfsignature_reason=Reason +pdfsignature_location=Location +pdfsignature_visibility=Apply visible signature +pdfsignature_width=Width +pdfsignature_height=Height +pdfsignature_key_type=Key Type + +pdfsignature_alias=Alias +pdfsignature_store_password=Key Store Password + +# common elements used by other stamp types +pdfstamp_position=Pre-defined position +pdfstamp_location_x=Absolute X (in pixels) +pdfstamp_location_y=Absolute Y (in pixels) + +action_pdf_delete=Delete pages from PDF document +pdfdelete_deletepages=Pages to Delete +pdfdelete_name=Destination File Name + + +##### These messages are the ones that appear in the Share forms ##### + +pdf-append.title=Append PDF +pdf-append.description=append PDF to another PDF +pdf-append.target-node.display-label=To append +pdf-append.destination-folder.display-label=Destination folder +pdf-append.destination-name.display-label=Destination name +pdf-append.inplace.display-label=Execute in place + +pdf-delete-page.title=Delete PDF pages +pdf-delete-page.description=delete pages from a PDF document +pdf-delete-page.page.display-label=Pages to delete (comma separated) +pdf-delete-page.destination-folder.display-label=Destination folder +pdf-delete-page.destination-name.display-label=Destination name +pdf-delete-page.inplace.display-label=Execute in place + +pdf-extract-page.title=Extract PDF pages +pdf-extract-page.description=extract pages from a PDF document +pdf-extract-page.page.display-label=Pages to extract (comma separated) +pdf-extract-page.destination-folder.display-label=Destination folder +pdf-extract-page.destination-name.display-label=Destination name + +pdf-rotate.title=Rotate PDF Document +pdf-rotate.description=Rotate the pages of this PDF document +pdf-rotate.degrees.display-label=Degrees of rotation (90, 180, 270) +pdf-rotate.destination-folder.display-label=Destination folder +pdf-rotate.destination-name.display-label=Destination name +pdf-rotate.inplace.display-label=Execute in place +pdf-rotate.page.display-label=Apply to page(s) + +pdf-encryption.title=Encrypt PDF +pdf-encryption.description=Encrypt PDF document and set permissions +pdf-encryption.destination-folder.display-label=Destination folder +pdf-encryption.destination-name.display-label=Destination name +pdf-encryption.user-password.display-label=User password +pdf-encryption.owner-password.display-label=Owner password +pdf-encryption.allow-print.display-label=Allow print +pdf-encryption.allow-copy.display-label=Allow copy +pdf-encryption.allow-content-modification.display-label=Allow content modification +pdf-encryption.allow-annotation-modification.display-label=Allow annotation modification +pdf-encryption.allow-form-fill.display-label=Allow form fill +pdf-encryption.allow-screen-reader.display-label=Allow screen reader +pdf-encryption.allow-degraded-print.display-label=Allow degraded print +pdf-encryption.allow-assembly.display-label=Allow document assembly +pdf-encryption.encryption-level.display-label=Encryption level +pdf-encryption.exclude-metadata.display-label=Exclude metadata from encryption +pdf-encryption.inplace.display-label=Execute in place + +pdf-decryption.title=Decrypt PDF +pdf-decryption.description=Decrypt PDF Document +pdf-decryption.destination-folder.display-label=Destination folder +pdf-decryption.destination-name.display-label=Destination name +pdf-decryption.owner-password.display-label=Owner password +pdf-decryption.inplace.display-label=Execute in place + +pdf-insert-at-page.title=Insert PDF +pdf-insert-at-page.description=Insert PDF into another PDF +pdf-insert-at-page.destination-folder.display-label=Destination folder +pdf-insert-at-page.page.display-label=Insert at page +pdf-insert-at-page.destination-name.display-label=Destination name +pdf-insert-at-page.insert-content.display-label=Content to insert +pdf-insert-at-page.inplace.display-label=Execute in place + +pdf-signature.title=Sign PDF +pdf-signature.description=Digitally sign a PDF document +pdf-signature.destination-folder.display-label=Destination Folder +pdf-signature.destination-name.display-label=Destination name +pdf-signature.private-key.display-label=Private Key +pdf-signature.visibility.display-label=Apply visible signature +pdf-signature.location.display-label=Location +pdf-signature.reason.display-label=Reason +pdf-signature.key-password.display-label=Key Store Password +pdf-signature.width.display-label=Width +pdf-signature.height.display-label=Height +pdf-signature.key-type.display-label=Key Type +pdf-signature.alias.display-label=Alias +pdf-signature.store-password.display-label=Password +pdf-signature.location-x.display-label=Signature location x +pdf-signature.location-y.display-label=Signature location y +pdf-signature.position.display-label=Position +pdf-signature.inplace.display-label=Execute in place +pdf-signature.page.display-label=Apply to page + +pdf-split.title=Split PDF +pdf-split.description=Split PDF into individual pages +pdf-split.destination-folder.display-label=Destination folder +pdf-split.split-frequency.display-label=Split frequency +pdf-split.inplace.display-label=Execute in place + +pdf-split-at-page.title=Split PDF At Page +pdf-split-at-page.description=Split PDF at specific page +pdf-split-at-page.destination-folder.display-label=Destination folder +pdf-split-at-page.page.display-label=Split at page number +pdf-split-at-page.inplace.display-label=Execute in place + +pdf-watermark.title=Watermark PDF +pdf-watermark.description=Add watermark to a PDF document +pdf-watermark.watermark-image.display-label=Watermark image +pdf-watermark.destination-folder.display-label=Destination folder +pdf-watermark.destination-name.display-label=Destination name +pdf-watermark.watermark-pages.display-label=Pages +pdf-watermark.watermark-depth.display-label=Depth +pdf-watermark.watermark-type.display-label=Type +pdf-watermark.watermark-text.display-label=Text +pdf-watermark.watermark-font.display-label=Font +pdf-watermark.watermark-size.display-label=Font size +pdf-watermark.location-x.display-label=Watermark location x +pdf-watermark.location-y.display-label=Watermark location y +pdf-watermark.position.display-label=Position +pdf-watermark.inplace.display-label=Execute in place +pdf-watermark.page.display-label=Apply to page(s) + +pdftoolkit.form.pagescheme.odd=odd +pdftoolkit.form.pagescheme.even=even +pdftoolkit.form.pagescheme.all=all + +pdftoolkit.split-page-numbering-pattern-multiple=_pgs{0}-{1} +pdftoolkit.split-page-numbering-pattern-single=_pg{0} \ No newline at end of file diff --git a/pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/messages/pdf-toolkit_pt_BR.properties b/pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/messages/pdf-toolkit_pt_BR.properties new file mode 100644 index 0000000..cdd3c89 --- /dev/null +++ b/pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/messages/pdf-toolkit_pt_BR.properties @@ -0,0 +1,214 @@ +#PDF Split strings +action_pdf_split=Dividir PDF e copiar p\u00e1gina em ''{0}'' +action_pdf_split_frequency=Dividir PDF cada ''{0}'' p\u00e1ginas e copiar p\u00e1gina em ''{1}'' +title_action_pdf_split=Dividir PDF +pdfsplit_frequency=Dividir cada + +action_pdf_append=Adicionar para ''{0}'' e salvar como ''{1}''.pdf em ''{2}'' +title_action_pdf_append=Adicionar PDF +pdfappend_name=Nome adicionado +pdfappend_to=Adicionar para + +action_pdf_split_at_page=Dividir PDF na p\u00e1gina ''{0}'', e copiar em ''{1}'' +title_action_pdf_split_at_page=Dividir PDF na p\u00e1gina +pdfsplit_at_page=Dividir na p\u00e1gina + +action_pdf_split_by_size=Dividir em ''{0}'', e copiar em ''{1}'' +title_action_pdf_split_by_size=Dividir pelo tamanho +pdfsplit_by_size=Dividir pelo tamanho + +action_pdf_insert_at_page=Inserir PDF ''{0}'' na p\u00e1gina ''{1}'', e copiar em ''{2}'' +title_action_pdf_insert_at_page=Inserir PDF na p\u00e1gina +pdfinsert_at_page=Inserir na p\u00e1gina +pdfinsert_name=Nome +pdfinsert_content=Inserir + +action_pdf_watermark=Inserir marca d\u2018\u00e1gua +title_action_pdf_watermark=Marca d\u2018\u00e1gua +pdfwatermark_image=Imagem da Marca d\u2018\u00e1gua +pdfwatermark_image_selector=Clique aqui para selecionar a imagem de marca d\u2018\u00e1gua +pdfwatermark_pages=P\u00e1ginas a inserir marca d\u2018\u00e1gua +pdfwatermark_depth=Posição da marca d\u2018\u00e1gua (Em frente/atr\u00e1s) +pdfwatermark_type=Tipo da marca d\u2018\u00e1gua +pdfwatermark_text=Texto da marca d\u2018\u00e1gua +pdfwatermark_font=Fonte da marca d\u2018\u00e1gua +pdfwatermark_size=Tamanho da fonte da marca d\u2018\u00e1gua +pdfwatermark_inplace=Aplicar no local +pdfwatermark_page=P\u00e1gina da marca d\u2018\u00e1gua + +action_pdf_encryption=Criptografar PDF, configurar permiss\u00f5es e salvar documento resultante em ''{0}'' +title_action_pdf_encryption=Criptografar PDF e configurar permiss\u00f5es +pdfencryption_userpassword=Senha para acesso +pdfencryption_ownerpassword=Senha para descriptografar +pdfencryption_allowprint=Permitir impress\u00f5o +pdfencryption_allowcopy=Permitir copiar +pdfencryption_allowcontentmodification=Permitir modifica\u00e7\u00e3o de conte\u00fado +pdfencryption_allowannotationmodification=Permitir modifica\u00e7\u00e3o de anotaç\u00f5es +pdfencryption_allowformfill=Permitir preenchimento de formul\u00e1rio +pdfencryption_allowscreenreader=Permitir leitura na tela +pdfencryption_allowdegradedprint=Permitir impress\u00e3o reduzida +pdfencryption_allowassembly=Permitir montagem +pdfencryption_encryptionlevel=N\u00edvel de criptografia +pdfencryption_excludemetadata=Exluir metadados + +action_pdf_signature=Assinar +title_action_pdf_signature=Assinar digitalmente +#pdfsignature_private_key=Private key file +pdfsignature_private_key=Arquivo de armazenamento da chave +pdfsignature_key_password=Senha +pdfsignature_reason=Motivo +pdfsignature_location=Local +pdfsignature_visibility=Aplicar assinatura vis\u00edvel +pdfsignature_width=Largura +pdfsignature_height=Altura +pdfsignature_key_type=Tipo de chave + +pdfsignature_alias=Apelido +pdfsignature_store_password=Senha de armazenamento da chave + +# common elements used by other stamp types +pdfstamp_position=Posi\u00e7\u00e3o pr\u00e9-definida +pdfstamp_location_x=X absoluto (em pixels) +pdfstamp_location_y=Y absoluto (em pixels) + +action_pdf_delete=Remover p\u00e1ginas +pdfdelete_deletepages=P\u00e1ginas para remover +pdfdelete_name=Nome do novo arquivo + +action_pdf_reduce_size=Reduzir tamanho +title_action_pdf_reduce_size=Reduzir tamanho +pdfreduce_size_name=Nome do novo arquivo + +##### These messages are the ones that appear in the Share forms ##### + +pdf-append.title=Juntar +pdf-append.description=Juntar para outro PDF +pdf-append.target-node.display-label=Arquivo a ser juntado +pdf-append.destination-folder.display-label=Pasta de destino +pdf-append.destination-name.display-label=Nome do novo arquivo +pdf-append.inplace.display-label=Sobrepor + +pdf-delete-page.title=Remover p\u00e1ginas +pdf-delete-page.description=Remover p\u00e1ginas +pdf-delete-page.page.display-label=P\u00e1ginas para remover (separado por v\u00edrgula) +pdf-delete-page.destination-folder.display-label=Pasta de destino +pdf-delete-page.destination-name.display-label=Nome do novo arquivo +pdf-delete-page.inplace.display-label=Sobrepor + +pdf-extract-page.title=Extrair +pdf-extract-page.description=Extrair p\u00e1ginas de um PDF +pdf-extract-page.page.display-label=P\u00e1gina para extrair (separado por v\u00edrgula) +pdf-extract-page.destination-folder.display-label=Pasta de destino +pdf-extract-page.destination-name.display-label=Nome do novo arquivo + +pdf-rotate.title=Girar +pdf-rotate.description=Girar as p\u00e1ginas deste PDF +pdf-rotate.degrees.display-label=Graus de giro (90, 180, 270) +pdf-rotate.destination-folder.display-label=Pasta de destino +pdf-rotate.destination-name.display-label=Nome do novo arquivo +pdf-rotate.inplace.display-label=Sobrepor +pdf-rotate.page.display-label=Aplicar \u00e0s p\u00e1gina(s) + +pdf-encryption.title=Criptografar +pdf-encryption.description=Criptografar PDF e configurar permiss\u00f5es +pdf-encryption.destination-folder.display-label=Pasta de destino +pdf-encryption.destination-name.display-label=Nome do novo arquivo +pdf-encryption.user-password.display-label=Senha para acesso +pdf-encryption.owner-password.display-label=Senha para descriptografar +pdf-encryption.allow-print.display-label=Permitir impress\u00e3o +pdf-encryption.allow-copy.display-label=Permitir copiar +pdf-encryption.allow-content-modification.display-label=Permitir modifica\u00e7\u00e3o +pdf-encryption.allow-annotation-modification.display-label=Permitir modifica\u00e7\u00e3o de anota\u00e7\u00f5es +pdf-encryption.allow-form-fill.display-label=Permitir preenchimento de formul\u00e1rio +pdf-encryption.allow-screen-reader.display-label=Permitir leitura de tela +pdf-encryption.allow-degraded-print.display-label=Permitir impress\u00e3o reduzida +pdf-encryption.allow-assembly.display-label=Permitir montagem +pdf-encryption.encryption-level.display-label=N\u00edvel de criptografia +pdf-encryption.exclude-metadata.display-label=Excluir metadados na criptografia +pdf-encryption.inplace.display-label=Sobrepor + +pdf-decryption.title=Descriptografar +pdf-decryption.description=Descriptografar PDF +pdf-decryption.destination-folder.display-label=Pasta de destino +pdf-decryption.destination-name.display-label=Nome do novo arquivo +pdf-decryption.owner-password.display-label=Senha para descriptografar +pdf-decryption.inplace.display-label=Sobrepor + +pdf-insert-at-page.title=Inserir +pdf-insert-at-page.description=Inserir em outro PDF +pdf-insert-at-page.destination-folder.display-label=Pasta de destino +pdf-insert-at-page.page.display-label=Inserir na p\u00e1gina +pdf-insert-at-page.destination-name.display-label=Nome do novo arquivo +pdf-insert-at-page.insert-content.display-label=Conte\u00f9do para inserir +pdf-insert-at-page.inplace.display-label=Sobrepor + +pdf-signature.title=Assinar +pdf-signature.description=Assinar digitalmente +pdf-signature.destination-folder.display-label=Pasta de destino +pdf-signature.destination-name.display-label=Nome do novo arquivo +pdf-signature.private-key.display-label=Chave privada +pdf-signature.visibility.display-label=Aplicar assinatura +pdf-signature.location.display-label=Local +pdf-signature.reason.display-label=Motivo +pdf-signature.key-password.display-label=Senha de armazenamento da chave +pdf-signature.width.display-label=Largura +pdf-signature.height.display-label=Altura +pdf-signature.key-type.display-label=Tipo de chave +pdf-signature.alias.display-label=Apelido +pdf-signature.store-password.display-label=Senha +pdf-signature.location-x.display-label=Posi\u00e7\u00e3o x da assinatura +pdf-signature.location-y.display-label=Posi\u00e7\u00e3o y da assinatura +pdf-signature.position.display-label=Posi\u00e7\u00e3o +pdf-signature.inplace.display-label=Sobrepor +pdf-signature.page.display-label=Aplicar \u00e0s p\u00e1gina + +pdf-split.title=Dividir +pdf-split.description=Dividir em p\u00e1ginas individuais +pdf-split.destination-folder.display-label=Pasta de destino +pdf-split.split-frequency.display-label=Dividir a cada (p\u00e1ginas) +pdf-split.inplace.display-label=Sobrepor + +pdf-split-at-page.title=Dividir na p\u00e1gina +pdf-split-at-page.description=Dividir na p\u00e1gina espec\u00edfica +pdf-split-at-page.destination-folder.display-label=Pasta de destino +pdf-split-at-page.page.display-label=Dividir na p\u00e1gina +pdf-split-at-page.inplace.display-label=Sobrepor + +pdf-split-by-size.title=Dividir pelo tamanho +pdf-split-by-size.description=Dividir pelo tamanho +pdf-split-by-size.destination-folder.display-label=Pasta de destino +pdf-split-by-size.page.display-label=Dividir pelo tamanho +pdf-split-by-size.inplace.display-label=Sobrepor +pdf-split-by-size.unit.display-label=Unidade +pdf-split-by-size.size.display-label=Tamanho +pdf-split-by-size.predefine.display-label=Tamanho predefinido + +pdf-reduce-size.title=Reduzir tamanho +pdf-reduce-size.description=Reduzir tamanho otimizando os objetos desnecess�rios +pdf-reduce-size.destination-folder.display-label=Pasta destino +pdf-reduce-size.destination-name.display-label=Nome do novo arquivo +pdf-reduce-size.rate.display-label=Taxa +pdf-reduce-size.executeAsynchronously.display-label=Executar em segundo plano +pdf-reduce-size.inplace.display-label=Sobrepor + +pdf-watermark.title=Marca d\u2018\u00e1gua +pdf-watermark.description=Adicionar marca d\u2018\u00e1gua para um PDF +pdf-watermark.watermark-image.display-label=Imagem de marca d\u2018\u00e1gua +pdf-watermark.destination-folder.display-label=Pasta de destino +pdf-watermark.destination-name.display-label=Nome do novo arquivo +pdf-watermark.watermark-pages.display-label=P\u00e1ginas +pdf-watermark.watermark-depth.display-label=Profundidade +pdf-watermark.watermark-type.display-label=Tipo +pdf-watermark.watermark-text.display-label=Texto +pdf-watermark.watermark-font.display-label=Fonte +pdf-watermark.watermark-size.display-label=Tamanho da fonte +pdf-watermark.location-x.display-label=Posi\u00e7\u00e3o x da marca d\u2018\u00e1gua +pdf-watermark.location-y.display-label=Posi\u00e7\u00e3o y da marca d\u2018\u00e1gua +pdf-watermark.position.display-label=Posi\u00e7\u00e3o +pdf-watermark.inplace.display-label=Sobrepor +pdf-watermark.page.display-label=Aplicar \u00e0(s) p\u00e1gina(s) + +pdftoolkit.form.pagescheme=Use o esquema de p\u00e1ginas +pdftoolkit.form.pagescheme.odd=\u00cdmpar +pdftoolkit.form.pagescheme.even=Par +pdftoolkit.form.pagescheme.all=Todos diff --git a/pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/messages/workflow-messages.properties b/pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/messages/workflow-messages.properties new file mode 100644 index 0000000..7a7dcfa --- /dev/null +++ b/pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/messages/workflow-messages.properties @@ -0,0 +1,5 @@ +# +# Activiti My Process Workflow +# +my-process.workflow.title=My Process +my-process.workflow.description=This is my custom process \ No newline at end of file diff --git a/pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/model/pdftoolkitModel.xml b/pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/model/pdftoolkitModel.xml new file mode 100644 index 0000000..dc1da79 --- /dev/null +++ b/pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/model/pdftoolkitModel.xml @@ -0,0 +1,61 @@ + + + + + PDF Toolkit content model + Nathan McMinn + 1.0 + + + + + + + + + + + + + + + + + Signed + + + Signed By + d:text + + + Signature Date + d:datetime + + + Location + d:text + + + Reason + d:text + + + + + + + Encrypted + + + Encrypted By + d:text + + + Encryption Date + d:datetime + + + + + + diff --git a/pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/module-context.xml b/pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/module-context.xml new file mode 100644 index 0000000..ef9c4cf --- /dev/null +++ b/pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/module-context.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/module.properties b/pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/module.properties new file mode 100644 index 0000000..158500f --- /dev/null +++ b/pdf-toolkit-platform/src/main/resources/alfresco/module/pdf-toolkit-platform/module.properties @@ -0,0 +1,48 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + + +# SDK Sample module + +# ==== Beginning of Alfresco required/optional properties ====== # +# NB: These properties are filtered at build time by Maven, single +# sourcing from POM properties +module.id=${project.artifactId} +#module.aliases=myModule-123, my-module +module.title=${project.name} +module.description=${project.description} +module.version=${project.version} + +# The following optional properties can be used to prevent the module from being added +# to inappropriate versions of the WAR file. +# module.repo.version.min=2.0 +# module.repo.version.max=2.1 + +# FIXME: This dependencies should come out of mvn dependencies on amp + +# The following describe dependencies on other modules +# Depends on net.sf.myproject.module.SupportModuleA version ${version} or later +# module.depends.net.sf.myproject.module.SupportModuleA=${version}-* +# Depends on net.sf.myproject.module.SupportModuleA version ${version} to 2.0 +# module.depends.net.sf.myproject.module.SupportModuleB=${version}-2.0 +# Depends on net.sf.myproject.module.SupportModuleC - any version +# module.depends.net.sf.myproject.module.SupportModuleB=* + + +# ==== End of Alfresco required/optional properties ======= # + + +# ==== Beginning of module required properties/optional ====== # \ No newline at end of file diff --git a/pdf-toolkit-share-docker/pom.xml b/pdf-toolkit-share-docker/pom.xml new file mode 100644 index 0000000..debd5b4 --- /dev/null +++ b/pdf-toolkit-share-docker/pom.xml @@ -0,0 +1,73 @@ + + + 4.0.0 + pdf-toolkit-share-docker + Alfresco Share Docker Module + Share Docker Module to generate the final Docker image + jar + + + org.alfresco.extension + alfresco-pdf-toolkit + 1.0-SNAPSHOT + + + + + + + + org.alfresco.extension + pdf-toolkit-share + 1.0-SNAPSHOT + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + + collect-extensions + package + + copy-dependencies + + + ${project.build.directory}/extensions + runtime + + + + + + + + org.apache.maven.plugins + maven-resources-plugin + + + copy-and-filter-docker-resources + validate + + copy-resources + + + ${project.build.directory} + + + src/main/docker + true + + + + + + + + + diff --git a/pdf-toolkit-share-docker/src/main/docker/Dockerfile b/pdf-toolkit-share-docker/src/main/docker/Dockerfile new file mode 100644 index 0000000..6b43fb2 --- /dev/null +++ b/pdf-toolkit-share-docker/src/main/docker/Dockerfile @@ -0,0 +1,16 @@ +FROM ${docker.share.image}:${alfresco.share.version} + +ARG TOMCAT_DIR=/usr/local/tomcat + +# Copy Dockerfile to avoid an error if no JARs exist +COPY Dockerfile extensions/*.jar $TOMCAT_DIR/webapps/share/WEB-INF/lib/ + +# Copy Dockerfile to avoid an error if no AMPs exist +COPY Dockerfile extensions/*.amp $TOMCAT_DIR/amps_share/ +RUN java -jar $TOMCAT_DIR/alfresco-mmt/alfresco-mmt*.jar install \ + $TOMCAT_DIR/amps_share $TOMCAT_DIR/webapps/share -directory -nobackup -force + +COPY share-config-custom.xml $TOMCAT_DIR/shared/classes/alfresco/web-extension + +COPY log4j.properties $TOMCAT_DIR/webapps/share/WEB-INF/classes +COPY hotswap-agent.properties $TOMCAT_DIR/webapps/share/WEB-INF/classes \ No newline at end of file diff --git a/pdf-toolkit-share-docker/src/main/docker/hotswap-agent.properties b/pdf-toolkit-share-docker/src/main/docker/hotswap-agent.properties new file mode 100644 index 0000000..146c0ab --- /dev/null +++ b/pdf-toolkit-share-docker/src/main/docker/hotswap-agent.properties @@ -0,0 +1,49 @@ +# Enable hotswap so that changes in this module will be automatically reloaded +# Watch for changed class files on watchResources path and reload class definition in the running application. +autoHotswap=true +#autoHotswap.port=8000 + +# Add a directory prior to application classpath (load classes and resources). +# +# This may be useful for example in multi module maven project to load class changes from upstream project +# classes. Set extraClasspath to upstream project compiler output and .class file will have precedence to +# classes from built JAR file. +# i.e. monitor /target/classes +# should work with extraClasspath=${project.build.outputDirectory} +# If not try +extraClasspath=/usr/local/tomcat/hotswap-agent + + +# Comma separated list of disabled plugins +# Use plugin name - e.g. +# Hotswapper, AnonymousClassPatch, WatchResources, Hibernate, Spring, Jersey2, Jetty, Tomcat, +# ZK, Logback, JSF, Seam, ELResolver, OsgiEquinox, Proxy, WebObjects, Weld, JBossModules, Resteasy, Gae +disabledPlugins=Hibernate,Spring + +# Add a directory prior to webapp path (load webapp resources). +# +# Load web application resources (such as HTML, JSP, CSS, ...) from this directory prior to default processing. +# Use this setting to set to serve resources from source directory directly (e.g. src/main/webapp). +extraWebappContext=/usr/local/tomcat/hotswap-agent/pdf-toolkit-share/target/classes/META-INF/resources; + +# Load static web resources from different directory. +# +# This setting is dependent on application server plugin(Jetty, Tomcat, JBoss, ...) +webappDir=/usr/local/tomcat/hotswap-agent/pdf-toolkit-share/target/classes/META-INF/resources; + +# Watch for changes in a directory (resources only). +# +# Similar to extraClasspath this property adds classpath when searching for resources (not classes). +# While extra classpath just modifies the classloader, this setting does nothing until the resource +# is really changed. +# +# Sometimes it is not possible to point extraClasspath to your i.e. src/main/resources, because there are multiple +# replacements of resources in a building step (maven filtering resource option). +# This setting will leave i.e. src/target/classes as default source for resources, but after the resource is modified +# in src/main/resources, the new changed resource is served instead. +# watchResources= + +LOGGER.org.hotswap.agent=DEBUG +#LOGGER.org.hotswap.agent.plugin=TRACE +#LOGGER.org.hotswap.agent.watch=TRACE +#LOGGER.org.hotswap.agent.command=TRACE \ No newline at end of file diff --git a/pdf-toolkit-share/src/test/resources/share/log4j.properties b/pdf-toolkit-share-docker/src/main/docker/log4j.properties similarity index 97% rename from pdf-toolkit-share/src/test/resources/share/log4j.properties rename to pdf-toolkit-share-docker/src/main/docker/log4j.properties index 873677f..b2f1566 100644 --- a/pdf-toolkit-share/src/test/resources/share/log4j.properties +++ b/pdf-toolkit-share-docker/src/main/docker/log4j.properties @@ -1,6 +1,7 @@ # Set root logger level to error log4j.rootLogger=error, Console, File +# Console appender definition # # All outputs currently set to be a ConsoleAppender. log4j.appender.Console=org.apache.log4j.ConsoleAppender @@ -10,6 +11,7 @@ log4j.appender.Console.layout=org.apache.log4j.PatternLayout log4j.appender.Console.layout.ConversionPattern=%d{ISO8601} %x %-5p [%c{3}] [%t] %m%n #log4j.appender.Console.layout.ConversionPattern=%d{ABSOLUTE} %-5p [%c] %m%n +# File appender definition # log4j.appender.File=org.apache.log4j.DailyRollingFileAppender log4j.appender.File.File=share.log log4j.appender.File.Append=true diff --git a/pdf-toolkit-share-docker/src/main/docker/share-config-custom.xml b/pdf-toolkit-share-docker/src/main/docker/share-config-custom.xml new file mode 100644 index 0000000..b926f2c --- /dev/null +++ b/pdf-toolkit-share-docker/src/main/docker/share-config-custom.xml @@ -0,0 +1,105 @@ + + + + + + + production + + + + false + + + + + + + + + true + + false + + + + + + + + + + + + + + alfresco-noauth + Alfresco - unauthenticated access + Access to Alfresco Repository WebScripts that do not require authentication + alfresco + http://${acs.host}:8080/alfresco/s + none + + + + alfresco + Alfresco - user access + Access to Alfresco Repository WebScripts that require user authentication + alfresco + http://${acs.host}:8080/alfresco/s + user + + + + alfresco-feed + Alfresco Feed + Alfresco Feed - supports basic HTTP authentication via the EndPointProxyServlet + http + http://${acs.host}:8080/alfresco/s + true + user + + + + activiti-admin + Activiti Admin UI - user access + Access to Activiti Admin UI, that requires user authentication + activiti-admin-connector + http://${acs.host}:8080/alfresco/activiti-admin + user + + + + alfresco-api + alfresco + Alfresco Public API - user access + Access to Alfresco Repository Public API that require user authentication. + This makes use of the authentication that is provided by parent 'alfresco' endpoint. + alfresco + http://${acs.host}:8080/alfresco/api + user + + + + + diff --git a/pdf-toolkit-share/README.md b/pdf-toolkit-share/README.md deleted file mode 100644 index 1e3f235..0000000 --- a/pdf-toolkit-share/README.md +++ /dev/null @@ -1,33 +0,0 @@ -# Alfresco Share JAR Module - SDK 3 - -To run this module use `mvn clean install -DskipTests=true alfresco:run` or `./run.sh` and verify that it - - * Runs the embedded Tomcat + H2 DB - * Runs Alfresco Share - * Packages both as JAR and AMP assembly - -Note. You access Share as follows: http://localhost:8081/share - -Note. You need an Alfresco Platform instance running at http://localhost:8080/alfresco that Share can talk to. - Typically you will just kick off a platform-jar module for that. - -# Few things to notice - - * No parent pom - * WAR assembly is handled by the Alfresco Maven Plugin configuration, if needed - * Standard JAR packaging and layout - * Works seamlessly with Eclipse and IntelliJ IDEA - * JRebel for hot reloading, JRebel maven plugin for generating rebel.xml, agent usage: `MAVEN_OPTS=-Xms256m -Xmx1G -agentpath:/home/martin/apps/jrebel/lib/libjrebel64.so` - * AMP as an assembly - * [Configurable Run mojo](https://github.com/Alfresco/alfresco-sdk/blob/sdk-3.0/plugins/alfresco-maven-plugin/src/main/java/org/alfresco/maven/plugin/RunMojo.java) in the `alfresco-maven-plugin` - * No unit testing/functional tests just yet - * Resources loaded from META-INF - * Web Fragment (this includes a sample servlet configured via web fragment) - -# TODO - - * Abstract assembly into a dependency so we don't have to ship the assembly in the archetype - - - - diff --git a/pdf-toolkit-share/debug.bat b/pdf-toolkit-share/debug.bat deleted file mode 100644 index 40ba50e..0000000 --- a/pdf-toolkit-share/debug.bat +++ /dev/null @@ -1,10 +0,0 @@ -:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -:: Dev environment startup script for Alfresco Community. :: -:: :: -:: Note. requires Alfresco.war to be running in another :: -:: Tomcat on port 8080. :: -:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -@echo off - -mvnDebug clean install alfresco:run - diff --git a/pdf-toolkit-share/debug.sh b/pdf-toolkit-share/debug.sh deleted file mode 100644 index 773d0ac..0000000 --- a/pdf-toolkit-share/debug.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -# Note. requires Alfresco.war to be running in another Tomcat on port 8080 - -mvnDebug clean install alfresco:run diff --git a/pdf-toolkit-share/run.bat b/pdf-toolkit-share/run.bat deleted file mode 100644 index 8c88313..0000000 --- a/pdf-toolkit-share/run.bat +++ /dev/null @@ -1,9 +0,0 @@ -:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -:: Dev environment startup script for Alfresco Community. :: -:: :: -:: Note. requires Alfresco.war to be running in another :: -:: Tomcat on port 8080. :: -:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -@echo off - -mvn clean install alfresco:run diff --git a/pdf-toolkit-share/run.sh b/pdf-toolkit-share/run.sh deleted file mode 100755 index 45abd23..0000000 --- a/pdf-toolkit-share/run.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -# Note. requires Alfresco.war to be running in another Tomcat on port 8080 - -mvn clean install alfresco:run diff --git a/pdf-toolkit-share/src/main/resources/META-INF/pdftoolkit/components/doclib/rule-config-action-custom.js b/pdf-toolkit-share/src/main/resources/META-INF/pdftoolkit/components/doclib/rule-config-action-custom.js new file mode 100644 index 0000000..386d742 --- /dev/null +++ b/pdf-toolkit-share/src/main/resources/META-INF/pdftoolkit/components/doclib/rule-config-action-custom.js @@ -0,0 +1,74 @@ +if (typeof PDFToolKIT == "undefined" || !PDFToolKIT) +{ + var PDFToolKIT = {}; +} + +PDFToolKIT.RuleConfigActionCustom = function(htmlId) +{ + PDFToolKIT.RuleConfigActionCustom.superclass.constructor.call(this, htmlId); + + // Re-register with our own name + this.name = "PDFToolKIT.RuleConfigActionCustom"; + Alfresco.util.ComponentManager.reregister(this); + + // Instance variables + this.customisations = YAHOO.lang.merge(this.customisations, PDFToolKIT.RuleConfigActionCustom.superclass.customisations); + this.renderers = YAHOO.lang.merge(this.renderers, PDFToolKIT.RuleConfigActionCustom.superclass.renderers); + + return this; +}; + +hideParameterCustom= function (parameterDefinitions) + { + + for (var i = 0, il = parameterDefinitions.length; i < il; i++) + { + if(parameterDefinitions[i].name=="destination-folder") + { + parameterDefinitions[i]._type = "hidden"; + } + } + }; + +YAHOO.extend(PDFToolKIT.RuleConfigActionCustom, Alfresco.RuleConfigAction, +{ + + /** + * CUSTOMISATIONS + */ + + customisations: + { + WaterMarkPDF: + { + text: function(configDef, ruleConfig, configEl) + { + // Display as path + this._getParamDef(configDef, "destination-folder")._type = "path"; + return configDef; + }, + edit: function(configDef, ruleConfig, configEl) + { + // Hide all parameters since we are using a custom ui but set default values + // this._hideParameters(configDef.parameterDefinitions); + + + if (configDef.parameterDefinitions) + { + hideParameterCustom(configDef.parameterDefinitions); + } + + // Make parameter renderer create a "Destination" button that displays an destination folder browser + configDef.parameterDefinitions.splice(0,0,{ + type: "arca:destination-dialog-button", + displayLabel: this.msg("label.destination.folder"), + _buttonLabel: this.msg("button.select-folder"), + _destinationParam: "destination-folder" + }); + + return configDef; + } + }, + }, + +}); \ No newline at end of file diff --git a/pdf-toolkit-share/src/main/resources/META-INF/resources/pdf-toolkit-share/js/tutorials/widgets/TemplateWidget.js b/pdf-toolkit-share/src/main/resources/META-INF/resources/pdf-toolkit-share/js/tutorials/widgets/TemplateWidget.js new file mode 100644 index 0000000..4a39edb --- /dev/null +++ b/pdf-toolkit-share/src/main/resources/META-INF/resources/pdf-toolkit-share/js/tutorials/widgets/TemplateWidget.js @@ -0,0 +1,20 @@ +define(["dojo/_base/declare", + "dijit/_WidgetBase", + "alfresco/core/Core", + "dijit/_TemplatedMixin", + "dojo/text!./templates/TemplateWidget.html" + ], + function(declare, _Widget, Core, _Templated, template) { + return declare([_Widget, Core, _Templated], { + templateString: template, + i18nRequirements: [ {i18nFile: "./i18n/TemplateWidget.properties"} ], + cssRequirements: [{cssFile:"./css/TemplateWidget.css"}], + + buildRendering: function example_widgets_TemplateWidget__buildRendering() { + this.greeting = this.message('hello-label'); + + this.inherited(arguments); + + } + }); +}); \ No newline at end of file diff --git a/pdf-toolkit-share/src/main/resources/META-INF/resources/pdf-toolkit-share/js/tutorials/widgets/css/TemplateWidget.css b/pdf-toolkit-share/src/main/resources/META-INF/resources/pdf-toolkit-share/js/tutorials/widgets/css/TemplateWidget.css new file mode 100644 index 0000000..dcc67a9 --- /dev/null +++ b/pdf-toolkit-share/src/main/resources/META-INF/resources/pdf-toolkit-share/js/tutorials/widgets/css/TemplateWidget.css @@ -0,0 +1,6 @@ +.my-template-widget { + border: 1px #000000 solid; + padding: 1em; + width: 100px; + background-color: deepskyblue; +} \ No newline at end of file diff --git a/pdf-toolkit-share/src/main/resources/META-INF/resources/pdf-toolkit-share/js/tutorials/widgets/i18n/TemplateWidget.properties b/pdf-toolkit-share/src/main/resources/META-INF/resources/pdf-toolkit-share/js/tutorials/widgets/i18n/TemplateWidget.properties new file mode 100644 index 0000000..6a69646 --- /dev/null +++ b/pdf-toolkit-share/src/main/resources/META-INF/resources/pdf-toolkit-share/js/tutorials/widgets/i18n/TemplateWidget.properties @@ -0,0 +1,3 @@ +hello-label=Hello from i18n + + diff --git a/pdf-toolkit-share/src/main/resources/META-INF/resources/pdf-toolkit-share/js/tutorials/widgets/templates/TemplateWidget.html b/pdf-toolkit-share/src/main/resources/META-INF/resources/pdf-toolkit-share/js/tutorials/widgets/templates/TemplateWidget.html new file mode 100644 index 0000000..9e09e4a --- /dev/null +++ b/pdf-toolkit-share/src/main/resources/META-INF/resources/pdf-toolkit-share/js/tutorials/widgets/templates/TemplateWidget.html @@ -0,0 +1 @@ +
${greeting}
\ No newline at end of file diff --git a/pdf-toolkit-share/src/main/resources/alfresco/module/pdf-toolkit-share/log4j.properties b/pdf-toolkit-share/src/main/resources/alfresco/module/pdf-toolkit-share/log4j.properties new file mode 100644 index 0000000..29523b4 --- /dev/null +++ b/pdf-toolkit-share/src/main/resources/alfresco/module/pdf-toolkit-share/log4j.properties @@ -0,0 +1 @@ +# Add here module-specific custom log4j.properties configuration \ No newline at end of file diff --git a/pdf-toolkit-share/src/main/resources/alfresco/web-extension/messages/pdf-toolkit-share.properties b/pdf-toolkit-share/src/main/resources/alfresco/web-extension/messages/pdf-toolkit-share.properties new file mode 100644 index 0000000..1139421 --- /dev/null +++ b/pdf-toolkit-share/src/main/resources/alfresco/web-extension/messages/pdf-toolkit-share.properties @@ -0,0 +1,25 @@ +# This file should contain messages and labels specific to this share extension +# Put here things like: +# Content Model Aspect and Type Labels +# Form field labels +# Doc lib Action labels and messages +# Doc Lib Action Forms labels +# + +# Labels for custom types and aspects +# Used in "Manage Aspects" and "Change Type" dialogs +# +type.acme_document=ACME Document +aspect.acme_securityClassified=Security Classified + +# View,Edit,Search,Create Form labels for types and aspects +# +form.set.label.acme.document= ACME Document Information +form.field.label.acme.documentId=ACME Document Id +form.field.label.acme.securityClassification=Security Classification + +# Advanced Search Form labels (only for types) +# +form.label.advancedsearch.acmeDocument=ACME Documents +form.description.advancedsearch.acmeDocument=Search for any ACME Documents + diff --git a/pdf-toolkit-share/src/main/resources/alfresco/web-extension/pdftoolkit-context.xml b/pdf-toolkit-share/src/main/resources/alfresco/web-extension/pdf-toolkit-share-slingshot-application-context.xml similarity index 51% rename from pdf-toolkit-share/src/main/resources/alfresco/web-extension/pdftoolkit-context.xml rename to pdf-toolkit-share/src/main/resources/alfresco/web-extension/pdf-toolkit-share-slingshot-application-context.xml index ba8d05e..f957641 100644 --- a/pdf-toolkit-share/src/main/resources/alfresco/web-extension/pdftoolkit-context.xml +++ b/pdf-toolkit-share/src/main/resources/alfresco/web-extension/pdf-toolkit-share-slingshot-application-context.xml @@ -1,9 +1,29 @@ - + + + - + + + + + alfresco.web-extension.messages.pdf-toolkit-share + + + + + @@ -39,4 +59,5 @@ + \ No newline at end of file diff --git a/pdf-toolkit-share/src/main/resources/alfresco/web-extension/site-data/extensions/pdf-toolkit-share-example-widgets.xml b/pdf-toolkit-share/src/main/resources/alfresco/web-extension/site-data/extensions/pdf-toolkit-share-example-widgets.xml new file mode 100644 index 0000000..67cde32 --- /dev/null +++ b/pdf-toolkit-share/src/main/resources/alfresco/web-extension/site-data/extensions/pdf-toolkit-share-example-widgets.xml @@ -0,0 +1,20 @@ + + + + pdf-toolkit-share - Example Aikau Widgets + 1.0 + true + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pdf-toolkit-share/src/main/resources/alfresco/web-extension/site-webscripts/com/example/pages/simple-page.get.desc.xml b/pdf-toolkit-share/src/main/resources/alfresco/web-extension/site-webscripts/com/example/pages/simple-page.get.desc.xml new file mode 100644 index 0000000..2790faa --- /dev/null +++ b/pdf-toolkit-share/src/main/resources/alfresco/web-extension/site-webscripts/com/example/pages/simple-page.get.desc.xml @@ -0,0 +1,6 @@ + + Simple Page + Simple page definition + Share + /simple-page + \ No newline at end of file diff --git a/pdf-toolkit-share/src/main/resources/alfresco/web-extension/site-webscripts/com/example/pages/simple-page.get.html.ftl b/pdf-toolkit-share/src/main/resources/alfresco/web-extension/site-webscripts/com/example/pages/simple-page.get.html.ftl new file mode 100644 index 0000000..f839a45 --- /dev/null +++ b/pdf-toolkit-share/src/main/resources/alfresco/web-extension/site-webscripts/com/example/pages/simple-page.get.html.ftl @@ -0,0 +1 @@ +<@processJsonModel group="share"/> \ No newline at end of file diff --git a/pdf-toolkit-share/src/main/resources/alfresco/web-extension/site-webscripts/com/example/pages/simple-page.get.js b/pdf-toolkit-share/src/main/resources/alfresco/web-extension/site-webscripts/com/example/pages/simple-page.get.js new file mode 100644 index 0000000..8cd0877 --- /dev/null +++ b/pdf-toolkit-share/src/main/resources/alfresco/web-extension/site-webscripts/com/example/pages/simple-page.get.js @@ -0,0 +1,29 @@ +model.jsonModel = { + widgets: [{ + id: "SET_PAGE_TITLE", + name: "alfresco/header/SetTitle", + config: { + title: "This is a sample HELLO page" + } + }, + { + id: "MY_HORIZONTAL_WIDGET_LAYOUT", + name: "alfresco/layout/HorizontalWidgets", + config: { + widgetWidth: 50, + widgets: [ + { + id: "DEMO_SIMPLE_LOGO", + name: "alfresco/logo/Logo", + config: { + logoClasses: "alfresco-logo-only" + } + }, + { + id: "DEMO_SIMPLE_MSG", + name: "tutorials/widgets/TemplateWidget" + } + ] + } + }] +}; \ No newline at end of file diff --git a/pdf-toolkit-share/src/main/resources/alfresco/web-extension/site-webscripts/org/alfresco/README.md b/pdf-toolkit-share/src/main/resources/alfresco/web-extension/site-webscripts/org/alfresco/README.md new file mode 100644 index 0000000..f2c0a4f --- /dev/null +++ b/pdf-toolkit-share/src/main/resources/alfresco/web-extension/site-webscripts/org/alfresco/README.md @@ -0,0 +1,6 @@ +## If you are overriding out-of-the-box Alfresco web scripts, put these files here +## in the correct org.alfresco... package. +## If you are defining a new custom web script, add it under +## resources/alfresco/web-extension/site-webscripts/{your domain path}. +## + diff --git a/pdf-toolkit-share/src/main/resources/alfresco/web-extension/site-webscripts/org/alfresco/components/rules/config/rule-config-action.get.config.xml b/pdf-toolkit-share/src/main/resources/alfresco/web-extension/site-webscripts/org/alfresco/components/rules/config/rule-config-action.get.config.xml new file mode 100644 index 0000000..8d85ce8 --- /dev/null +++ b/pdf-toolkit-share/src/main/resources/alfresco/web-extension/site-webscripts/org/alfresco/components/rules/config/rule-config-action.get.config.xml @@ -0,0 +1,100 @@ + + + + PDFToolKIT.RuleConfigActionCustom + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Select + SpecialiseType + AddFeatures + RemoveFeatures + CheckIn + Checkout + Copy + Move + SimpleWorkflow + Mail + LinkCategory + Script + Transform + Transform + Import + SetPropertyValue + WaterMarkPDF + + + diff --git a/pdf-toolkit-share/src/main/resources/alfresco/web-extension/site-webscripts/org/alfresco/components/rules/config/rule-config-action.get.properties b/pdf-toolkit-share/src/main/resources/alfresco/web-extension/site-webscripts/org/alfresco/components/rules/config/rule-config-action.get.properties new file mode 100644 index 0000000..048012a --- /dev/null +++ b/pdf-toolkit-share/src/main/resources/alfresco/web-extension/site-webscripts/org/alfresco/components/rules/config/rule-config-action.get.properties @@ -0,0 +1 @@ +label.destination.folder= Destination Folder \ No newline at end of file diff --git a/pdf-toolkit-share/src/main/resources/alfresco/web-extension/site-webscripts/org/alfresco/components/rules/rule-details.get.html.ftl b/pdf-toolkit-share/src/main/resources/alfresco/web-extension/site-webscripts/org/alfresco/components/rules/rule-details.get.html.ftl new file mode 100644 index 0000000..6edf515 --- /dev/null +++ b/pdf-toolkit-share/src/main/resources/alfresco/web-extension/site-webscripts/org/alfresco/components/rules/rule-details.get.html.ftl @@ -0,0 +1,57 @@ +<@markup id="css" > + <#-- CSS Dependencies --> + <@link href="${url.context}/res/components/rules/config/rule-config.css" group="rules"/> + <@link href="${url.context}/res/components/rules/config/rule-config-type.css" group="rules"/> + <@link href="${url.context}/res/components/rules/config/rule-config-condition.css" group="rules"/> + <@link href="${url.context}/res/components/rules/rule-details.css" group="rules"/> + + +<@markup id="js"> + <#-- JavaScript Dependencies --> + <@script src="${url.context}/res/components/rules/config/rule-config-util.js" group="rules"/> + <@script src="${url.context}/res/components/rules/config/rule-config.js" group="rules"/> + <@script src="${url.context}/res/components/rules/config/rule-config-type.js" group="rules"/> + <@script src="${url.context}/res/components/rules/config/rule-config-condition.js" group="rules"/> + <@script src="${url.context}/res/components/rules/config/rule-config-action.js" group="rules"/> + <@script src="${url.context}/res/components/rules/rule-details.js" group="rules"/> + + + <@script src="${url.context}/res/pdftoolkit/components/doclib/rule-config-action-custom.js" group="rules_custom"> + + +<@markup id="widgets"> + <@createWidgets group="rules"/> + + +<@markup id="html"> + <@uniqueIdDiv> + <#assign el=args.htmlid> +
+ +
+ + + diff --git a/pdf-toolkit-share/src/main/resources/alfresco/web-extension/site-webscripts/org/alfresco/components/rules/rule-edit.get.html.ftl b/pdf-toolkit-share/src/main/resources/alfresco/web-extension/site-webscripts/org/alfresco/components/rules/rule-edit.get.html.ftl new file mode 100644 index 0000000..d331483 --- /dev/null +++ b/pdf-toolkit-share/src/main/resources/alfresco/web-extension/site-webscripts/org/alfresco/components/rules/rule-edit.get.html.ftl @@ -0,0 +1,141 @@ +<@markup id="css" > + <#-- CSS Dependencies --> + <@link href="${url.context}/res/components/rules/config/rule-config.css" group="rules"/> + <@link href="${url.context}/res/components/rules/config/rule-config-type.css" group="rules"/> + <@link href="${url.context}/res/components/rules/config/rule-config-condition.css" group="rules"/> + <@link href="${url.context}/res/components/rules/rule-edit.css" group="rules"/> + <@link href="${url.context}/res/modules/documentlibrary/global-folder.css" group="rules"/> + <@link href="${url.context}/res/modules/rules/actions/workflow.css" group="rules"/> + <@link href="${url.context}/res/modules/rules/actions/checkin.css" group="rules"/> + <@link href="${url.context}/res/components/people-finder/authority-finder.css" group="rules"/> + <@link href="${url.context}/res/modules/email-form.css" group="rules"/> + <@link href="${url.context}/res/modules/data-picker.css" group="rules"/> + <@link href="${url.context}/res/modules/property-picker.css" group="rules"/> + <@link href="${url.context}/res/modules/rules/rules-property-picker.css" group="rules"/> + <@link href="${url.context}/res/components/object-finder/object-finder.css" group="rules"/> + + +<@markup id="js"> + <#-- JavaScript Dependencies --> + <@script src="${url.context}/res/components/rules/config/rule-config-util.js" group="rules"/> + <@script src="${url.context}/res/components/rules/config/rule-config.js" group="rules"/> + <@script src="${url.context}/res/components/rules/config/rule-config-type.js" group="rules"/> + <@script src="${url.context}/res/components/rules/config/rule-config-condition.js" group="rules"/> + <@script src="${url.context}/res/components/rules/config/rule-config-action.js" group="rules"/> + <@script src="${url.context}/res/components/form/date.js" group="rules"/> + <@script src="${url.context}/res/components/form/date-picker.js" group="rules"/> + <@script src="${url.context}/res/yui/calendar/calendar.js" group="rules"/> + <@script src="${url.context}/res/components/rules/rule-edit.js" group="rules"/> + <@script src="${url.context}/res/modules/documentlibrary/global-folder.js" group="rules"/> + <@script src="${url.context}/res/modules/rules/actions/workflow.js" group="rules"/> + <@script src="${url.context}/res/modules/rules/actions/checkin.js" group="rules"/> + <@script src="${url.context}/res/components/people-finder/authority-finder.js" group="rules"/> + <@script src="${url.context}/res/modules/email-form.js" group="rules"/> + <@script src="${url.context}/res/modules/data-picker.js" group="rules"/> + <@script src="${url.context}/res/modules/property-picker.js" group="rules"/> + <@script src="${url.context}/res/modules/rules/rules-property-picker.js" group="rules"/> + <@script src="${url.context}/res/components/object-finder/object-finder.js" group="rules"/> + <@script src="${url.context}/res/modules/form/control-wrapper.js" group="rules"/> + <@script src="${url.context}/res/components/common/common-component-style-filter-chain.js" group="rules"/> + + + <@script src="${url.context}/res/pdftoolkit/components/doclib/rule-config-action-custom.js" group="rules_custom"> + + +<@markup id="widgets"> + <@createWidgets group="rules"/> + + +<@markup id="html"> + <@uniqueIdDiv> + <#include "config/rule-config.lib.ftl" /> + <#assign el=args.htmlid> +
+
+ + + +

${msg("header.editRule")}<#if ruleTitle??>: ${ruleTitle?html}

+

${msg("header.newRule")}

+ +
+ * ${msg("form.required.fields")} +
+ +
+ +

${msg("header.general")}

+
+ +
+ + +
+
+ + +
+ +

${msg("header.defineRule")}

+
+ +
${msg("message.loading")}
+ + +

${msg("header.otherOptions")}

+
+ +
+ + +
+
+ + +
+
+ + +
+
+ + + + +
+
 
+
+
+ + + + + + + + +
+
+
+ + + diff --git a/run.bat b/run.bat new file mode 100644 index 0000000..3b5ac08 --- /dev/null +++ b/run.bat @@ -0,0 +1,127 @@ +@ECHO OFF + +SET COMPOSE_FILE_PATH=%CD%\target\classes\docker\docker-compose.yml + +IF [%M2_HOME%]==[] ( + SET MVN_EXEC=mvn +) + +IF NOT [%M2_HOME%]==[] ( + SET MVN_EXEC=%M2_HOME%\bin\mvn +) + +IF [%1]==[] ( + echo "Usage: %0 {build_start|build_start_it_supported|start|stop|purge|tail|reload_share|reload_acs|build_test|test}" + GOTO END +) + +IF %1==build_start ( + CALL :down + CALL :build + CALL :start + CALL :tail + GOTO END +) +IF %1==build_start_it_supported ( + CALL :down + CALL :build + CALL :prepare-test + CALL :start + CALL :tail + GOTO END +) +IF %1==start ( + CALL :start + CALL :tail + GOTO END +) +IF %1==stop ( + CALL :down + GOTO END +) +IF %1==purge ( + CALL:down + CALL:purge + GOTO END +) +IF %1==tail ( + CALL :tail + GOTO END +) +IF %1==reload_share ( + CALL :build_share + CALL :start_share + CALL :tail + GOTO END +) +IF %1==reload_acs ( + CALL :build_acs + CALL :start_acs + CALL :tail + GOTO END +) +IF %1==build_test ( + CALL :down + CALL :build + CALL :prepare-test + CALL :start + CALL :test + CALL :tail_all + CALL :down + GOTO END +) +IF %1==test ( + CALL :test + GOTO END +) +echo "Usage: %0 {build_start|start|stop|purge|tail|reload_share|reload_acs|build_test|test}" +:END +EXIT /B %ERRORLEVEL% + +:start + docker volume create pdf-toolkit-acs-volume + docker volume create pdf-toolkit-db-volume + docker volume create pdf-toolkit-ass-volume + docker-compose -f "%COMPOSE_FILE_PATH%" up --build -d +EXIT /B 0 +:start_share + docker-compose -f "%COMPOSE_FILE_PATH%" up --build -d pdf-toolkit-share +EXIT /B 0 +:start_acs + docker-compose -f "%COMPOSE_FILE_PATH%" up --build -d pdf-toolkit-acs +EXIT /B 0 +:down + if exist "%COMPOSE_FILE_PATH%" ( + docker-compose -f "%COMPOSE_FILE_PATH%" down + ) +EXIT /B 0 +:build + call %MVN_EXEC% clean package +EXIT /B 0 +:build_share + docker-compose -f "%COMPOSE_FILE_PATH%" kill pdf-toolkit-share + docker-compose -f "%COMPOSE_FILE_PATH%" rm -f pdf-toolkit-share + call %MVN_EXEC% clean package -pl pdf-toolkit-share,pdf-toolkit-share-docker +EXIT /B 0 +:build_acs + docker-compose -f "%COMPOSE_FILE_PATH%" kill pdf-toolkit-acs + docker-compose -f "%COMPOSE_FILE_PATH%" rm -f pdf-toolkit-acs + call %MVN_EXEC% clean package -pl pdf-toolkit-integration-tests,pdf-toolkit-platform,pdf-toolkit-platform-docker +EXIT /B 0 +:tail + docker-compose -f "%COMPOSE_FILE_PATH%" logs -f +EXIT /B 0 +:tail_all + docker-compose -f "%COMPOSE_FILE_PATH%" logs --tail="all" +EXIT /B 0 +:prepare-test + call %MVN_EXEC% verify -DskipTests=true -pl pdf-toolkit-platform,pdf-toolkit-integration-tests,pdf-toolkit-platform-docker +EXIT /B 0 +:test + call %MVN_EXEC% verify -pl pdf-toolkit-platform,pdf-toolkit-integration-tests +EXIT /B 0 +:purge + docker volume rm -f pdf-toolkit-acs-volume + docker volume rm -f pdf-toolkit-db-volume + docker volume rm -f pdf-toolkit-ass-volume +EXIT /B 0 \ No newline at end of file diff --git a/run.sh b/run.sh new file mode 100755 index 0000000..ea8b3d7 --- /dev/null +++ b/run.sh @@ -0,0 +1,122 @@ +#!/bin/sh + +export COMPOSE_FILE_PATH="${PWD}/target/classes/docker/docker-compose.yml" + +if [ -z "${M2_HOME}" ]; then + export MVN_EXEC="mvn" +else + export MVN_EXEC="${M2_HOME}/bin/mvn" +fi + +start() { + docker volume create pdf-toolkit-acs-volume + docker volume create pdf-toolkit-db-volume + docker volume create pdf-toolkit-ass-volume + docker-compose -f "$COMPOSE_FILE_PATH" up --build -d +} + +start_share() { + docker-compose -f "$COMPOSE_FILE_PATH" up --build -d pdf-toolkit-share +} + +start_acs() { + docker-compose -f "$COMPOSE_FILE_PATH" up --build -d pdf-toolkit-acs +} + +down() { + if [ -f "$COMPOSE_FILE_PATH" ]; then + docker-compose -f "$COMPOSE_FILE_PATH" down + fi +} + +purge() { + docker volume rm -f pdf-toolkit-acs-volume + docker volume rm -f pdf-toolkit-db-volume + docker volume rm -f pdf-toolkit-ass-volume +} + +build() { + $MVN_EXEC clean package +} + +build_share() { + docker-compose -f "$COMPOSE_FILE_PATH" kill pdf-toolkit-share + yes | docker-compose -f "$COMPOSE_FILE_PATH" rm -f pdf-toolkit-share + $MVN_EXEC clean package -pl pdf-toolkit-share,pdf-toolkit-share-docker +} + +build_acs() { + docker-compose -f "$COMPOSE_FILE_PATH" kill pdf-toolkit-acs + yes | docker-compose -f "$COMPOSE_FILE_PATH" rm -f pdf-toolkit-acs + $MVN_EXEC clean package -pl pdf-toolkit-integration-tests,pdf-toolkit-platform,pdf-toolkit-platform-docker +} + +tail() { + docker-compose -f "$COMPOSE_FILE_PATH" logs -f +} + +tail_all() { + docker-compose -f "$COMPOSE_FILE_PATH" logs --tail="all" +} + +prepare_test() { + $MVN_EXEC verify -DskipTests=true -pl pdf-toolkit-platform,pdf-toolkit-integration-tests,pdf-toolkit-platform-docker +} + +test() { + $MVN_EXEC verify -pl pdf-toolkit-platform,pdf-toolkit-integration-tests +} + +case "$1" in + build_start) + down + build + start + tail + ;; + build_start_it_supported) + down + build + prepare_test + start + tail + ;; + start) + start + tail + ;; + stop) + down + ;; + purge) + down + purge + ;; + tail) + tail + ;; + reload_share) + build_share + start_share + tail + ;; + reload_acs) + build_acs + start_acs + tail + ;; + build_test) + down + build + prepare_test + start + test + tail_all + down + ;; + test) + test + ;; + *) + echo "Usage: $0 {build_start|build_start_it_supported|start|stop|purge|tail|reload_share|reload_acs|build_test|test}" +esac \ No newline at end of file From 034224bf841bd119af288fafe143587bbf598dfd Mon Sep 17 00:00:00 2001 From: Asirika Date: Mon, 17 Feb 2020 10:28:24 +1100 Subject: [PATCH 3/4] update readme --- README.md | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/README.md b/README.md index e8b66fa..2997461 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,54 @@ + +#alfresco-pdf-toolkit +==================== + +The new home of the Alfresco PDF Toolkit (replacing the deprecated Google Code project) + +Alfresco PDF Toolkit adds additional functionality to Alfresco that allows you to work with PDF files. + +The toolkit compatibility matrix and some additional information is available on addons.alfresco.com. If you find this stuff useful, please pop over to the addons site and "like" the project! + +Current Functionality: + +* Append - Append PDF to another PDF, generating a new PDF +* Split - Splits a PDF at a specified interval, (ex. 2 pages, 3 pages, etc.), generating new PDFs for each section. +* Split At - Split PDF into two PDFs at a specific page, generating two new PDFs. +* Insert PDF - Insert PDF at a specific Page +* Delete page(s) from a PDF document +* Extract page(s) from a PDF document +* PDF Watermarking +* PDF Encryption / decryption +* Digital Signatures +* Rotate PDF Documents +* TIFF to PDF transformation (currently rather rudimentary, but functional) +* Extended metadata to capture information about encryption or signature events +* Search for encrypted or signed documents by encryption or signature metadata + + +All of the actions are available as actions that can be used in content rules, and as document library actions in the document browse and detail views. + +Note that as of Version 1.2, the legacy Explorer UI components will no longer be maintained and will be fully removed in version 1.3. + +NOTE: The latest 1.3 betas remove the PDF/A conversion action, since that action has dependencies on Alfresco Enterprise. I'm committed to keeping this project 100% compatible with Alfresco community. The PDF/A action will be released as a separate module for Alfresco Enterprise. + +A teaser screencast is available here: + +http://www.youtube.com/watch?v=cJYpFgx037E + +Functionality in development: + +* Minimally requires Alfresco 3.4 for the repository tier actions, 4.1 for the Share UI components. + +LICENSING + +The Alfresco PDF Toolkit is an unsupported, community developed open source project. The project code itself is released under the +AGPL License. + +iText - Affero GPL 3 (http://itextpdf.com/terms-of-use/agpl.php) + + + + # Alfresco AIO Project - SDK 4.0 This is an All-In-One (AIO) project for Alfresco SDK 4.0. From 471dc1abb9de3cab9e39c02d88a87720a7c45887 Mon Sep 17 00:00:00 2001 From: Asirika Date: Mon, 17 Feb 2020 11:14:29 +1100 Subject: [PATCH 4/4] Enhancing destination folder UI view for all folder rule actions Enhancing destination folder UI view for all folder rule actions --- .../doclib/rule-config-action-custom.js | 7 ++-- .../config/rule-config-action.get.config.xml | 42 ++++++++++++++++++- 2 files changed, 45 insertions(+), 4 deletions(-) diff --git a/pdf-toolkit-share/src/main/resources/META-INF/pdftoolkit/components/doclib/rule-config-action-custom.js b/pdf-toolkit-share/src/main/resources/META-INF/pdftoolkit/components/doclib/rule-config-action-custom.js index 386d742..d31518c 100644 --- a/pdf-toolkit-share/src/main/resources/META-INF/pdftoolkit/components/doclib/rule-config-action-custom.js +++ b/pdf-toolkit-share/src/main/resources/META-INF/pdftoolkit/components/doclib/rule-config-action-custom.js @@ -18,7 +18,7 @@ PDFToolKIT.RuleConfigActionCustom = function(htmlId) return this; }; -hideParameterCustom= function (parameterDefinitions) +hideParameterCustom = function (parameterDefinitions) { for (var i = 0, il = parameterDefinitions.length; i < il; i++) @@ -39,9 +39,9 @@ YAHOO.extend(PDFToolKIT.RuleConfigActionCustom, Alfresco.RuleConfigAction, customisations: { - WaterMarkPDF: + PDFToolKITDestination: { - text: function(configDef, ruleConfig, configEl) + text: function(configDef, ruleConfig, configEl) { // Display as path this._getParamDef(configDef, "destination-folder")._type = "path"; @@ -68,6 +68,7 @@ YAHOO.extend(PDFToolKIT.RuleConfigActionCustom, Alfresco.RuleConfigAction, return configDef; } + }, }, diff --git a/pdf-toolkit-share/src/main/resources/alfresco/web-extension/site-webscripts/org/alfresco/components/rules/config/rule-config-action.get.config.xml b/pdf-toolkit-share/src/main/resources/alfresco/web-extension/site-webscripts/org/alfresco/components/rules/config/rule-config-action.get.config.xml index 8d85ce8..c4b7aa8 100644 --- a/pdf-toolkit-share/src/main/resources/alfresco/web-extension/site-webscripts/org/alfresco/components/rules/config/rule-config-action.get.config.xml +++ b/pdf-toolkit-share/src/main/resources/alfresco/web-extension/site-webscripts/org/alfresco/components/rules/config/rule-config-action.get.config.xml @@ -72,6 +72,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -94,7 +124,17 @@ Transform Import SetPropertyValue - WaterMarkPDF + PDFToolKITDestination + PDFToolKITDestination + PDFToolKITDestination + PDFToolKITDestination + PDFToolKITDestination + PDFToolKITDestination + PDFToolKITDestination + PDFToolKITDestination + PDFToolKITDestination + PDFToolKITDestination + PDFToolKITDestination