Wednesday, January 16, 2008

How to Add the Encrypt PDF Context Menu Item?

Make sure you have downloaded pdftk

Windows XP and Windows 2000:

  1. In the Windows File Explorer menu, select Tools > Folder Options . . . and click the File Types tab. Select the PDF file type and click the Advanced button.
  2. Click the New . . . button and a New Action dialog appears. Give the new action the name Encrypt.
  3. Give the action an application to open by clicking the Browse . . . button and selecting cmd.exe, which lives somewhere such as C:\windows\system32\ (Windows XP) or C:\winnt\system32\ (Windows 2000).
  4. Add these arguments after cmd.exe, changing the path to suit, like so:

  5. C:\windows\system32\cmd.exe

    /C C:\windows\system32\pdftk.exe "%1" output "%1.encrypted.pdf"

    encrypt_128bits user_pw PROMPT

  6. Click OK, OK, OK and you should be done with the configuration.

PDF Encryption with pdftk

You can encrypt any PDF created with pdftk by simply adding encryption parameters after the output filename, like so:

... output
\
[encrypt_40bit | encrypt_128bit] [allow ] \
[owner_pw ] [user_pw ]

Here are the details:

[encrypt_40bit | encrypt_128bit]
Specify an encryption strength. If this strength is not given along with other encryption parameters, it defaults to encrypt_128bit.

[allow ]
List the permissions to grant users. If this section is omitted, no permissions are granted. See Tables Table 5-1 and Table 5-2 for a complete list of available permissions.

[owner_pw ]
Use this combination to set the owner password. It can be omitted; in which case no owner password is set.

[user_pw ]
Use this parameter to set the user password. It can be omitted; in which case no user password is set.

Adding these parameters yields :

pdftk A=in1.pdf B=in2.pdf C=in3.pdf \
cat A1 B1-end C5 output out.pdf \
encrypt_128bit allow CopyContents Printing \
owner_pw ownpass

Monday, January 14, 2008

Standard Security Permissions

Set the user password if you don't want people to see your PDF. If they don't have the user password, it simply won't open.

You also have some control over what people can do with your document once they have it open. The permissions associated with 128-bit security (Acrobat 5 and 6) are more precise than those associated with 40-bit security (Acrobat 3 and 4). Tables Table 1 and Table 2 list all available permissions for each security model.

Table 1. Permissions available under 40-bit security

To allow readers to . . .

Apply this pdftk permission

Print—pages are top quality

Printing

Modify page or document contents,insert or remove pages, rotate pages or add bookmarks

ModifyContents

Copy text and graphics from pages, extract text and graphics data for use by accessibility devices

CopyContents

Change or add annotations or fill form fields with data

ModifyAnnotations

Reconfigure or add form fields

ModifyContents and ModifyAnnotations

All of the above

AllFeatures

2. Permissions available under 128-bit security

To allow readers to . . .

Apply this pdftk permission

Print—pages are top quality

Printing

Print—pages are of lower quality

DegradedPrinting

Modify page or document contents, insert or remove pages, rotate pages or add bookmarks

ModifyContents

Insert or remove pages, rotate pages or add bookmarks

Assembly

Copy text and graphics from pages

CopyContents

Extract text and graphics data for use by accessibility devices

ScreenReaders

Change or add annotations or fill form fields with data

ModifyAnnotations

Fill form fields with data

FillIn

Reconfigure or add form fields

ModifyContents and ModifyAnnotations

All of the above, and top-quality printing

AllFeatures

Comparing these two tables, you can see that Assembly is a weaker version ofModifyContents and FillIn is a weaker version of ModifyAnnotations.

DegradedPrinting sends pages to the printer as rasterized images, whereas Printing sends pages as PostScript. A PostScript stream can be intercepted and turned back into (unsecured) PDF, so the Printing permission is a security risk. However, DegradedPrinting reduces the clarity of printed pages, so you should test your document to make sure DegradedPrinting yields acceptable, printed pages.

After setting these permissions and/or a user password, changing them requires the owner password, if it is set.



PDF Passwords

Acrobat Standard Security enables you to set two passwords on a PDF: the user password and the owner password. In Acrobat 6, these are also called the Open password and the Permissions password, respectively.

The user password, if set, is necessary for viewing the document pages. The PDF encryption key is derived from the user password, so it really is required. When a PDF viewer tries to open a PDF that was secured with a user password, it will prompt the reader to supply the correct password.

The owner password, if set, is necessary for changing the document security settings. A PDF with both its user and owner passwords set can be opened with either password, so you should choose both with equal care.

An owner password by itself does not provide any real PDF security. The content is encrypted, but the key, which is derived from the (empty) user password, is known. By itself, an owner password is a polite but firm request to respect the author's wishes. A rogue program could strip this security in a second.

About PDF Encryption

You can use PDF encryption to lock a file's content behind a password, but more often it is used to enforce lighter restrictions imposed by the author. For example, the author might permit printing pages but prohibit making changes to the document. Here, we continue from and explain how pdftk can encrypt and decrypt PDF documents. We'll begin by describing the Acrobat Standard Security model (called Password Security in Acrobat 6) and the permissions you can grant or revoke.

