PDF2PRINT

PDF2PRINT

Introduction

The PDF2PRINT software product is a stand-alone command line utility for Windows 64 systems. You can use it to send PDF documents to the printer of your choice, either manually from a command prompt, or as part of a batch file.

Note: When you first purchase PDF2PRINT, you will receive an activation key, and you will be prompted to enter this key when you install the software. In response the system generates a license file for you (pdf2print.lic) and stores it in the software working directory.

If you later receive a new activation key for PDF2PRINT, you will need to enter it as you did your original activation key when you first installed the product. Delete the license file from the working directory and then run the executable, pdf2print.exe. You will be prompted to enter the activation key. Type or paste the key value as you did before. The system will create a new license file for you, and you can continue to use the product.

Command Syntax

The command syntax for PDF2PRINT must include the executable name and the name of the file (or files) to print. These are the only required elements:

pdf2print filename.pdf

If you don’t include a printer name, the system will use the default printer. The printer can be either local or networked.

If you want to select a printer for a print job, you must provide the name of that printer before the input file name.

pdf2print –-printer=printername filename.pdf

You would add any options to the command statement after the printer name:

pdf2print –-printer=printername --copies=2 --orientation=landscape filename.pdf

You can send as many files to a printer as you like, separating each file name with a space:

pdf2print –-printer=printername --copies=2 --orientation=landscape filename1.pdf filename2.pdf

Select a Windows printer, and for the printer name use the full Windows UNC path. To find the printer name for a network printer open the Windows Control Panel and select Devices and Printers.  The name should appear on the Hardware tab for the printer Properties window.

When printing to a network printer, we recommend that you include the full path name of the server and domain for the printer in your command line statement.  Depending on how your network is set up, you might see error messages if you leave the domain name out.  The syntax looks like this:

pdf2print -–printer="\\servername\printer device name filename.pdf"

So the statement might look like this:

pdf2print --printer="\\London.standard.company.com\Sales Cannon printer" annualreport2016.pdf

In the above example “London” is the server name, “standard.company.com” is the domain, and “Sales Cannon printer” is the printer name.

If you type the printer name wrong, you will see an error message.  If any printer or path name includes spaces, use quotes around that printer or path name, as shown above.

In this example the PDF file to be printed would be found in the same directory where you are running the PDF2PRINT utility.

If you want to print a PDF document that is stored in a different directory, you need to provide the path name:

pdf2print --printer="\\London.standard.company.com\Sales Cannon printer" C:\Datalogics\PrintDocuments\annualreport2016.pdf

Optional parameters for the PDF2PRINT command

PDF2PRINT offers a variety of options to manage the print process. If you want to adjust the settings for a print job, PDF2PRINT allows you to:

  • Print the pages two sided
  • Print multiple copies of a document, and collate the output pages
  • Select a range of pages to print, or print all odd or all even pages
  • Shrink the content on each page in a document to fit the paper size provided
  • Change the print orientation from portrait to landscape
  • Select a specific input paper tray on the printer

Add the options to the command statement after the printer name and before the print file name. Separate each one with a blank space and include a pair of dashes (--) before each option name.

All statements, values and options entered using PDF2PRINT must use lower case characters.

You can stack up options on the print command, like this:

pdf2print --printer="\\London.standard.company.com\Cannon #3" –-copies=3 –-collate=false  –-duplex=long --orientation=portrait C:\Datalogics\PrintDocuments\annualreport2016.pdf

If you include more than one PDF file name to print in your command line statement, the options you add to that statement will apply to every print file. For example, if you issue a command to print three PDF files, and add the option “- -copies=2,” the printer will print two copies of all three files:

pdf2print --printer="\\London.standard.company.com\Cannon #3" –-copies=2 annualreport2016.pdf annualreport2017.pdf annualreport2018.pdf

This applies to every option except for page range, “- -range=” which we explain below.

You can add any of these statements to the print command.  All of these statements are optional:

