Open a ticket
Chat with us

Remote Support

We offer remote support in cases where the issue cannot be resolved via chat or phone call. Software Assurance customers are entitled to premium VIP support from our experienced team.

Download TeamViewer

Frequently asked questions for PdfPrinting.NET

PdfPrint has 3 different scaling options in printing:

1. Actual Size - it leaves the page as is. If the content of the page is larger than the printer printable area, then part of the content will be truncated.

2. Fit to margin - if the content of the page is larger than the printable area, the content will be resized so it fits the printer printable area.

3. Shrink to margins - if the content of the page is larger than the printable area, the content will be downsized. If it isn’t bigger than the printable area, the content size will stay the same.

Different printers have a different printable areas.

For PrintWithAdobe() method, due to technical limitations, Fit to margin behaves as Shrink to margins.

PdfPrint library has support for papersources.


private static PaperSource GetPaperSource(PrinterSettings printerSettings, string paperSourceName)
{
    foreach (PaperSource paperSource in printerSettings.PaperSources)
    {
        if (paperSource.ToString().Equals(paperSource))
        {
            return paperSource;
       }
    }
    return null; // Paper source not found
}

var pdfprint = new PdfPrint("your company name", "your key");
var printerSettings = new PrinterSettings();
pdfPrint.PaperSource = GetPaperSource("name of your input tray"); // it is case sensitive

PdfPrint library doesn't have support for output trays.

.NET PrinterSettings class has a property for setting PaperSource, and PaperSource is the standard-setting.
Output trays aren't standard printer property - and every printer which supports it handles it differently, so it isn't possible to have one general solution which will work for every printer.

So what to do if you want to print to a specific output tray?
The only option is that you use the property SettingDialog to show the Printer settings dialog.
If not set through SettingDialog, the printer default output tray will be used.

Yes, you can.

The most important thing to know is that users running windows service where pdfprint is used must have rights to print to the selected printer - otherwise, it will not work.

Set up windows service to be run as a user account type:

User account type - causes the system to prompt for a valid user name and password when the service is installed and runs in the context of an account specified by a single user on the network

If you want to start windows service as a local system account, then the local system account must have printer rights.
NOTE: Following instruction were found at http://support.microsoft.com/kb/184291
To set up printers for the SYSTEM account, perform the following:

This method requires you to modify the registry using the Registry Editor.

WARNING: Using Registry Editor incorrectly can cause serious, system-wide problems that may require you to reinstall Windows to correct them.
Microsoft cannot guarantee that any problems resulting from the use of Registry Editor can be solved.
Use this tool at your own risk.
Ensure that the user you are currently logged into on the server has the desired printers installed.
Launch the Registry Editor (Regedit.exe).
Select the following key:
HKEY_CURRENT_USER\Software\Microsoft\Windows NT\Current Version\Devices

From the Registry menu, click Export Registry File.
In the File Name text box, type c:\Devices.reg.
Select the following key:
HKEY_CURRENT_USER\Software\Microsoft\Windows NT\Current Version\PrinterPorts

From the Registry menu, click Export Registry File.
In the File Name text box, type c:\PrinterPorts.reg.
Select the following key:
HKEY_CURRENT_USER\Software\Microsoft\Windows NT\Current Version\Windows

From the Registry menu, click Export Registry File.
In the File Name text box, type c:\Windows.reg.
From the Start button, select Run. Open Devices.reg in Notepad by typing Notepad Devices.reg in Run dialog box.
Replace the text HKEY_CURRENT_USER with HKEY_USERS\.DEFAULT
Save the file. Then import it into the registry by double-clicking the file in Windows Explorer.
Repeat steps are done for Devices.reg for PrinterPorts.reg and Windows.reg.
These steps only work for local printers.

If you are using PrintWithAdobe method, please also read Can PdfPrint use Adobe for silent printing?

You can find code samples with a Visual Studio solution file in PdfPrinting.zip located at https://www.terminalworks.com/pdf-print-net/downloads

There is a code for our PdfPrintLibraryTest demo application.
In that code, you can see:

  • How to set all available properties in PdfPrint library (PaperSource, Collate, Copies, Pages, Duplex, Print in Color, Print range, Scale document, Landscape / Portrait, Printer Resolution, Paper Size, Show Printer dialog)
  • How to change default printer in C# and get default values for the default printer
  • How to get a list of available printers
  • How to set watermark


In our PdfPrintLibraryMultiDocumentPrintTest application, you can see how to execute print multiple PDF documents as one single print job.

No, it won't work.

Executing ilmerge to merge pdfprint dll with another executable will not give you an error, but still it won't work.
PdfPrint dll is standalone and must stay like that - located in the same folder as the executable which uses pdf print library.

PdfPrintingNet.dll is a standalone dll library. It is signed with the public key.
It could be included in ClickOnce, MSI, and other types of Windows setup files.

PdfPrintingNet.dll is signed with a public key.

PrintWithAdobe method uses preinstalled Adobe Reader / Professional for silent printing.

