PrizmDoc v12.1 - January 5, 2017
PHP Sample

Supported PHP Versions

The PrizmDoc PHP Sample requires PHP version 5.4 and above. 

Linux Installation

  1. Install PrizmDoc for Linux and verify the service is working correctly. The installation will place the PHP samples in the following directory: /usr/share/prizm/Samples/php.
  2. Install Apache and PHP. Refer to the directions that are specific to your distribution.
  3. Add the following to the Apache configuration:
Example
Copy Code
Alias /pccis_sample /usr/share/prizm/Samples/php
<Directory /usr/share/prizm/Samples/php>
AllowOverride All
Require all granted
</Directory>
  1. On the command line, first check that the configuration file validates:
Example
Copy Code
apache2ctl configtest
  1. Then restart the Apache service to read the configuration changes:
Example
Copy Code
apache2ctl restart
  1. Give read/write permissions to the Documents folder and the Markups folder. Give read permissions to the ImageStamp folder. These folders are installed to: /usr/share/prizm/Samples on Linux. For more information, see the "Configuration with pcc.config" section below.
  2. Test the sample application in a browser. The following will route you directly to the Viewing Client sample splash page: http://myservername:port/pccis_sample/splash

 

Notes:

Example
Copy Code
sudo apt-get install libapache2-mod-php5

 

Windows Installation

By default, the PHP sample is installed to: C:\Prizm\Samples\php, assuming use of the default PrizmDoc location of C:\Prizm.

IIS

Install IIS, along with the CGI component, and then install and configure PHP. The instructions and installer provided on the IIS site are now old and outdated, as they install PHP version 5.3. Instead, install the latest version of PHP using the Web Platform Installer. If using an already configured server, make sure you are using PHP version 5.4 or higher.

To configure the sample:

  1. Note the location of the PHP sample as described above. If you changed the PrizmDoc default install location, note the comparable sample in the install location you specified.
  2. Open the IIS Manager.
  3. In the Sites list, select the site you want to add the PHP sample to, such as "Default Web Site". Right-click on it and select "Add Virtual Directory…".
  4. In the Alias field, type the URL path you want to use for the sample. We will use "pccis_sample" as an example here.
  5. In the Physical Path field, use the location we noted above. Click OK to create the virtual directory.

Now you can browse to http://localhost/pccis_sample/splash in your browser to see the PHP sample.

Apache

Install Apache, or an Apache stack like XAMPP or WAMP server, and a supported version of PHP.

To configure the sample:

  1. Note the location of the PHP sample as described above. If you changed the PrizmDoc default install location, note the comparable sample in the install location you specified.
  2. Open the httpd.conf file of your Apache install.
  3. In the block starting with "<IfModule alias_module>", add the following to the end of the block:
Example
Copy Code
# PCC PHP sample alias
 Alias /pccis_sample "C:/Prizm/Samples/php"
 <Directory "C:/Prizm/Samples/php">
 Allow from all
 Require all granted
 </Directory>
  1. Restart Apache so that it picks up the new settings.

Now you can browse to http://localhost/pccis_sample/splash in your browser to see the PHP sample.

 

Optional Configuration

By default, PHP has a small file size upload. If you need to be able to upload larger files through the splash page, you may need to change the following values in the php.ini file of your PHP installation:

Example
Copy Code
upload_max_filesize = 1000M
post_max_size = 1000M

This sets the file upload to 1GB, which should be enough to test most files through the splash page. These settings may be too high for a production service, so adjust those accordingly when deploying to production.

 

Configure PHP Web Tier with SELinux

When running PHP Web Tier on Security-Enhanced Linux you may experience issues with loading documents in the Viewing Client, and may see the following errors in Apache's log files: PHP Warning: file_get_contents(<URL>): failed to open stream: Permission denied

The reason for this is that the Web Tier needs to contact the PrizmDoc Server. By default SELinux disallows Apache processes from connecting out. You can run the following command to allow the web tier to function:

Example
Copy Code
setsebool -P httpd_can_network_connect 1

 

Browsing the Sample