– – copies= Enter the number of copies you want to print. Defaults to one copy of each page.
pdf2print --printer="\\London.standard.company.com\Cannon #3" –-copies=3 report2016.pdf
– – collate= If you are printing more than one copy of a document, you can use this option to define whether or not the printed pages are collated. The values are true, false, and default, with the default value being “default.” True means that the pages will be collated, and false means that the pages will not be collated, with both of these statements overriding the printer default.  If you set collate equal to default it means to use the printer default option.  The –collate option is only relevant when a printer prints more than one copy of a document, so you would normally include it in a command statement with the –copies option.
pdf2print --printer="\\London.standard.company.com\Cannon #3" –-copies=3 --collate=false report2016.pdf
– – duplex= Print pages two sided.
off Turn off two-sided printing, print on one side only
short Flip the page on the short edge of the paper, such as the top of an 8½ x 11 inch page
long Flip the page on the long edge of the paper
default Use the printer default
pdf2print --printer="\\London.standard.company.com\Cannon #3" –-duplex=long report2016.pdf
– – orientation= Select the page orientation for printing:
landscape
portrait
pdf2print --printer="\\London.standard.company.com\Cannon #3" –-orientation=landscape report2016.pdf
The default page orientation is the printer default. The default will be used if you don’t enter “-orientation” statement.
– – range= Select a range of pages to print for your document:
all Print all pages (default)
even Print only even pages
odd Print only odd pages
n-n Enter a range of page numbers to print
pdf2print --printer="\\London.standard.company.com\Cannon #3" –-range=5-11  report2016.pdf
If you don’t include a “- -range=” statement, the printer will print every page in each of the print files named in the command line statement.
If you want to include a page range for more than one file in the command line statement, you need to add a “- -range=” statement for each print file, next to that file name, like this:
pdf2print --printer="\\London.standard.company.com\Cannon #3" –-range=5-11 report2016.pdf –-range=1-3 report2017.pdf
If you are specifying more than one page range to print in the command, the number of “–range” options in the command line statement must match the number of print files.
To specify multiple print ranges for a single file, use the same syntax. Enter each page range separately, but repeat the print file name, like this:
pdf2print --printer="\\London.standard.company.com\Cannon #3" –-range=1-3 report2017.pdf –-range=15-21 report2017.pdf –-range=33-45 report2017.pdf
This would print pages 1-2, 15-21, and 33-45 for the file called report2017.pdf.
Keep in mind that the Print2PDF utility counts pages from the first page of the PDF document.  You might have a document where the paging starts at page 1 after eight pages of a cover sheet, copyright page, and table of contents.  That means that the page you label as the first page in the document is actually page nine. To print the first five pages of text after the front matter, your page range would need to be “- -range=9-13”.
– – shrinktofit= You can direct PDF2PRINT to automatically adjust the size of the content on a document page to fit the paper in the paper tray.  The options are true or false. True means that the document will shrink to fit on the page. For example, if you are sending a PDF document with 11” x 16” pages to a printer using 8½” x 11” paper, the utility will automatically shrink the pages in the PDF document to fit.  Use False to direct the printer to leave the content its original size, even if more than one sheet is needed to print the content on each page.  When you don’t specify this value, it defaults to true.
pdf2print --printer=”\\London.standard.company.com\Cannon #3” –-shrinktofit=false report2016.pdf
– – tray= You can use PDF2PRINT to tell the printer which paper tray the print job should use.
You can use the option “- -tray=auto” to tell the printer to select the input paper tray based on the size of the page in the print file. In this case the printer selects the input paper tray where the appropriate size of paper is stored. The printer relies on its own default settings.  In other words, if:
  • a print file is formatted to print on legal size paper (8½ x 14 inch),
  • the “–tray” option is set to “auto,” and,
  • the printer by default stores legal paper in tray 2