It works for 32 and 64-bit processes. This method will not work in these cases:

  • in windows service / ASP.net service, it will not work if the installed version of Adobe Reader is higher than 9.5
  • Adobe Reader / Professional isn't already installed on the computer where pdfprint library is used


Additional limitations with PrintWithAdobe method:

  • Orientation: auto doesn't work correctly in some cases if PDF document has different size pages. Orientation is determined based on the first page, which should be printed, so if some of the next pages need a different orientation than the first page to be printed, it will not work correctly for that page.
  • Scale: Fit to margins has the same effect as Reduce to margins.
  • Option to enable/disable content centering isn't available. If Scale: None, then it isn't centered. If Scale: Fit margins or Reduce to margins, then it is automatically centered.
  • Multiple pages ranges to be printed aren't supported. For example, 1-3 is supported, but 1-3, 4-6, or 1, 2, 3 is not.
  • Printing multiple documents as a single print job isn’t supported.
  • It isn't possible to set Watermark on a printed PDF document.


Printing with the default pdfprint engine doesn't have the above limitations.

From version 3.0.2.8, printing multiple PDF documents as one print job is available for our standard Print engine.
PrintWithAdobe(), due to technical reasons, doesn't have that functionality.

It rotates PDF content according to selected paper orientation.
If the page's content has a greater width than height, and the paper orientation is Portrait, it will rotate the content for 270 degrees.
If the page's content has a greater height than width, and the paper orientation is Portrait, then content will stay the same.
If the page's content has a greater height than width, and paper orientation is Landscape, then it will rotate the content for 270 degrees.
If the page's content has a greater height than width, and paper orientation is Landscape, then content will stay the same.

For the default Print() method, AutoRotate works per PDF page. If a PDF document has pages with different page sizes, the described logic will be applied to every one of them.
For PrintWithAdobe() method orientation is determined based on the first page's content, which will be printed. That can create problems if pages with different page sizes are printed. That is one of the know limitations of the PrintWithAdobe() method.

Yes, you can completely hide the toolbar, or you can hide some of its options. For example, you could hide the page selection elements and then only allow your users to view a single page.

You can change it:
1. from Visual Studio in design time - in the properties window of the toolbar
2. programmatically from your code

This occurs in case the PDF document which you opened has permissions set to disallow printing.
You can check out the permission of the document by calling the GetPermissions method on the component.

First, you need a valid viewer license.
PdfPrintingNet library has 3 different licensing types: Viewer, Print, and Full.
If your license type is Viewer or Full then you have a valid Viewer license and you have received the correct license key in an email when you purchased the PdfPrintingNet library.

In your source code, you will have something like this:
var pdfViewer = new PdfViewer();
pdfViewer.SetLicenseInfo("your company name", "your license key");

1. In your project reference PdfPrintingNet.dll
2. Build your project.
3. In Visual Studio go to Toolbox -> Choose Items -> Browse... -> Select PdfPrintingNet.dll on your disk
4. That will add PdfViewer in .NET framework components. Check it and press OK.
Viewer license allows displaying PDF document in Viewer component without any limitations.
Also, it allows printing loaded document directly from Viewer component.
Viewer license doesn't support silent printing.

Print license allows to print or convert PDF document silently without any limitation.
If the Viewer component displays the document, it will show demo sign.
If the Viewer component prints the document, then it will print it without demo sign.

Full license allows to print, convert and display PDF document without any demo limitation.

Our library retrieves the following permissions from PDF document:

  • Print
  • Modify
  • Comments / Annotations
  • Document Assembly
  • Content Extraction
  • Content Extraction For Accessibility
  • Filling of form fields
  • Full qualify print


Our library's current version uses only Print / Full quality print and Content Extraction / Content Extraction For Accessibility.
Others are available only as information.

In the future version, where it will be possible to edit PDF documents, other permissions will be respected.

Available Shortcuts in Viewer Component

ShortcutOperation
CTRL + ASelect all text
CTRL + SHIFT + ADeselect all text
CTRL + CCopy selected text or image to clipboard
SHIFT + RIGHTGo to next page
CTRL + PPrint
CTRL + OOpen
CTRL + FSearch
CTRL + YZoom to
CTRL + 0Zoom to fit to page
CTRL + 1Zoom to actual size
CTRL + WClose Document
CTRL + BToggle bookmarks
CTRL + DShow document info
CTRL + SHIFT + ADDRotate clockwise
CTRL + SHIFT + SUBTRACTRotate counter-clockwise
PAGE UPGo to previous page
PAGE DOWNGo to next page
SHIFT + LEFTGo to previous page
SHIFT + RIGHTGo to next page
CTRL + SHIFT + NGo to page
HOMEGo to first page
ENDGo to last page
ALT + LEFT Go to previous visited page
ALT + RIGHTGo to next visited page
Yes, it is possible to use it through WindowsFormHost component.
We recommend that you look at our demo application PdfViewerPDFDemo located in PdfPrinting.zip.

To license it:
In PdfViewerWPFDemo project -> MainWindows.xaml.cs, after InitializeComponent(); line, please add this line:
((PdfViewer)(windowsHost.Child)).SetLicenseInfo("your company", "your demo key");

