Platforms to show: All Mac Windows Linux Cross-Platform

Back to WindowsAddPrintJobMBS class.

WindowsAddPrintJobMBS.AddJob as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Printing MBS Win Plugin 6.1 ❌ No ✅ Yes ❌ No ❌ No Desktop, Console & Web
Creates a new print job.

Returns true on success and false on failure.

Some examples using this method:

WindowsAddPrintJobMBS.ClosePrinter

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Printing MBS Win Plugin 16.4 ❌ No ✅ Yes ❌ No ❌ No Desktop, Console & Web
Closes printer connection.

WindowsAddPrintJobMBS.EndDocPrinter as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Printing MBS Win Plugin 10.3 ❌ No ✅ Yes ❌ No ❌ No Desktop, Console & Web
The EndDocPrinter function ends a print job for the specified printer.

If the function succeeds, the return value is a true.

The EndDocPrinter function returns an error if the print job was not started by calling the StartDocPrinter function.

The sequence for a print job is as follows:

1. To begin a print job, call StartDocPrinter.
2. To begin each page, call StartPagePrinter.
3. To write data to a page, call WritePrinter.
4. To end each page, call EndPagePrinter.
5. Repeat 2, 3, and 4 for as many pages as necessary.
6. To end the print job, call EndDocPrinter.

When a page in a spooled file exceeds approximately 350 MB, it may fail to print and not send an error message. For example, this can occur when printing large EMF files. The page size limit depends on many factors including the amount of virtual memory available, the amount of memory allocated by calling processes, and the amount of fragmentation in the process heap.

Some examples using this method:

WindowsAddPrintJobMBS.EndPagePrinter as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Printing MBS Win Plugin 10.3 ❌ No ✅ Yes ❌ No ❌ No Desktop, Console & Web
The EndPagePrinter function notifies the print spooler that the application is at the end of a page in a print job.

If the function succeeds, the return value is a true.

The sequence for a print job is as follows:

1. To begin a print job, call StartDocPrinter.
2. To begin each page, call StartPagePrinter.
3. To write data to a page, call WritePrinter.
4. To end each page, call EndPagePrinter.
5. Repeat 2, 3, and 4 for as many pages as necessary.
6. To end the print job, call EndDocPrinter.

When a page in a spooled file exceeds approximately 350 MB, it can fail to print and not send an error message. For example, this can occur when printing large EMF files. The page size limit depends on many factors including the amount of virtual memory available, the amount of memory allocated by calling processes, and the amount of fragmentation in the process heap.

Some examples using this method:

WindowsAddPrintJobMBS.OpenPrinter(PrinterName as string) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Printing MBS Win Plugin 6.1 ❌ No ✅ Yes ❌ No ❌ No Desktop, Console & Web
Opens the printer for printing.

Returns true on success and false on failure.
PrinterName can be "" for the default printer.

WindowsAddPrintJobMBS.ScheduleJob as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Printing MBS Win Plugin 6.1 ❌ No ✅ Yes ❌ No ❌ No Desktop, Console & Web
Schedules the printing.

Returns true on success and false on failure.

Some examples using this method:

WindowsAddPrintJobMBS.StartDocPrinter(DocName as string, Datatype as string) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Printing MBS Win Plugin 10.3 ❌ No ✅ Yes ❌ No ❌ No Desktop, Console & Web
The StartDocPrinter function notifies the print spooler that a document is to be spooled for printing.
Example
// Print Postscript directly to Postscript printer
const PrinterName = "Brother DCP-8085DN"

dim w as new WindowsAddPrintJobMBS

if not w.OpenPrinter(PrinterName) then
MsgBox "OpenPrinter failed. Is the printer name correct in the source code?"
Return
end if

const DocName = "My Document"

if not w.StartDocPrinter("My Document", w.kDataFormatRAW) then
MsgBox "StartDocPrinter failed."
Return
end if

MsgBox "Print Job ID: "+str(w.JobID)

call w.StartPagePrinter

dim PostScript as string = "%!PS"+EndOfLine.UNIX+".1 setgray"+EndOfLine.UNIX+"0 0 100 100 rectfill"+EndOfLine.UNIX+"showpage"+EndOfLine.UNIX

dim BytesSent as Integer = w.WritePrinter(PostScript)

