PrintDocumentToFileA

Rendering and printing

Description

The trailing A denotes the ANSI (char) DLL entry point; the ActiveX/COM surface exposes only the Unicode form. Behaviour is identical to PrintDocumentToFile and string arguments are interpreted using the current SetAnsiMode code page

Renders certain pages from the selected document to the specified printer. The print output is directed to the specified spool file.

Not all printer drivers support the DocInfo.lpszOutput field so results may vary.

Syntax

Delphi

Function DLPrintDocumentToFileA(InstanceID: Integer; PrinterName: PAnsiChar; StartPage, EndPage, Options: Integer; FileName: PAnsiChar): Integer;

DLL

int DLPrintDocumentToFileA(int InstanceID, const char * PrinterName, int StartPage, int EndPage, int Options, const char * FileName);

Parameters

PrinterNameThe name of the printer to use for printing. This is the name that appears in the Windows Print Manager. Use the GetPrinterNames function to return a list of valid printers on the system. A value returned by the NewCustomPrinter function can also be used here.
StartPageThe first page to print
EndPageThe last page to print
OptionsUse the PrintOptions function to obtain a value for this parameter
FileNameThe file name where print output should be spooled to.