From the splash page you have two options:

  1. Choice of Viewing Client:  you can choose to load either the Full Viewer or the Book Reader.
  1. Select a sample document - OR - upload a document: 

You can choose any of the 5 sample documents (Word, PDF, CAD, Tiff or JPEG). Or, you can upload a document from an arbitrary location on your computer. Note that dragging and dropping a file on this page is not supported in Internet Explorer 8.

  1. Full Viewer:

If you select Full Viewer on the splash page, then documents will be viewed with the full-featured, out-of-the-box responsive Viewing Client:

      

  1. Book Reader:

If you select Book Reader on the splash page, then documents will be viewed with the book reader. The book reader demonstrates how the Viewing Client can be heavily customized:

 

Directory Structure

This folder contains 6 sub-folders, one folder for each of the four samples (full Viewing Client, book reader, e-signer and e-signer template designer) and two folders for the splash pages (main splash page and the e-sign splash page):

Each of the sample folders are completely self-contained, meaning that they contain all of the files needed to run the sample. Furthermore, with the exception of a few project files and build files, the sample folders contain only the files needed to run the sample.

 

Folder contents: full-viewer-sample

File / Folder

Description

viewer-assets folder

Contains the essential JavaScript, CSS, fonts, images, language data, and templates (HTML) that make up the Viewing Client.

viewer-assets/less folder

Contains less that can be used to build the Viewing Client CSS. This folder is non-essential, and does not need to be re-distributed.

viewer-assets/Gulpfile.js

Contains Gulp tasks to build the viewer less and icons. This file is non-essential and does not need to be re-distributed.

viewer-assets/package.json

A file used by npm (a package manager). It defines the dependencies installed by npm, which are required to run Grunt and compile the less.

viewer-webtier folder

Contains files that implement the php layer of communication between the Viewing Client and the PrizmDoc Application Services.

viewer-webtier/pas.php

Handles all requests from the Viewing Client and forwards them to the PrizmDoc Application Services.

viewer-webtier/pcc.config

Defines the connection settings for the PrizmDoc Application Services.

viewer-webtier/PccViewer/Config.php

This class parses the pcc.config file and provides methods for easily reading its parameters.

index.php

The default web starting page in this sample. The Viewing Client's code gets loaded by this page.

.htaccess

Contains Apache web server settings.

predefinedSearch.json

This data file contains information defining search queries that will appear as selectable items in the full Viewing Client.

Note: This file is consumed by the page Default.aspx and the JSON is injected into the HTML that is returned by Default.aspx. Ultimately, the predefined search terms are provided as a JavaScript hash, when the Viewing Client is created.

redactionReason.json

This data file contains information defining redaction reasons that are available in the Viewing Client.

Note: This file is consumed by the page Default.aspx and the JSON is injected into the HTML that is returned by Default.aspx. Ultimately, the redaction reasons are provided as a JavaScript hash, when the Viewing Client is created.

Folder contents: book-reader-sample

File / Folder

Description

viewer-assets folder

Contains the essential JavaScript, CSS, fonts, images, language data, and templates (HTML) that make up the book reader Viewing Client.

viewer-assets/less folder

Contains less that can be used to build the Viewing Client CSS. This folder is non-essential, and does not need to be re-distributed.

viewer-assets/Gruntfile.js

Contains Grunt tasks to build the viewer less. This file is non-essential and does not need to be re-distributed.

viewer-assets/package.json

A file used by npm (a package manager). It defines the dependencies installed by npm, which are required to run Grunt and compile the less.

viewer-assets/selection.json