Silent printing will work if these conditions are satisfied:

  • The selected printer must be "visible" to the IIS application pool user running ASP.NET web-site. That means that it must be possible to print to the selected printer from the computer where IIS is running. If you can print from any application from the IIS server to the desired printer as the user running the IIS application pool, then printing should also work from our library. Printing to a visitor's local printer isn't possible except if that printer is already visible from the IIS server.
  • If you are using the PrintWithAdobe method instead of the default Print method, then the installed version of Adobe Reader must be 9.5 or older.


Converting PDF pages to images will work.

Duplex, copies, and collate can't be set per single document in multi-document print.
This is an internal limitation in the Win32 printing system, and we can't override that.
These three properties can only be set initially for the print job.
Other printing properties (paper size, paper source, page orientation...) are page-specific, and they can be set.

PDFEdit supports all encryption algorithms defined by the official PDF reference manual.

Supported encryption algorithms are RC4 40 bit, RC4 custom length key length, RC4 128 bit, AES 128 bit, AES 256 bit - weak type (not recommended!), AES 256 bit - strong type.

AES 256 bit is the most secure encryption, but not all PDF readers can use it yet. For good security and compatibility, we suggest AES 128 bit.

PDFEdit supports all user access permissions defined by official PDF reference manual.

Supported user access permissions are: Permit Print, modify document, extract content, annotations, forms fill, accessibility extract content, assemble document, and full quality print.
You can set user access permissions, but it is up to PDF reader if those permissions will be respected.
In PdfPrinting.zip (available in downloads page) there are sample applications with its source code.
There is source code for three sample applications:
  • CreateInvoice - simple example which creates an invoice. A good example to see how to create new PDF document and how to write text with special font and images to it.
  • DocumentMergeSplitExtractRemove - how to extract, remove, split or merge pages from existing PDF document.
  • PDFProtection - how to set PDF encryption and user access permissions.

Required:

  • PdfPrintingNet.dll must be version 4.5.2.0 or newer
  • Translation file with translated text
  • In runtime, you call method pdfViewer.TranslateViewer(locationToTranslationFile);


We suggest that you use translations_en.txt from Samples directory in PdfPrintingNet.zip as a template.
In translations_en.txt there is a list of all strings used. Translate the part after "=" sign.
We suggest that you read notes at the bottom of the translations_en.txt.

The printer has physical printer margins - an area where it can print. So, for some paper sizes (like A4), if the printer isn't a virtual one (like Microsoft PDF Print), the printer will start printing at the left margin, top margin position.

Printable area = paper size - printer margins.

Content is centered according to the printable area, so if the left and right margin or top and bottom margins aren't the same, the content will not be perfectly centered on the paper, and that is by design.

PageAutoSize is a tricky property.
It attempts to automatically set a printer paper size based on the size of the PDF page. Since there are various printers on the market with different capabilities, including the virtual printers, automatic set up of the printer, paper size can introduce a few problems.
The most common problems which can arise are:

1. The printer doesn't support the paper size set up by the PageAutoSize property
For example, if you try to print A3 PDF page size to the printer, which only supports the A4 format, that physically cannot work.
Some printers on the market support custom-defined paper sizes. Still, we can't be sure if the paper size provided by PageAutoSize property will be accepted from the printer or not. We don't have a reliable way to get that information from the printer driver if that custom size will be respected or not.
Virtual PDF printers (for example - CutePDF Writer) support all different kinds of custom page sizes because they don't have physical paper size limitations. Also, not all printers on the market have an option to define a custom paper size.
To avoid setting custom paper size on the printer, which doesn't have such an option, we have added a new property to our library called AllowCustomSize. If that property is true, PageAutoSize will set a custom paper size if the calculated paper size isn't found. Otherwise, the current printer default paper size will be used. By default, the AllowCustomSize property is false.

2. The printer supports the required paper size, but automatic tray selection isn't available.
Some printers have more than one paper source tray. Each tray can be used for a different paper size - for example, Tray 1 is used for A4 while Tray 2 is used for Letter.
If you try to print A4 PDF page size to A4, but the printer driver isn't able to automatically select a correct paper tray that contains A4 paper - that won't work. However, in most cases, a printer driver will be able to handle such a scenario.
But, in some rare cases, where that doesn't work, we have added a property PaperSourceTrayInfo, which helps our library set PrinterTray correctly. That property has to be hard-coded to work properly. Please note, as it's not practical to use the PaperSourceTrayInfo property, this is more of a workaround for some specific rare cases.

Can't find the answer to your question?
Contact us and we'll get back to you within 24 hours.

We provide support only in English.
License expired?

Request a free trial license extension in case you need more time to evaluate our product. You will receive your new trial license shortly after you fill out the application.

Request now
Partner program

Cloud services and managed services providers can benefit with our products. The TerminalWorks Partner Program enables you to buy license packages of TerminalWorks products and resell them.

Apply now
Contact information

Tehnical Support Phone
(407) 567-0096

Sales Phone
(407) 567-0097

Telephone support available from 10 AM till 10 PM Central European Time
Contact us
Copyright © 2021 TerminalWorks. All Rights Reserved