BCL easyPDF SDK
easyPDF SDK Usermanual
PDF Creator Programming API  |  Download Free Trial  |  Contact Us to Purchase

Using the Loader Service

The Loader Service is available from all APIs, including COM, .NET and Java. However, the usage is completely different depending on the programming environment.

Note that the Loader Service is not working properly unless it is configured first. Please read easyPDF SDK Loader Setup for more information.

Loader is not working properly unless a desktop user is assigned to the service, and it is constantly running!

The Loader Service also requires the purchase of a special server license. Without this license server-side printing is impossible.

COM Objects

If you are using the COM objects, the Loader Service is accessible via the Loader object. This is also true for the .NET COM Interop, as well as the Java COM Bridge.

VBScript Example:

Set oLoader = Server.CreateObject("easyPDF.Loader.8")
Set oPrinter = oLoader.LoadObject("easyPDF.Printer.8")
oPrinter.PrintJob.PrintOut InputFileName, OutputFileName

C# COM Interop Example:

Loader loader = new Loader();
Printer printer = (Printer)loader.LoadObject("easyPDF.Printer.8");
printer.PrintJob.PrintOut(inputFileName, outputFileName);

Error Codes for COM: ldrResult Enumeration

LDR_R_UNKNOWN = 0x8004FFFF

Unknown error

LDR_R_INTERNAL = 0x80050000

Internal error

LDR_R_INVALID_PARAM = 0x80050001

Invalid parameter(s)

LDR_R_SETUP_INVALID = 0x80050002

This product is not setup correctly

LDR_R_LICENSE_INVALID = 0x80050003

Invalid license key

LDR_R_LICENSE_EXPIRED = 0x80050004

License key expired

LDR_R_OUT_OF_MEMORY = 0x80050005

Not enough memory to continue

LDR_R_FEATURE_NOT_ENABLED = 0x80050006

The Loader feature is not enabled with the supplied license key

LDR_R_SUCCESS = 0

Success

Native .NET API

Loader is completely automatic, and you are not required to write any special code to use it:

using(Printer printer = new Printer())
{
   printer.PrintJob.PrintOut(inputFileName, outputFileName);
}

The native .NET API automatically determines whether Loader is required under the current circumstances. Loader is always needed for Printer when the customer's application is running under a system service or a web server (the Window Station 0, aka "WinSta0"). Otherwise Loader is not used by default.

Some users might want to force Loader, even if it is not required. This is mainly done for testing purposes, or to gain permission to special directories.

You can force the use of Loader by explicitly using the PrinterLoader class:

PrinterLoader loader = new PrinterLoader(true); // use Loader even on the desktop
using(Printer printer = loader.LaunchPrinter())
{
   printer.PrintJob.PrintOut(@"c:\temp\input.doc", @"c:\temp\output.pdf");
}

PrinterLoader's constructor takes one input parameter:

In .NET, easyPDF SDK cannot automatically start the Loader Service. Therefore it is imperative that you change the Loader Service settings from Manual to Automatic and make sure it is always running.

All major SDK objects have their own corresponding Loader classes:

SDK Impersonator Method
Printer PrinterLoader LaunchPrinter
PDFProcessor PDFProcessorLoader LaunchPDFProcessor
PDFConverter PDFConverterLoader LaunchPDFConverter
PDFDocument PDFDocumentLoader LaunchPDFDocument

Only in .NET, the LaunchPrinter, LaunchPDFProcessor, LaunchPDFConverter and LaunchPDFDocument methods have an optional timeout parameter, which is the maximum number of milliseconds to wait for the worker process. If missing, the default value is 60000 (which is 1 minute). You may very easily override this:

PrinterLoader loader = new PrinterLoader(true); // use Loader even on the desktop
Printer printer = loader.LaunchPrinter(120000);

Native Java API

The native Java API cannot detect whether the Loader Service is necessary or not, therefore it assumes it is needed for Printer, and not needed for the other SDKs.