A file used by the IcoMoon application to generate the icons in the book reader Viewing Client.  If you need to add an icon to the Viewing Client, you can add the icon to this file and use the IcoMoon application (https://icomoon.io) to generate a new icon font. This file is non-essential and does not need to be re-distributed.

viewer-webtier folder

Contains files that implement the php layer of communication between the book reader Viewing Client and the PrizmDoc Application Services.

viewer-webtier/pas.php

Handles all requests from the Viewing Client and forwards them to the PrizmDoc Application Services.

viewer-webtier/pcc.config

Defines the connection settings for the PrizmDoc Application Services.

viewer-webtier/PccViewer/Config.php

This class parses the pcc.config file and provides methods for easily reading its parameters.

index.html

The default page for the sample. This page loads the Viewing Client.

sample-config.js

Contains references to the assets, web tier, and language files used by the Viewing Client in this sample.

.htaccess

Contains Apache web server settings.

Folder contents: e-signer-sample

File / Folder

Description

viewer-assets folder

Contains the essential JavaScript, CSS, fonts, images, language data, and templates (HTML) that make up the book reader Viewing Client.

modules folder

Contains uncompiled assets of the Viewing Client. These files will be compiled to viewer-assets/js/bundle.js and viewer-assets/css/bundle.css by the build process defined in Gulpfile.js.

The files in this folder are  non-essential and do not need to be re-distributed.

Gulpfile.js

Contains Gulp tasks to build the viewer js and css files. This file is non-essential and does not need to be re-distributed.

viewer-assets/package.json

A file used by npm (a package manager). It defines the dependencies installed by npm, which are required to run Gulp and compile the Viewing Client assets.This file is non-essential and does not need to be re-distributed.

viewer-webtier folder

Contains files that implement the php layer of communication between the book reader Viewing Client and the PrizmDoc Application Services.

viewer-webtier/pas.php

Handles all requests from the Viewing Client and forwards them to the PrizmDoc Application Services.

viewer-webtier/pcc.config

Defines the connection settings for the PrizmDoc Application Services.

viewer-webtier/PccViewer/Config.php

This class parses the pcc.config file and provides methods for easily reading its parameters.

index.html

The default page for the sample. This page loads the Viewing Client.

.htaccess

Contains Apache web server settings.

webpack.config.js

Webpack configuration file. This file contains all the settings for the webpack module bundler. We use webpack to compile all the files in the modules folder to the bundle.js and bundle.css that are found in the viewer-assets folder.

Folder contents: template-designer-sample

File / Folder

Description

viewer-assets folder

Contains the essential JavaScript, CSS, fonts, images, language data, and templates (HTML) that make up the book reader Viewing Client.

modules folder

Contains uncompiled assets of the Viewing Client. These files will be compiled to viewer-assets/js/bundle.js and viewer-assets/css/bundle.css by the build process defined in Gulpfile.js.

The files in this folder are  non-essential and do not need to be re-distributed.

Gulpfile.js

Contains Gulp tasks to build the viewer js and css files. This file is non-essential and does not need to be re-distributed.

viewer-assets/package.json

A file used by npm (a package manager). It defines the dependencies installed by npm, which are required to run Gulp and compile the Viewing Client assets.This file is non-essential and does not need to be re-distributed.

viewer-webtier folder

Contains files that implement the php layer of communication between the book reader Viewing Client and the PrizmDoc Application Services.

viewer-webtier/pas.php

Handles all requests from the Viewing Client and forwards them to the PrizmDoc Application Services.

viewer-webtier/pcc.config

Defines the connection settings for the PrizmDoc Application Services.

viewer-webtier/PccViewer/Config.php

This class parses the pcc.config file and provides methods for easily reading its parameters.

index.html

The default page for the sample. This page loads the Viewing Client.

.htaccess

Contains Apache web server settings.

webpack.config.js

Webpack configuration file. This file contains all the settings for the webpack module bundler. We use webpack to compile all the files in the modules folder to the bundle.js and bundle.css that are found in the viewer-assets folder.

Configuration with pcc.config

The file pcc.config is used to configure the connection settings between the web tier and PrizmDoc Application Services. The file can be found at: <sample-folder-name>/viewer-webtier/pcc.config. This file is self-documenting, but a little information about the configuration options is given below.

<DocumentPath> (Only in splash pages)

The sample pulls named documents from this location. The DocumentPath must have read/write permissions in order for the file drag and drop functionality of the splash page to work.

<PrizmApplicationServices[Scheme|Host|Port]>

Specifies how to connect to the PrizmDoc Application Services

 

 

 


©2017. Accusoft Corporation. All Rights Reserved.

Send Feedback