MsgBox str(BytesSent)+" bytes of "+str(lenb(PostScript))+" bytes sent."

call w.EndPagePrinter
call w.EndDocPrinter

w = nil // close printer

DocName: A string that specifies the name of the document.
OutputFile: Optional a path string or a folderitem that specifies the name of an output file. To print to a printer, set this to "" or nil or leave away.
Datatype: A string that identifies the type of data used to record the document.

If the function succeeds, the return value is true and the JobID property is set.

The sequence for a print job is as follows:

1. To begin a print job, call StartDocPrinter.
2. To begin each page, call StartPagePrinter.
3. To write data to a page, call WritePrinter.
4. To end each page, call EndPagePrinter.
5. Repeat 2, 3, and 4 for as many pages as necessary.
6. To end the print job, call EndDocPrinter.

When a page in a spooled file exceeds approximately 350 MB, it can fail to print and not send an error message. For example, this can occur when printing large EMF files. The page size limit depends on many factors including the amount of virtual memory available, the amount of memory allocated by calling processes, and the amount of fragmentation in the process heap.

See also:

Some examples using this method:

WindowsAddPrintJobMBS.StartDocPrinter(DocName as string, OutputFile as folderitem, Datatype as string) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Printing MBS Win Plugin 10.3 ❌ No ✅ Yes ❌ No ❌ No Desktop, Console & Web
The StartDocPrinter function notifies the print spooler that a document is to be spooled for printing.
Example
// Print Postscript directly to Postscript printer
const PrinterName = "Brother DCP-8085DN"

dim w as new WindowsAddPrintJobMBS

if not w.OpenPrinter(PrinterName) then
MsgBox "OpenPrinter failed. Is the printer name correct in the source code?"
Return
end if

const DocName = "My Document"

// output to a file
dim file as FolderItem = SpecialFolder.Desktop.Child("test.ps")

if not w.StartDocPrinter("My Document", file, w.kDataFormatRAW) then
MsgBox "StartDocPrinter failed."
Return
end if

MsgBox "Print Job ID: "+str(w.JobID)

call w.StartPagePrinter

dim PostScript as string = "%!PS"+EndOfLine.UNIX+".1 setgray"+EndOfLine.UNIX+"0 0 100 100 rectfill"+EndOfLine.UNIX+"showpage"+EndOfLine.UNIX

dim BytesSent as Integer = w.WritePrinter(PostScript)

MsgBox str(BytesSent)+" bytes of "+str(lenb(PostScript))+" bytes sent."

call w.EndPagePrinter
call w.EndDocPrinter

w = nil // close printer

DocName: A string that specifies the name of the document.
OutputFile: Optional a path string or a folderitem that specifies the name of an output file. To print to a printer, set this to "" or nil or leave away.
Datatype: A string that identifies the type of data used to record the document.

If the function succeeds, the return value is true and the JobID property is set.

The sequence for a print job is as follows:

1. To begin a print job, call StartDocPrinter.
2. To begin each page, call StartPagePrinter.
3. To write data to a page, call WritePrinter.
4. To end each page, call EndPagePrinter.
5. Repeat 2, 3, and 4 for as many pages as necessary.
6. To end the print job, call EndDocPrinter.

When a page in a spooled file exceeds approximately 350 MB, it can fail to print and not send an error message. For example, this can occur when printing large EMF files. The page size limit depends on many factors including the amount of virtual memory available, the amount of memory allocated by calling processes, and the amount of fragmentation in the process heap.

See also:

WindowsAddPrintJobMBS.StartDocPrinter(DocName as string, OutputFilePath as string, Datatype as string) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Printing MBS Win Plugin 10.3 ❌ No ✅ Yes ❌ No ❌ No Desktop, Console & Web
The StartDocPrinter function notifies the print spooler that a document is to be spooled for printing.
Example
// Print Postscript directly to Postscript printer
const PrinterName = "Brother DCP-8085DN"

dim w as new WindowsAddPrintJobMBS

if not w.OpenPrinter(PrinterName) then
MsgBox "OpenPrinter failed. Is the printer name correct in the source code?"
Return
end if

const DocName = "My Document"

// output to a file
dim file as string = "C:\test.ps"

