To print a PDF to a default printer.
1PDFDoc pdfdoc = new PDFDoc(filename);
2
3// Setup PrinterMode options
4PrinterMode printerMode = new PrinterMode();
5printerMode.SetCollation(true);
6printerMode.SetCopyCount(1);
7printerMode.SetDPI(600); // regardless of ordering, an explicit DPI setting overrides the OutputQuality setting
8printerMode.SetDuplexing(PrinterMode.DuplexMode.e_Duplex_Auto);
9
10// Print the document on the default printer, name the print job the name of the
11// file, print to the printer not a file, and use printer options:
12Print.StartPrintJob(pdfdoc, "", pdfdoc.GetFileName(), "", null, printerMode, null);
1PDFDoc doc(filename);
2
3// Setup PrinterMode options
4PrinterMode printerMode;
5printerMode.SetCollation(true);
6printerMode.SetCopyCount(1);
7printerMode.SetDPI(600); // regardless of ordering, an explicit DPI setting overrides the OutputQuality setting
8printerMode.SetDuplexing(PrinterMode::e_Duplex_Auto);
9
10// Print the document on the default printer, name the print job the name of the
11// file, print to the printer not a file, and use printer options:
12Print::StartPrintJob(doc, UString(""), doc.GetFileName(), UString(""), NULL, &printerMode, NULL );
1doc := NewPDFDoc(filename)
2
3// Set our PrinterMode options
4printerMode := NewPrinterMode()
5printerMode.SetCollation(true)
6printerMode.SetCopyCount(1)
7printerMode.SetDPI(100); // regardless of ordering, an explicit DPI setting overrides the OutputQuality setting
8printerMode.SetDuplexing(PrinterModeE_Duplex_Auto)
9
10// Print the PDF document to the default printer, using "tiger.pdf" as the document
11// name, send the file to the printer not to an output file, print all pages, set the printerMode
12// and a cancel flag to true
13pageSet := NewPageSet(1, doc.GetPageCount())
14boolValue := true
15PrintStartPrintJob(doc, "", doc.GetFileName(), "", pageSet, printerMode, &boolValue)
1PDFDoc doc = new PDFDoc(filename);
2
3// Setup PrinterMode options
4PrinterMode printerMode = new PrinterMode();
5printerMode.setCollation(true);
6printerMode.setCopyCount(1);
7printerMode.setDPI(600); // regardless of ordering, an explicit DPI setting overrides the OutputQuality setting
8printerMode.setDuplexing(PrinterMode.e_Duplex_Auto);
9
10// Print the document on the default printer, name the print job the name of the
11// file, print to the printer not a file, and use printer options:
12Print.startPrintJob(doc, "", doc.getFileName(), "", null, printerMode, null);
1- (void)handlePrintJob:(id)sender
2{
3 PTPrint *print = [[PTPrint alloc] init];
4 [print PrepareDocToPrint:self.pdfDoc Delegate:[[MyPrintDelegate alloc] initWithView:self.view] UserData:sender];
5}
6
7@interface MyPrintDelegate : NSObject <PTPrintDelegate>
8
9- (instancetype)initWithView:(UIView *)view;
10
11@property (nonatomic, strong) UIView *view;
12
13@end
14
15@implementation MyPrintDelegate
16
17- (instancetype)initWithView:(UIView *)view
18{
19 self = [super init];
20 if (self) {
21 _view = view;
22 }
23 return self;
24}
25
26- (void)PreparedToPrint:(NSString *)docFilePath UserData:(id)userData
27{
28 PTPrint *myPrint = [[PTPrint alloc] init];
29 [myPrint PrintDoc:docFilePath FromRect:CGRectZero InView:self.view WithJobName:docFilePath Animated:YES CompletionHandler:nil];
30}
31
32@end
1$doc = new PDFDoc($filename);
2
3// Setup PrinterMode options
4$printerMode = new PrinterMode();
5$printerMode->SetCollation(true);
6$printerMode->SetCopyCount(1);
7$printerMode->SetDPI(600); // regardless of ordering, an explicit DPI setting overrides the OutputQuality setting
8$printerMode->SetDuplexing(PrinterMode::e_Duplex_Auto);
9
10// Print the document on the default printer, name the print job the name of the
11// file, print to the printer not a file, and use printer options:
12PDFPrint::StartPrintJob($doc, "", $doc->GetFileName(), "", null, $printerMode, null);
1doc = PDFDoc(filename)
2
3# Setup PrinterMode options
4printerMode = PrinterMode()
5printerMode.SetCollation(True)
6printerMode.SetCopyCount(1)
7printerMode.SetDPI(600); # regardless of ordering, an explicit DPI setting overrides the OutputQuality setting
8printerMode.SetDuplexing(PrinterMode.e_Duplex_Auto)
9
10# Print the document on the default printer, name the print job the name of the
11# file, print to the printer not a file, and use printer options:
12Print.StartPrintJob(doc, "", doc.GetFileName(), "", None, printerMode, None)
1doc = PDFDoc.new(filename)
2
3# Setup PrinterMode options
4printerMode = PrinterMode.new
5printerMode.SetCollation(true)
6printerMode.SetCopyCount(1)
7printerMode.SetDPI(100) # regardless of ordering, an explicit DPI setting overrides the OutputQuality setting
8printerMode.SetDuplexing(PrinterMode::E_Duplex_Auto)
9
10# Print the document on the default printer, name the print job the name of the
11# file, print to the printer not a file, and use printer options:
12Print.StartPrintJob(doc, "", doc.GetFileName(), "", nil, printerMode, nil)
1Dim doc As PDFDoc = New PDFDoc(filename)
2
3' Setup printing options:
4Dim printerMode As PrinterMode = New PrinterMode
5printerMode.SetCollation(True)
6printerMode.SetCopyCount(1)
7printerMode.SetDPI(600) ' regardless of ordering, an explicit DPI setting overrides the OutputQuality setting
8printerMode.SetDuplexing(printerMode.DuplexMode.e_Duplex_Auto)
9
10' Print the document on the default printer, name the print job the name of the
11' file, print to the printer not a file, and use default printer options:
12Print.StartPrintJob(doc, "", doc.GetFileName(), "", Nothing, printerMode, Nothing)
Print a PDF file
Full sample code which illustrates how to print a PDF document using the currently selected default printer.
Did you find this helpful?
Trial setup questions?
Ask experts on DiscordNeed other help?
Contact SupportPricing or product questions?
Contact Sales