PDF file attachments get encrypted, too. After opening an encrypted PDF, document file attachments can be opened, changed, or deleted only if the owner granted ModifyAnnotations permission.

Page file attachments behave differently than document file attachments. Once you open an encrypted document, you can open files attached to PDF pages regardless of the permissions. Changing or deleting one of these attachments requires the ModifyAnnotations permission. Of course, if you have the owner password, you can do anything you want.


Friday, January 11, 2008

How to Convert Incoming Faxes to PDF on Linux?

Wrap an incoming fax in PDF and deliver it by email.

Before PDF and before email, we had fax. Today, we still have fax. Integrate fax with your 21st-century lifestyle using HylaFAX. HylaFAX turns your Linux box into a fax server. For details, visit http://www.hylafax.org and http://www.ifax.com. Here, we discuss configuring HylaFAX so that it will deliver incoming faxes to a given email address as a PDF attachment.

Install the HylaFAX server package from your favorite Linux distribution. During installation, a FaxMaster email alias should be created that points to the user responsible for maintaining the server. In this hack, all incoming faxes will be emailed to the FaxMaster as PDF. After installation, run faxsetup -server.

After a fax is received, HylaFAX's faxgetty invokes the faxrcvd script, which in turn executes FaxDispatch (typically located in /var/spool/hylafax/etc) to set configuration parameters. FaxDispatch is where you can control how incoming faxes are routed. Your installation might include a sample FaxDispatch file, or you might need to create one. Read man faxrcvd for details about FaxDispatch.

This sample FaxDispatch file configures HylaFAX to email all incoming faxes to the FaxMaster as PDF attachments. Additional, commented-out lines give an idea of what else is possible:

## Default FaxDispatch file - routes all inbound faxes to FaxMaster as PDF

## Consult the faxrcvd(8C) man page for more information

##



SENDTO=FaxMaster; # by default email to FaxMaster

FILETYPE=pdf; # in PDF format



## This excerpt from the man page gives you an idea of what's possible here

##

## You can route by sender's TSI

#case "$SENDER" in

# *1*510*526*1212*) SENDTO=sam;; # Sam's test rig in Berkeley

# *1*415*390*1212*) SENDTO=raster@asd;; # 7L Xerox room, used for scanning

# *5107811212) SENDTO=peebles@mti;; # stuff from home

#esac


## and/or by device

#case "$DEVICE" in

# ttyS1) SENDTO=john;; # all faxes received on ttyS1

# ttyLT0) SENDTO=mary@home;; # all faxes received on ttyLT0

#esac


## and/or by caller id

#case "$CIDNUMBER" in

# 435*) SENDTO=lee; FILETYPE=pdf;; # all faxes from area code 435

# 5059627777) SENDTO=amy; FILETYPE=tif;; # Amy wants faxes in TIFF

#esac

How to Print to Fax on Windows?

Treat fax machines like remote printers instead of remote copiers.

Faxing a document traditionally involves two fax machines: one that scans your document and one that prints your document. If the document in question is already stored on a computer, it makes more sense to print the document from the computer to the target fax machine. This yields a much higher-quality fax, and it is much more convenient. On a Windows machine with a fax modem, you can install a Fax printer that behaves like any other system printer.

Faxes tend to look bad because the process of scanning a document adds noise, skews text, and generally degrades the appearance. Artwork and photographs suffer the most corruption. Printing a document to the target fax machine, on the other hand, dispenses with scanning. Text looks sharp, and images are preserved with dithering.

Windows XP and Windows 2000 will create a Fax printer when you install a fax-capable modem (Start > Setting > Control Panel > Phone and Modem Options > Modems > Add . . . ). Using Acrobat or your authoring program, print your document to this Fax printer and a wizard will open. This fax wizard asks for the recipient's phone number and enables you to fill in a cover page. Upon completion, your modem will dial out to the destination fax machine and send your document.

A useful series of Windows fax articles is available from http://labmice.techtarget.com/windows2000/printing/fax.htm.

If you fax PDFs frequently, consider adding a Print to Fax item to the PDF right-click context menu.

Windows XP and 2000:

  1. In the Windows File Explorer menu, select Tools > Folder Options . . . and click the File Types tab. Select the PDF file type and click the Advanced button.
  2. Click the New . . . button and a New Action dialog appears. Give the new action the name Print to Fax.
  3. Give the action an application to open by clicking the Browse . . . button and selecting Acrobat.exe, which lives somewhere such as C:\Program Files\Adobe\Acrobat 6.0\Acrobat\. Or, use Reader (AcroRd32.exe) instead of Acrobat.
  4. Add arguments after Acrobat.exe or AcroRd32.exe like so: "C:\Program Files\Adobe\Acrobat 6.0\Acrobat\Acrobat.exe" /t "%1" Fax
  5. Click OK, OK, OK and you should be done with the configuration.
To integrate fax features into your network, use HylaFAX. Visit http://www.hylafax.org and http://www.ifax.com, and consult the fa.hylafax newsgroup.