if not w.StartDocPrinter("My Document", file, w.kDataFormatRAW) then
MsgBox "StartDocPrinter failed."
Return
end if

MsgBox "Print Job ID: "+str(w.JobID)

call w.StartPagePrinter

dim PostScript as string = "%!PS"+EndOfLine.UNIX+".1 setgray"+EndOfLine.UNIX+"0 0 100 100 rectfill"+EndOfLine.UNIX+"showpage"+EndOfLine.UNIX

dim BytesSent as Integer = w.WritePrinter(PostScript)

MsgBox str(BytesSent)+" bytes of "+str(lenb(PostScript))+" bytes sent."

call w.EndPagePrinter
call w.EndDocPrinter

w = nil // close printer

DocName: A string that specifies the name of the document.
OutputFile: Optional a path string or a folderitem that specifies the name of an output file. To print to a printer, set this to "" or nil or leave away.
Datatype: A string that identifies the type of data used to record the document.

If the function succeeds, the return value is true and the JobID property is set.

The sequence for a print job is as follows:

1. To begin a print job, call StartDocPrinter.
2. To begin each page, call StartPagePrinter.
3. To write data to a page, call WritePrinter.
4. To end each page, call EndPagePrinter.
5. Repeat 2, 3, and 4 for as many pages as necessary.
6. To end the print job, call EndDocPrinter.

When a page in a spooled file exceeds approximately 350 MB, it can fail to print and not send an error message. For example, this can occur when printing large EMF files. The page size limit depends on many factors including the amount of virtual memory available, the amount of memory allocated by calling processes, and the amount of fragmentation in the process heap.

See also:

WindowsAddPrintJobMBS.StartPagePrinter as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Printing MBS Win Plugin 10.3 ❌ No ✅ Yes ❌ No ❌ No Desktop, Console & Web
The StartPagePrinter function notifies the spooler that a page is about to be printed on the specified printer.

If the function succeeds, the return value is a true.

The sequence for a print job is as follows:

1. To begin a print job, call StartDocPrinter.
2. To begin each page, call StartPagePrinter.
3. To write data to a page, call WritePrinter.
4. To end each page, call EndPagePrinter.
5. Repeat 2, 3, and 4 for as many pages as necessary.
6. To end the print job, call EndDocPrinter.

When a page in a spooled file exceeds approximately 350 MB, it can fail to print and not send an error message. For example, this can occur when printing large EMF files. The page size limit depends on many factors including the amount of virtual memory available, the amount of memory allocated by calling processes, and the amount of fragmentation in the process heap.

Some examples using this method:

WindowsAddPrintJobMBS.WriteJob(data as string) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Printing MBS Win Plugin 6.1 ❌ No ✅ Yes ❌ No ❌ No Desktop, Console & Web
Adds data to the spool file.

You need to pass raw data for the printer, e.g. postscript data.
Returns the number of bytes written.
So lenb(data) should be equal to the result.
Only available between a call to AddJob and ScheduleJob.

Some examples using this method:

WindowsAddPrintJobMBS.WritePrinter(data as string) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Printing MBS Win Plugin 10.3 ❌ No ✅ Yes ❌ No ❌ No Desktop, Console & Web
The WritePrinter function notifies the print spooler that data should be written to the specified printer.

data: The data that should be written to the printer.

If the function succeeds, the return value is a true.

The sequence for a print job is as follows:

1. To begin a print job, call StartDocPrinter.
2. To begin each page, call StartPagePrinter.
3. To write data to a page, call WritePrinter.
4. To end each page, call EndPagePrinter.
5. Repeat 2, 3, and 4 for as many pages as necessary.
6. To end the print job, call EndDocPrinter.

When a high-level document (such as an Adobe PDF or Microsoft Word file) or other printer data (such PCL, PS, or HPGL) is sent directly to a printer, the print settings defined in the document take precedent over Windows print settings.

When a page in a spooled file exceeds approximately 350 MB, it can fail to print and not send an error message. For example, this can occur when printing large EMF files. The page size limit depends on many factors including the amount of virtual memory available, the amount of memory allocated by calling processes, and the amount of fragmentation in the process heap.

Some examples using this method:

The items on this page are in the following plugins: MBS Win Plugin.


The biggest plugin in space...