The printer will pull paper from tray 2 to print the document.
But you can also use the “- -tray” option to select a specific input paper tray.
The “–tray=” option is unusual in that before you can select a specific input paper tray, you need to find out what paper trays are available with the printer and learn the codes that the printer assigns to these trays to identify them.
In that case use the “- -showtrays” option with a print command to list the available input paper trays, with this syntax:
pdf2print --printer=printername --showtrays
You aren’t sending a file to the printer yet, so you don’t need to provide a file name or any options. But you can’t use the “–trays=” option without using “- -showtrays” first.
The command might look like this:
pdf2print --printer="\\London.standard.company.com\Cannon #3" –-showtrays
PDF2PRINT lists the available paper trays for the printer, with output like this:
Available trays for printer \\\\London.standard.company.com\Cannon #3:
Name: Tray 1 Letter                  ID: 250
Name: Tray 2 Letter letterhead       ID: 251
Name: Tray 3 Letter 3-hole punched   ID: 252
Name: Tray 4 Legal                   ID: 253
Name: Tray 5 14 x 17                 ID: 254
For each paper tray, the output includes an identification number.
Note that if you don’t offer a printer name:
pdf2print--showtrays
The tray names are listed for the system default printer.
After you have the results from the “–showtrays” statement, enter this command line option to define the default paper tray or trays to use for the PDF document you want to print:
--tray=value1
Where the “value” is the ID number provided for the paper tray.
The print command might look like this:
pdf2print --printer="\\London.standard.company.com\Cannon #3"
–-copies=3 –-collate=true -–range=1-2 –-tray=251 report2016.pdf
This command would send a document called Report2016.pdf to the printer “Cannon #3” and generate three copies, collated, using paper drawn from paper tray 2, ID number 251. This command only would print pages 1 and 2 of this document.
Note that you may define only one input tray to use for a print job.

Using PDF2PRINT with the optional control file

You can make your use of PDF2PRINT simpler by use of a control file. Enter a set of custom settings in this file, including the printer you want to use, the name of the file or files you want to print, page ranges for printing for each of these files, and any of the other options offered. Then, save the file to a directory and reuse it as often as you like, naming it in the PDF2PRINT command line statement. You can create and use as many control files as you like and make each one as long or as short as you need. The options provided for the command line statement have the same syntax and values when added to the control file.

If you want to change the names of the print files in a control file you will need to manually edit that file, but otherwise, if you have a routine where you regularly print a file or a series of files using the same printer, number of copies, page ranges, page size, and so on, you can define these values in a control file and complete your PDF2PRINT commands a lot more quickly.

The control file must use the JSON format, and we recommend that you include the “.json” extension. JSON, or JavaScript Object Notation, is an open standard file format that relies on easily readable English text, and it is used as an alternative to XML.  Use the JSON validator to check your JSON syntax.

This is the command syntax:

pdf2print --control="path to control file"

Provide the path to the file.  The command line the statement would look something like this:

pdf2print --control=C:\Datalogics\Profiles\primary.json

If you call the control file as part of the command line statement, no other options are needed.  All of the options can be included in the control file.  But if you do add an option to a command line statement that also features a control file, and the option is found in that control file, the option in the command line statement will overwrite the setting for that same option in the control file.

Suppose you have a control file that you configured to print three copies of four different PDF documents. But you want to change that setting to print just one copy of each. It’s easier to leave the file unchanged and add a “–copies” parameter to the command statement:

pdf2print --control=C:\Datalogics\Profiles\primary.json --copies=1

The printer disregards the number of copies provided in the control file.

Note that this does not work for the “–range” setting, for defining page ranges for printing. Also, you can’t add an option to a command line to change the files to be printed.

A typical control file might look like this.

{
     "printer": "London",
     "duplex": "long",
     "tray": "auto",
     "collate": "false",
     "copies": 3,
     "orientation": "landscape",
     "showtrays": false,
     "shrinktofit": false,
     "input-files": [
          {
               "file-name": "File1.pdf",
               "range": "all"
          },
          {
               "file-name": "File2.pdf",
               "range": "even"
          },
          {
               "file-name": "File3.pdf",
               "range": "1-1"
          },
          {
               "file-name": "File4.pdf",
               "range": "all"
          }
     ]

}

