Print existing PDF files to an installed printer
Foxit Quick PDF Library can print PDF files to an installed printer using the PrintDocument function. PDF files can be printed to any installed printer driver regardless of whether it is for a physical printer or a virtual printer such as Microsoft XPS Document Writer. There are a range of other printing related functions that can be used with the PrintDocument function for maximum flexibility.
If you want more granular control over printing options then you can use the custom printer functions.
C# Sample Code
/* Print a PDF programmatically without viewing it */
// Load a sample file from the input folder
DPL.LoadFromFile("test.pdf", "");
// Configure print options
int iPrintOptions = DPL.PrintOptions(0, 0, "Printing Sample");
// Print the current document to the default printing
// using the options as configured above
DPL.PrintDocument(DPL.GetDefaultPrinterName(), 1, 1, iPrintOptions);
Delphi Sample Code
procedure TForm6.PrintDocumentClick(Sender: TObject);
var
iPrintOptions: Integer;
begin
DPL := TDebenuPDFLibrary1115.Create;
try
UnlockResult := DPL.UnlockKey('...'); // Add trial license key here
if UnlockResult = 1 then
begin
// Load your file
DPL.LoadFromFile('test.pdf', '');
// Configure print options
iPrintOptions := DPL.PrintOptions(0, 0, 'Printing Sample');
// Print the current document to the default printing
// using the options as configured above
DPL.PrintDocument(DPL.GetDefaultPrinterName(), 1, 1, iPrintOptions);
end;
finally
DPL.Free;
end;
end;
This article refers to a deprecated product. If you are looking for support for Foxit PDF SDK, please click here.
Updated on May 16, 2022