Neevia

PDFcompress

user’s manual

version 3.5

(http://neeviaPDF.com/PDFcompress)

For One (1) Computer

This is an End User License Agreement. This is a contract. If you install this software, you must abide by the terms of this agreement. This license is applicable to all software products sold by Neevia Tech. The term software includes upgrades, modified versions or updates. This software is licensed and not sold. Only a personal, non-transferable and nonexclusive right to use the Neevia products is granted to the end user.

The following are definitions that should be noted by the user:

COMPUTER

This is a single computer owned, rented or leased by a single individual or entity on which one or more applications load and execute software in the memory space of that computer. Software is installed on a computer for one or more users. All computers must be licensed to utilize Neevia software.

THIS IS A CONTRACT BETWEEN YOU AND NEEVIA TECH. YOU SHOULD CAREFULLY READ THIS LICENSING AGREEMENT AND MUST ACCEPT ALL THE TERMS AND CONDITIONS BEFORE INSTALLING THIS NEEVIA SOFTWARE. BY INSTALLING THE SOFTWARE, YOU ARE AGREEING TO BE BOUND BY THE TERMS AND CONDITIONS OF THIS LICENSE. IF YOU DO NOT AGREE TO THE TERMS OF THIS LICENSE, DO NOT INSTALL THE SOFTWARE, AND DO NOT USE THE SOFTWARE. IF YOU VIOLATE THIS AGREEMENT, YOU WILL BE SUBJECT TO LEGAL ACTION BY NEEVIA TECH.

Subject to the payment of applicable license fees, Neevia Tech grants you a nonexclusive right to use its accompanying Neevia software product and related documents (the Software) in the terms and conditions provided as follow:

Until such time as Neevia has issued a valid serial number to you, you may only use this software for a 30-day trial period. You agree to remove any copies of the software after the expiration of the trial period. No license is issued to you until you are issued a valid serial number.

You cannot use a license for the software concurrently on different computers. You may install and use the Software in a single location on a hard disk or other storage device of one computer only.

(a) Home Use:

The primary user of each computer on which the Software is installed or used may also install the Software on one home or portable computer. However another person may not use the Software on a secondary computer at the same time the Software on the primary computer is being used.

(b)  Server or Network Use:

You may keep one copy of the Software on a single file server only for the purposes of downloading and installing the Software onto a hard disk of up to the Permitted Number of Computers that are on the same network as the file server. No other network use is permitted.

(c) Operating system or Language versions:

If you receive two or more copies of the Software with different operating systems or language versions, the total aggregate number of computers on which all versions of the Software are used may not exceed the Permitted Number of Computers. You may not rent, lease, sublicense, lend or transfer versions or copies of the Software you do not use, or Software contained on any unused media.

(d) Archiving:

You may make one copy of the Software solely for archival purposes. If the Software is an upgrade, you may use the Software only in conjunction with upgraded product. If you receive your first copy of the Software electronically, and a second copy on media afterward, the second copy can be used for archival purposes only.

For all Neevia Tech products, you agree that you will only use our software on a server and all applications that will access the server will reside on the server and you will not permit remote access to the software except through your application residing on the server. You agree to surrender your license(s) if you violate this agreement. If you violate this agreement, you will not receive a refund upon termination of this license. You agree not to utilize our software to violate the copyright of any third parties. If you do violate the copyright of a third party utilizing our software, you agree to hold Neevia Tech harmless and will indemnify Neevia Tech for any such activity even if the violation is unintentional.

The Software is owned by Neevia Tech and/or its suppliers, and is protected by the copyright and trademark laws of the United States and related applicable laws. You may not copy the Software except as set forth in the "License" section. Any copies that you are permitted to make pursuant to this Agreement must contain the same copyright and other proprietary notices that appear on or in the Software.

You may not rent, lease, sub-license, transfer, or sell the Software. You may not modify, translate, reverse engineer, decompile, disassemble, or create derivative works based on the Software, except to the extent applicable law expressly prohibits such foregoing restriction. You may use the trademarks to identify the Software owner's name, or to identify printed output produced by the Software. Such use of any trademark does not give you any rights of ownership in that trademark.

NO WARRANTY LICENSED SOFTWARE (S) - "AS IS"

The Software is provided AS IS. NEEVIA TECH AND ITS SUPPLIERS MAKE NO WARRANTIES, EXPRESS OR IMPLIED, AS TO THE MERCHANTABILITY, QUALITY, NONINFRINGEMENT OF THIRD PARTY RIGHTS, FITNESS FOR A PARTICULAR PURPOSE, AND THOSE ARISING BY STATUTE OR OTHERWISE IN LAW OR FROM A COURSE OF DEALING OR USAGE OF TRADE. THE ENTIRE RISK AS TO THE QUALITY, RESULTS BY USING THE SOFTWARE, AND PERFORMANCE OF THE SOFTWARE IS WITH THE END USER. Some states or jurisdictions do not allow the exclusion or limitation of incidental, consequential or special damages, or the exclusion of implied warranties or limitations on how long an implied warranty may last, so the above limitations may not apply to you or your company.

LIMITATION OF REMEDIES AND LIABILITY

NEEVIA TECH OR ITS SUPPLIERS OR RESELLERS SHALL NOT UNDER ANY CIRCUMSTANCE BE LIABLE TO YOU FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO SPECIAL, INDIRECT, OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST SAVINGS, OR FOR ANY CLAIM BY A THIRD PARTY, ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE, EVEN IF NEEVIA TECHNOLOLGY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH DAMAGES, OR FOR ANY CLAIM BY ANY OTHER PARTY.

GENERAL

This Agreement shall be construed, interpreted, and governed by the laws of the State of Florida, excluding the application of its conflicts of law rules. The United Nations Convention on Contracts of the International Sale of Goods, will not govern this Agreement. If any part of this Agreement is found void and unenforceable, it will not affect the validity of the rest of the Agreement, which shall remain valid and enforceable according to its terms.

If you need to redistribute this product with your own software products, you need to contact Neevia and negotiate a separate licensing and royalty agreement.

You may not ship, transfer, or export the Software into any country or used in any manner prohibited by any export laws, restrictions or regulations.

You must be properly licensed to install upgrades to Neevia Software products. Neevia upgrades replace and or supplement the previous product that formed the basis for your eligibility to for the upgrade. You may use the upgrade only in accordance with the terms of this Agreement. Upgrades may not be separated and used on separate computers.

GOVERNEMENT USERS

For United States government users, the Software and associated Documentation are deemed to be "commercial computer software" and "commercial computer documentation", respectively pursuant to DFAR 227.7202 and FAR 12.212(b) as applicable.

ENTIRE AGREEMENT

You acknowledge that you have read this Agreement, understand it and agree to be bounded by its terms and conditions. It is the complete and exclusive statement of the Agreement between us, which supersedes any proposal or prior agreement, oral or written, and other communication between us relating to the subject matter of this Agreement.

CONTACT INFORMATION

neeviaPDF.com

Tel: (954) 893.9343

Email: info@neeviaPDF.com

Introduction. 6

Installing and Uninstalling Neevia PDFcompress6

How to register Neevia PDFcompress

Using the Command Line Interface to compress PDF files. 8

Supported Options

Using the COM Interface to compress PDF files. 11

Using the .NET assembly to compress PDF files. 11

Properties

version

Linearize

removeBookmarks

removeAnnotations

removeAcroForms

removePageLabels

removeLayers

CI

CQ

GI

GQ

MI

MQ

CreateObjectStreams

PDF Encryption related properties

PDFEncrypt

PDFEncryptionType

PDFPermissions

PDF Initial View & Metadata related properties

DocumentTitle

DocumentSubject

DocumentAuthor

DocumentKeywords

PageMode

PageLayout

OpenMagnification

OpenAtPage

FitWindow

CenterWindow

HideToolbar

HideWindowUI

Methods

CompressPDF

Using the graphic interface to compress PDF files. 19

CODE SAMPLES26

Neevia PDFcompress is a software product that can be used to reduce the actual size of PDF files by compressing text and graphics. It comes as a command line tool, a graphic interface application and COM object.

Supported platforms are: Windows 98/NT/2000/XP/2003/Vista/Win 7/Win 2008 32bit and 64bit.

Installing and Uninstalling Neevia PDFcompress

Before installing and/or using this product, please make sure you have carefully read the copyright notice and agreed to all of its terms. If you have any questions about the licensing agreement, feel free to call (954) 981.9252 or send an email to sales@neeviaPDF.com.

To install Neevia PDFcompress:

Unattended installation:

To perform an unattended (silent) installation launch the PDFcompress installer with /sp /very silent /norestart command line switches. Here is the full list of supported switches:

/SP

Disables the "This will install... Do you wish to continue?" prompt at the beginning of Setup.

/SILENT, /VERYSILENT

Instructs Setup to be silent or very silent. When Setup is silent the wizard and the background window are not displayed but the installation progress window is. When Setup is very silent the installation progress window is not displayed. Everything else is normal so for example error messages during installation are displayed and the startup prompt is (if you haven't disabled it with '/SP-' command line option explained above). If a restart is necessary and the '/NORESTART' command is not used (see below) and Setup is silent, it will display a “Reboot now?” dialog. If it's very silent it will reboot without asking.

/NOCANCEL

Prevents the user from canceling during the installation process, by
disabling the Cancel button and ignoring clicks on the close button.

Useful along with /SILENT.

/NORESTART

Instructs Setup not to reboot even if it's necessary.

/DIR="x:\dirname"

Overrides the default directory name displayed on the Select Destination Directory wizard page. A fully qualified pathname must be specified.

/GROUP="folder name"

Overrides the default folder name displayed on the Select Start Menu Folder
wizard page.

Use these switches to pass the registration info (username, company name and serial number) to the installer.

To remove Neevia PDFcompress from your computer:

1. Select Settings -> Control Panel from the Start menu.

2. In the Control Panel click Add/Remove programs and select Neevia PDFcompress from the applications list.

3. Click the Add/Remove button to remove the program. A confirmation prompt is displayed.

Unattended uninstall:

To perform an unattended (silent) uninstall, launch unins000.exe from the folder where the application has been installed with /verysilent /norestart command line switches. Here is the full list of supported switches:

/SILENT, /VERYSILENT

When specified, the uninstaller will not ask the user for startup confirmation or a message stating that uninstall is complete. Shared files that are no longer in use are deleted automatically without prompting. Any critical error messages will still be shown on the screen. When '/VERYSILENT' is specified, the uninstall progress window is not displayed. If a restart is necessary and the '/NORESTART' command isn't used (see below) and '/VERYSILENT' is specified, the uninstaller will reboot without asking.

/NORESTART

Instructs the uninstaller not to reboot even if it's necessary.

## How to register Neevia PDFcompress

After you downloaded the product run the installer and at the end of the process enter your registration info. If you do not have a serial number and simply want to test the product select Evaluate Product then click Finish. To register via the graphic interface run PDFcompress.exe click About -> Register -> copy and paste your licensing info.

# Using the Command Line Interface to compress PDF files

By default, the PDFcompress command line application is located in the c:\program files\neeviaPDF.com\ PDFcompress\cmdLine  folder.

Usage:  CLcompr.exe <inputfile> [outputfile] [options]

<inputfile>    PDF file to compress.

[outputfile]   Output PDF file. If left blank it will be the same as the input file

## Supported Options

-lin                           Linearizes output PDF file

Example:

CLcompr.exe c:\input.pdf c:\output.pdf -u password -lin

-co                            Creates object streams (VERY SLOW)

Example:

CLcompr.exe c:\input.pdf c:\output.pdf -co

-ci <value>             Color image compression

possible values:

jpx  - JPEG2000 compression (default)

jpg  - JPEG compression

zip  - Deflate (ZIP) compression

none - Image will be left uncompressed

Example:

CLcompr.exe c:\input.pdf c:\output.pdf -ci jpx

-cq <value>           Color image compression quality

possible values: 0 .. 100 (default is 75)

this parameter applies only to jpx and jpg compressions

Example:

CLcompr.exe c:\input.pdf c:\output.pdf -ci jpx -cq 80

-gi <value>        Grayscale image compression

possible values:

jpx  - JPEG2000 compression (default)

jpg  - JPEG compression

zip  - Deflate (ZIP) compression

none - Image will be left uncompressed

Example:

CLcompr.exe c:\input.pdf c:\output.pdf -gi jpx

-gq <value>        Grayscale image compression quality

possible values: 0 .. 100 (default is 75)

this parameter applies only to jpx & jpg compressions

Example:

CLcompr.exe c:\input.pdf c:\output.pdf -gi jpx -gq 80

-mi <value>        Monochrome image compression

possible values:

jbig2   - JBIG2 lossy compression (default)

jbig2l  - JBIG2 lossless compression

fax       - Group 4 CCITT facsimile (fax) compression

zip       - Deflate (ZIP) compression

none   - Image will be left uncompressed

Example:

CLcompr.exe c:\input.pdf c:\output.pdf -mi jbig2l

-mq <value>        Monochrome image compression quality

possible values: 0 .. 10 (default is 5)

this parameter applies only to jbig2 and jbig2l compressions

Example:

CLcompr.exe c:\input.pdf c:\output.pdf -mi jbig2l -mq 8

Encryption settings:

-owner <value>    Owner password to use for encrypting output PDF file

-user <value>        User password to use for encrypting output PDF file

-rc4                         Uses 128 bits RC4 encryption for encrypting output file

-aes                         Uses 128 bits AES encryption for encrypting output file

-aes256                   Uses 256 bits AES encryption for encrypting output file

-nometa                 Does not encrypt PDF Metadata

-perms <value>    PDF security permissions to use for encrypting output file

flags:

p - document printing is denied

c - changing the document is denied

s - selection and copying of text and graphics is denied

a - adding or changing annotations or form fields is denied

The following flags are defined for 128 bits encryption:

i -  disables editing of form fields

e - disables extraction of text and graphics

d - disables document assembly

q - disables high quality printing

Example:

CLcompr.exe c:\input.pdf c:\output.pdf -owner test -aes -perms pcs

-title <value>              Sets output PDF file title to <value>

-author <value>         Sets output PDF file author to <value>

-creator <value>        Sets output PDF file creator to <value>

-subject <value>        Sets output PDF file subject to <value>

-keywords <value>   Sets output PDF file keywords to <value>

Example:

CLcompr.exe c:\input.pdf c:\output.pdf -title "Daily Report"

-openmagn <value>   Sets open magnification (in %) for output PDF file

-openpage <value>    Sets open page for output PDF file

Example:

CLcompr.exe c:\input.pdf c:\output.pdf -openmagn 50 -openpage 1

-pm <value>     Specifies how output file should be displayed when opened in PDF viewer.

Possible values:

0 - Default view

1 – Page only

2 - Outlines (bookmarks) visible

3 - Thumbnail images visible

4 - Optional content group panel visible

5 - Attachments panel visible

6 - Full screen mode

-pl <value>     Specifies page layout to use when output file is opened in PDF viewer.

Possible values:

1 - Displays one page at a time (default)

2 - Displays the pages in one column

3 - Displays the pages in two columns, with odd numbered pages on the left

4 - Displays the pages in two columns, with odd numbered pages on the right

5 - Displays the pages two at a time, with odd numbered pages on the left

6 - Displays the pages two at a time, with odd numbered pages on the right

Example:

CLcompr.exe c:\input.pdf c:\output.pdf -pm 2 -pl 1

-hidemenubar     Specifies if PDF viewer should hide menu bar when output file is displayed

-hidetoolbar        Specifies if PDF viewer should hide toolbar when output file is displayed

-hidewindowui   Specifies if PDF viewer should hide user interface elements when output file is displayed

-fitwindow           Specifies if PDF viewer should resize the document's window to fit the size of the first displayed page

-centerwindow   Specifies if PDF viewer should position the document's window in the center of the screen

Example:

# Using the COM Interface to compress PDF files

Class ID

Neevia.PDFcompress

Example:

Visual Basic:   Set NVcomp = CreateObject("Neevia.PDFcompress")

Delphi:   NVcomps := CreateOLEObject("Neevia.PDFcompress")

# Using the .NET assembly to compress PDF files

To use the PDFcompress.NET interface for compressing PDF files, in Visual Studio go Project -> Add Reference ->.NET and select PDFcompressNET from the list. After this:

Visual Basic:    Dim NVcomp As New Neevia.PDFcompress

Visual C#:   Neevia.PDFcompress NVcomp = new Neevia.PDFcompress();

## Properties

### version

Returns the PDFcompress version

Syntax

value = NVcomp.version

Data Type: String

### Linearize

Specifies whether the compressed PDF file should be linearized (Optimized for fast Web View).

Possible values: true, false (Default value: false)

Syntax

NVcomp.Linearize = value

Data Type: Boolean

Specifies the open password to use when compressing an encrypted PDF file.

Syntax

Data Type: String

### removeBookmarks

Specifies whether to remove bookmarks from the compressed PDF file.

Possible values: true, false (Default value: false)

Syntax

NVcomp.removeBookmarks = value

Data Type: Boolean

### removeAnnotations

Specifies whether to remove text annotations from the compressed PDF file.

Possible values: true, false (Default value: false)

Syntax

NVcomp.removeAnnotations = value

Data Type: Boolean

### removeAcroForms

Specifies whether to remove PDF forms from the compressed PDF file.

Possible values: true, false (Default value: false)

Syntax

NVcomp.removeAcroForms = value

Data Type: Boolean

### removePageLabels

Specifies whether to remove page labels from the compressed PDF file.

Possible values: true, false (Default value: false)

Syntax

NVcomp.removePageLabels = value

Data Type: Boolean

### removeLayers

Specifies whether to remove layers from the compressed PDF file.

Possible values: true, false (Default value: false)

Syntax

NVcomp.removeLayers = value

Data Type: Boolean

Specifies whether to remove article threads from the compressed PDF file.

Possible values: true, false (Default value: false)

Syntax

Data Type: Boolean

### CI

Specifies the color image compression algorithm.

Possible values:

jpx  - JPEG2000 compression (default)

jpg  - JPEG compression

zip  - Deflate (ZIP) compression

none - Image will be left uncompressed

Syntax

NVcomp.CI = value

Data Type: String

### CQ

Specifies the color image compression quality. Possible values: 0 .. 100 (default is 75).

Syntax

NVcomp.CQ = value

Data Type: Integer

Note: this parameter applies only to jpx and jpg compressions.

### GI

Specifies the grayscale image compression algorithm.

Possible values:

jpx  - JPEG2000 compression (default)

jpg  - JPEG compression

zip  - Deflate (ZIP) compression

none - Image will be left uncompressed

Syntax

NVcomp.GI = value

Data Type: String

### GQ

Specifies the color image compression quality. Possible values: 0 .. 100 (default is 75).

Syntax

NVcomp.GQ = value

Data Type: Integer

Note: this parameter applies only to jpx and jpg compressions.

### MI

Specifies the monochrome image compression algorithm.

Possible values:

jbig2   - JBIG2 lossy compression (default)

jbig2l  - JBIG2 lossless compression

fax       - Group 4 CCITT facsimile (fax) compression

zip       - Deflate (ZIP) compression

none   - Image will be left uncompressed

Syntax

NVcomp.MI = value

Data Type: String

### MQ

Specifies the color image compression quality. Possible values: 0 .. 10 (default is 5).

Syntax

NVcomp.MQ = value

Data Type: Integer

Note: this parameter applies only to jbig2 and jbig2l compressions.

### CreateObjectStreams

Specifies whether to create object streams when compressing the PDF file.

Syntax

NVcomp.CreateObjectStreams = value

Data Type: Boolean

Note: An object stream represents a stream that contains a sequence of PDF objects. This allows a greater number of PDF objects to be compressed.

## PDF Encryption related properties

### PDFEncrypt

Specifies whether the output PDF file should be encrypted.

Possible values: true, false (Default value: false)

Syntax

NVcomp.PDFEncrypt = value

Specifies whether the metadata in the output PDF file should be encrypted.

Possible values: true, false (Default value: true)

Syntax

NVcomp.PDFEncrypt = value

### PDFEncryptionType

Specifies the encryption algorithm

Possible values:   "40" (low - 40 bits RC4 encryption - Acrobat 3-and-later compatible)

"rc4" (high - 128 bits RC4 encryption - Acrobat 5-and-later compatible)

"aes" (high - 128 bits AES encryption - Acrobat 6-and-later compatible)

"aes256" (high - 256 bits AES encryption - Acrobat 9-and-later compatible)

Syntax

NVcomp.PDFEncryptionType = value

Data Type: String

Note: Will have effect only if PDFEncrypt = true.

Sets the user password in the output document. Users will be asked to enter this password before Acrobat Reader allows them to view the document.

Syntax

Data Type: String

Note: Will have effect only if PDFEncrypt = true.

Sets the output document owner password. This option will force the user of the PDF to enter a password before Acrobat Reader allows them to change the user password and security permissions.

Syntax

Data Type: String

Note: Will have effect only if PDFEncrypt = true.

### PDFPermissions

PDF security permissions to use for encrypting output file. Possible values:

p - document printing is denied

c - changing the document is denied

s - selection and copying of text and graphics is denied

a - adding or changing annotations or form fields is denied

The following flags are defined for 128 bits encryptions:

i -  disables editing of form fields

e - disables extraction of text and graphics

d - disables document assembly

q - disables high quality printing

Syntax

NVcomp.PDFPermissions = value

Data Type: String

Example:

NVcomp.PDFPermissions = "pcsaiedq"

## PDF Initial View & Metadata related properties

### DocumentTitle

Sets the output document Title field.

Syntax

NVcomp.DocumentTitle = value

Data Type: String

### DocumentSubject

Sets the output document Subject field.

Syntax

NVcomp.DocumentSubject = value

Data Type: String

### DocumentAuthor

Sets the output document Author field.

Syntax

NVcomp.DocumentAuthor = value

Data Type: String

### DocumentKeywords

Sets the output document Keywords field.

Syntax

NVcomp.DocumentKeywords = value

Data Type: String

### PageMode

Specifies how output file should be displayed when opened in PDF viewer. Possible values:

0 - Default view

1 - Page only

2 - Outlines (bookmarks) visible

3 - Thumbnail images visible

4 - Optional content group panel visible

5 - Attachments panel visible

6 - Full screen mode

Syntax

NVcomp.PageMode = value

Data Type: Long

### PageLayout

Specifies page layout to use when output file is opened in PDF viewer. Possible values:

1 - Displays one page at a time (default)

2 - Displays the pages in one column

3 - Displays the pages in two columns, with odd numbered pages on the left

4 - Displays the pages in two columns, with odd numbered pages on the right

5 - Displays the pages two at a time, with odd numbered pages on the left

6 - Displays the pages two at a time, with odd numbered pages on the right

Syntax

NVcomp.PageLayout = value

Data Type: Long

### OpenMagnification

Specifies the open magnification (in %) for output PDF file. Default value: 100

Syntax

NVcomp.OpenMagnification = value

Data Type: Long

### OpenAtPage

Specifies the open page for output PDF file. Default value: 1  (first page)

Syntax

NVcomp.OpenAtPage = value

Data Type: Long

### FitWindow

Specifies if PDF viewer should resize the document's window to fit the size of the first displayed page.

Possible values: true, false

Syntax

NVcomp.FitWindow = value

Data Type: Boolean

### CenterWindow

Specifies if PDF viewer should position the document's window in the center of the screen.

Possible values: true, false

Syntax

NVcomp.CenterWindow = value

Data Type: Boolean

Specifies if Acrobat Reader should hide the menu bar when displaying the output PDF document.

Possible values: true, false

Syntax

Data Type: Boolean

### HideToolbar

Specifies if Acrobat Reader should hide the toolbar when displaying the output PDF document.

Possible values: true, false

Syntax

NVcomp.HideToolbar = value

Data Type: Boolean

### HideWindowUI

Specifies if Acrobat Reader should hide the user interface when displaying the output PDF document.

Possible values: true, false

Syntax

NVcomp.HideWindowUI = value

Data Type: Boolean

## Methods

### CompressPDF

Compresses the specified PDF file.

Syntax

Res = NVcomp.CompressPDF( fileToCompress, outputFile )

Parameters

fileToCompress - PDF file to compress.

outputFile - output PDF file name.

Example

Res = NVcomp.CompressPDF("c:\input.pdf", "c:\out.pdf")

Remarks

Res<>0 on error

Return codes

0   - Success

-1  - General compression error

-109  - Input PDF has no pages (most likely a corrupt PDF file)

-200 ... -299  - these error codes are related to the input PDF parsing process (most likely the input PDF file is corrupted or has syntax errors);

-300 ... -399  - these error codes are related to the output PDF creation process (most likely the user account PDFcompress is called from doesn’t have write permissions to the destination folder).

# Using the graphic interface to compress PDF files

In order to compress files using the graphic interface you need to run PDFcompress.exe located, by default, in the c:\program files\neeviaPDF.com\PDFcompress\apps  folder.

Click Add files to select the PDF file(s) to be compressed. In case you want to compress all PDF files in a folder simply click Add Folder to select the folder.

Output Settings

Before compressing PDF files you need to specify the output settings. To do that click on the Settings button. The interface below will be displayed:

General Settings

In this window you can specify the compression settings to be used during the file compression process.

First you need to select the compression compatibility level. There are three options:

1.       Acrobat 4 (PDF v1.3)

2.       Acrobat 5 (PDF v1.4)

3.       Acrobat 6 (PDF v1.5)

According to the compatibility level selected the following compression types can be used:

ZIP compression - this is a lossless algorithm which means that the content of your images will not change by compressing them. Basically ZIP works like this: it scans an image to detect patterns in it and replaces them by a single token. It can compress color, grayscale and monochrome images.

JPEG compression - designed specifically for compression of sampled continuous-tone (photographic) images and not for general data compression, JPEG is a lossy compression method. The compression results you can obtain using the JPEG algorithm depend on the image being compressed and the amount of loss that is acceptable. When JPEG is selected you can set the Image quality using values from 0 to 100. It can be used for color and grayscale images only.

Fax compression - designed to achieve efficient compression of monochrome (1 bit per pixel) image data at relatively low resolutions which means that it is useful only for bitmap image data, not for color images, grayscale images, or general data.

JPEG2000 compression - defines a wavelet-based method for image compression. Compared to other methods such as regular JPEG or CCITT, JPEG2000 gives a better size reduction. Although the filter can reproduce samples that are losslessly compressed, it is recommended only for use with color and grayscale images and not for general data compression. When JPEG2000 is selected you can set the Image quality using values from 0 to 100.

JBIG2 compression - designed for both lossless and lossy compression. Useful only for monochrome images, not for color images, grayscale images, or general data. Compared to CCIT, JBIG2 provides considerably better compression. The compression it achieves depends strongly on the nature of the image. Even though the best compression level is achieved for images of text, JBIG2 also includes algorithms for compressing sections of an image that contain dithered halftone images (valid mainly for photographs). When JBIG2 is selected (lossy or lossless) you can set the Image quality using values from 0 to 100.

After you select your compression types you can check:

·         Create Object Streams  - valid only with Acrobat 6 (PDF v1.5). An object stream represents a stream that contains a sequence of PDF objects. This allows a greater number of PDF objects to be compressed.

·         Optimize output file(s) for Fast Web Viewing  - this option restructures the resulting PDF document for page-at-a-time downloading (byte-serving) which is especially important with large documents that can take a long time to download from a server.

Output File(s) Settings - this allows you to specify where the compressed file to be placed, which can be next to input file(s) or in a selected folder.

PDF Information

It allows you to specify Title, Author, Subject and Keywords for the compressed file.

PDF Security

To encrypt the output PDF file(s), check Encrypt Document then select the encryption level from the Compatibility drop down box. There are 4 options:

1. Acrobat 3.0 and later (PDF 1.2)  enables 40 bit RC4 encryption (weak - not recommended)
2. Acrobat 5.0 and later (PDF 1.4) enables 128 bit RC4 encryption
3. Acrobat 6.0 and later (PDF 1.5) enables 128 bit RC4 encryption
4. Acrobat 7.0 and later (PDF 1.6) enables 128 bit AES encryption
5. Acrobat 9.0 and later (PDF 1.7) enables 256 bit AES encryption

Encrypt All Document Contents

When you select this option both the document and document metadata will be encrypted. Search engines will not be able to access the document metadata when this option is used.

Encrypt All Document Contents Except Metadata

It is valid for Acrobat 6 and later. Only the content of a PDF document will be encrypted. Metadata remains fully accesible for search engines.

Require a Password to Open the Document

This allows you to set a password for opening the encrypted PDF.

This password prevents users from changing the permission settings. The user can view the file in Acrobat Reader but must enter the specified Permissions password in order to change the file’s Security and Permissions settings.

Permissions

Printing Allowed - Specifies the level of printing that users are allowed for the PDF document.

Possible values:

None - Disables printing.

Low Resolution (150 dpi) - Users can print but the resolution will not be higher than 150-dpi. Each page is printed as a bitmap image which may cause files to print at a slower speed. To make this option available set the Compatibility option to Acrobat 5 (PDF 1.4) or later.

High Resolution - Allow users to print at any resolution. PostScript and other printers that come with high-quality printing features can be used.

Changes Allowed - Enables the editing actions that are allowed in the PDF document. Possible values:

None - when selected none of the changes listed in Changes Allowed drop down box, such as filling in form fields and adding comments are permitted.

Inserting, Deleting, And Rotating Pages - allows users to insert, delete, and rotate pages. Also bookmarks and thumbnails creation are permitted. This option works only for high (128‑bit RC4 or AES) encryption.

Filling in Form Fields and Signing Existing Signature Fields - when selected users can fill in forms and add digital signatures. Adding comments or creating form fields is not permitted. This option works only for high (128‑bit RC4, AES or AES256) encryption.

Commenting, Filling In Form Fields and Signing Existing Signature Fields - users are allowed to add comments, digital signatures and fill in forms. Moving page objects or create form fields is not permitted.

Page Layout, Filling in Form Fields and Signing - users can insert, rotate or delete pages and create bookmarks or thumbnail images, fill out forms, and add digital signatures. Creating form fields is not permitted. This option works only for low (40‑bit RC4) encryption.

Enable Copying of Text, Images, and Other Content - allows users to select and copy the contents of a PDF.

Enable Text Access For Screen Reader Devices For The Visually Impaired - when selected visually impaired users can read the document with screen readers. It doesn’t allow users to copy or extract the document’s contents. This option works only for high (128-bit RC4, AES or AES256) encryption.

PDF Initial View

In this window you can set the PDF Initial View options:

Navigation Tab - specifies which panels are displayed in the PDF viewer navigation pane.

Page Layout - specifies how document pages are arranged.

Magnification - use this to select at what zoom level the document will appear when opened.

Open To Page - specifies the page that appears when the PDF document opens.

Window Options - these options allow you to specify how the PDF viewer window adjusts in the screen area when a PDF document is opened.

Resize Window To Initial Page - adjusts the document window to fit snugly around the opening page, taking into account the options that you selected under Document Options.

Center Window On Screen - instructs the PDF viewer to position the window in the center of the screen area.

Open In Full Screen Mode - maximizes the document window and displays the document without the menu bar, toolbar, or window controls.

User Interface Options

These options allow you to specify which parts of the PDF viewer interface - the menu bar, the toolbars, and the window controls - are hidden.

Note: take into account that If you hide the menu bar and toolbars users cannot apply commands and select tools unless they know the keyboard shortcuts.

GUI - Graphic User Interface

In this window you can select the Graphic User Interface themes. Check Use GUI Themes to enable the Color Scheme. Once that is enabled check either Gradient fill or Solid fill to specify how the color will be displayed.

# CODE SAMPLES

For a full and updated list of PDFcompress code samples please visit http://neeviaPDF.com/support/examples/pdfcompress/

Example 1vb. Compress a PDF file (high image quality, low compression) (Visual Basic)

Dim NVcomp : Set NVcomp = CreateObject("Neevia.PDFcompress")

NVcomp.CI = "jpx"

NVcomp.CQ = 75

NVcomp.GI = "jpx"

NVcomp.GQ = 75

NVcomp.MI = "jbig2l"

NVcomp.MQ = 5

'For better compression uncomment the line below

' NVcomp.CreateObjectStreams = true

Dim retVal : retVal = NVcomp.CompressPDF("c:\in.pdf","c:\out.pdf")

If retVal <> 0 Then

MsgBox("Error code=" & CStr(retVal))

Else

MsgBox("Done")

End If

Example 1delphi. Compress a PDF file (high image quality, low compression) (Delphi)

   procedure TForm1.Button1Click(Sender: TObject);
   var
     NVcomp : Variant;
     retVal : Integer;
   begin
     NVcomp := CreateOleObject('Neevia.PDFcompress');

     NVcomp.CI := 'jpx';
     NVcomp.CQ := 75;

     NVcomp.GI := 'jpx';
     NVcomp.GQ := 75;

     NVcomp.MI := 'jbig2l';
     NVcomp.MQ := 5;

     // For better compression uncomment the line below
     // NVcomp.CreateObjectStreams := true;

     retVal := NVcomp.CompressPDF('c:\in.pdf', 'c:\out.pdf');
     if retVal <> 0 then
       Application.MessageBox(PChar('Error code=' + IntToStr(retVal)),'',0)
     else
       Application.MessageBox('Done','',0);
   end;

Example 2vb. Compress a PDF file (low image quality, MAX compression) (Visual Basic)

   Dim NVcomp : Set NVcomp = CreateObject("Neevia.PDFcompress")

   NVcomp.CI = "jpx"
   NVcomp.CQ = 10

   NVcomp.GI = "jpx"
   NVcomp.GQ = 10

   NVcomp.MI = "jbig2"
   NVcomp.MQ = 1

   NVcomp.CreateObjectStreams = true

   NVcomp.removePageLabels = true
   NVcomp.removeArticleThreads = true

   Dim retVal : retVal = NVcomp.CompressPDF("c:\in.pdf","c:\out.pdf")
   If retVal <> 0 Then
      MsgBox("Error code=" & CStr(retVal))
   Else
      MsgBox("Done")
   End If

Example 2delphi. Compress a PDF file (low image quality, MAX compression) (Delphi)

   procedure TForm1.Button1Click(Sender: TObject);
   var
     NVcomp : Variant;
     retVal : Integer;
   begin
     NVcomp := CreateOleObject('Neevia.PDFcompress');

     NVcomp.CI := 'jpx';
     NVcomp.CQ := 10;

     NVcomp.GI := 'jpx';
     NVcomp.GQ := 10;

     NVcomp.MI := 'jbig2';
     NVcomp.MQ := 1;

     NVcomp.CreateObjectStreams := true;

     NVcomp.removePageLabels := true;
     NVcomp.removeArticleThreads := true;

     retVal := NVcomp.CompressPDF('c:\in.pdf', 'c:\out.pdf');
     if retVal <> 0 then
       Application.MessageBox(PChar('Error code=' + IntToStr(retVal)),'',0)
     else
       Application.MessageBox('Done','',0);
   end;