If you want to save a print document to a file, rather than sending it to a printer, add the “tofile” option to the control file, like this:

"tofile": "output_to_fle.ps",

You might find this useful if you are testing a batch process.  Rather than wasting a lot of paper to simply make sure that a nightly batch job that is designed to create a set of log file printouts works properly, you could send the content to a file instead, and then review the file.

If you do not store the PDF print files in the same directory as the control file, you need to provide a path name for each print file in the control file. It would look like this:
{
"file-name": "C:\\Datalogics\\Print\File4.pdf",
"range": "all"
}

You can also include a page range for each file.  Note that you can only include a single page range for each document you name in the JSON profile.

If you want, however, to print more than one range of pages for a single file, you can name the same file more than once, and give a different print range to each instance, like this:

     "input-files": [
          {
               "file-name": "File2.pdf",
               "range": "1-3"
          },
          {
               "file-name": "File2.pdf",
               "range": "7-12"
          },
          {
               "file-name": "File2.pdf",
               "range": "20-23"
          }
     ]

}

Using printer features not directly supported by PDF2PRINT

PDF2PRINT is a flexible tool that offers a variety of options for printing documents. But you may want to generate print jobs with settings that PDF2PRINT does not offer.  For example, you may have a high-end printer at your workplace that allows you to staple collated documents. You don’t use the staple feature very often, so it is normally turned off in the settings for this printer. But you would like to be able to send a report to this printer using PDF2PRINT and staple each copy as it is printed.

The normal way to do this would be to access the printer preferences for the device in Windows and manually turn on the staple setting. Then, you would send the print job to that printer. After the print job has completed successfully, you would return to the printer preferences and turn the staple feature off again.

That works, but it’s clumsy, especially if you need to use the feature a lot. And what if you want to run an automatic batch process with PDF2PRINT every night to print and staple this document? What if dozens of other batch print jobs are sent to this same printer each night, and yours is the only one that uses the staple feature?  How do you automatically change the printer preferences before your batch job, and then change them back when the print job is complete, so that you don’t cause problems for the other jobs sent to this printer?  And what if you want to run five different batch processes each night using PDF2PRINT, and each using its own unique printer preferences?

You can create a copy of an existing printer in Windows and change the preferences. This printer copy would have its own unique name but would work just like the original, and you could include the name of this printer in a PDF2PRINT command line statement.  But you could apply a unique and permanent preference setting to that printer.  In this example you could turn on the stapling setting in printer preferences for the printer copy.  In effect you have a Windows printer that is permanently set up to staple print jobs, and you would only use that printer with a single batch process run using PDF2PRINT. Everyone else at your workplace who uses the same printer hardware would use the original Windows definition of that printer, where the staple function is always turned off.

We describe how to create a duplicate Windows printer in the steps below.

Note that these steps have nothing to do with the PDF2PRINT software product.  Also, the purpose of this approach is probably to allow you to take advantage of printer features that are not provided in PDF2PRINT because they are rarely used, like stapling pages, or printing cover sheets for print jobs, or directing a printer to fold the pages of a document as they are printed.

Follow these steps to make a copy of one of your existing printers in Windows.

  1. Open the Windows Control Panel.
  2. Select Devices and Printers.
  3. Click “Add a Printer.”
  4. Click “The printer that I want isn’t listed.”
  5. You will see a window that helps you to find the printer you would like to copy. You can search for an existing printer using the IP address, for example, or browse for the printer by name.
  6. If you are prompted to select a version of the driver for the printer, select the option “Use the driver that is currently installed.”
  7. The process will ask you to provide a name for the printer. The new printer must have a unique name.  Enter a name for the printer that makes it easy to identify. Remember, you are creating a copy of an existing printer, so you might want to give the printer a name to indicate that.  For example, you could create a printer and call it “HP LaserJet Accounting 2 for printing with staples.”
  8. Continue to press Next until the printer appears on the Devices and Printers panel.
  9. Open the Printing Preferences dialog for this printer and change the print settings you wish to control.
  10. Add the name of this printer to the PDF2PRINT command statement.