Desktop users, on the other hand, are not required to use Loader, and therefore they can turn it off with the help of the PrinterLoader class:

PrinterLoader loader = new PrinterLoader(false); // on the desktop, there is no need for Loader; on a server, this must be true
Printer printer = loader.LaunchPrinter();
try
{
   PrintJob printJob = printer.getPrintJob();
   printJob.PrintOut("c:\\test\\input.docx", "c:\\test\\output.pdf");
}
catch(PrinterException e)
{
   System.out.println(e);
}
finally
{
   printer.dispose();
}

PrinterLoader's constructor takes one input parameter:

In Java, easyPDF SDK cannot automatically start the Loader Service. Therefore it is imperative that you change the Loader Service settings from Manual to Automatic and make sure it is always running.

If Loader is required or requested but not running, easyPDF will fail with an exception.

Technically, only Printer needs the Loader Service. However, some users might want to force Loader for other objects, such as PDFProcessor, even if it is not required. This is mainly done for testing purposes, or to gain permission to special directories.

All major SDK objects have their own corresponding Loader classes:

SDK Impersonator Method
Printer PrinterLoader LaunchPrinter
PDFProcessor PDFProcessorLoader LaunchPDFProcessor
PDFConverter PDFConverterLoader LaunchPDFConverter
PDFDocument PDFDocumentLoader LaunchPDFDocument

For example, here is how to force the use of Loader with PDFProcessor:

PDFProcessorLoader loader = new PDFProcessorLoader(true); // true = force the use of Loader
PDFProcessor processor = loader.LaunchPDFProcessor();

Native PHP API

The native PHP API cannot detect whether the Loader Service is necessary or not, therefore it assumes it is not needed by default.

Server users, on the other hand, are required to use Loader with Printer, which can be done with the PrinterLoader class:

$loader = new BCL\easyPDF\Printer\PrinterLoader();
$printer = $loader->LaunchPrinter();
try
{
   $printer->getPrintJob()->PrintOut(inputFileName, outputFileName);
}
catch(BCL\easyPDF\Printer\PrinterException $ex)
{
   echo $ex->getMessage(), "\n";
}

In PHP, easyPDF SDK cannot automatically start the Loader Service. Therefore it is imperative that you change the Loader Service settings from Manual to Automatic and make sure it is always running.

If Loader is required or requested but not running, easyPDF will fail with an exception.

Technically, only Printer needs the Loader Service. However, some users might want to force Loader for other objects, such as PDFProcessor, even if it is not required. This is mainly done for testing purposes, or to gain permission to special directories.

All major SDK objects have their own corresponding Loader classes:

SDK Impersonator Method
Printer PrinterLoader LaunchPrinter
PDFProcessor PDFProcessorLoader LaunchPDFProcessor
PDFConverter PDFConverterLoader LaunchPDFConverter

Native Python API

The native Python API cannot detect whether the Loader Service is necessary or not, therefore it assumes it is not needed by default.

Server users, on the other hand, are required to use Loader with Printer, which can be done with the PrinterLoader class:

loader = easyPDFPrinter.PrinterLoader()
printer = loader.LaunchPrinter()
try:
   printer.getPrintJob().PrintOut(inputFileName, outputFileName)
except easyPDFPrinter.PrinterException as ex:
   print(ex)

In Python, easyPDF SDK cannot automatically start the Loader Service. Therefore it is imperative that you change the Loader Service settings from Manual to Automatic and make sure it is always running.

If Loader is required or requested but not running, easyPDF will fail with an exception.

Technically, only Printer needs the Loader Service. However, some users might want to force Loader for other objects, such as PDFProcessor, even if it is not required. This is mainly done for testing purposes, or to gain permission to special directories.

All major SDK objects have their own corresponding Loader classes:

SDK Impersonator Method
Printer PrinterLoader LaunchPrinter
PDFProcessor PDFProcessorLoader LaunchPDFProcessor
PDFConverter PDFConverterLoader LaunchPDFConverter