Beruflich Dokumente
Kultur Dokumente
Prerequisites
The LightScribe Direct Disc Labeling technology builds on existing industry standards for
optical discs and hardware. This document assumes that readers are already familiar
with these existing standards and that the products enabled with LightScribe Direct Disc
Labeling technology are in full compliance with these standards.
Version Information
Version 3.0 September 6, 2008
In Version 3.0, the following changes were made.
The LSPrintLauncher library has been deprecated in favor of the LSPrintAPI
library. New users of the SDK should use the LSPrintAPI library. This document
will describe the LSPrintAPI library and its functionality.
Additional APIs were added to facilitate unattended, programmatic control of the
printing. These APIs include:
o get_drive_count()
LightScribe Public Windows Software Development Kit (SDK)
o get_drive_path()
o get_drive_display_name()
o get_drive_status()
o get_print_status()
o abort_print()
Additional command line options were added to the launch_printing_dialog() API
to facilitate unattended, programmatic control of the printing. The enhanced
launch_printing_dialog() options are used in conjunction with the new APIs
indicated above.
Contents
1 Introduction
The goals of this Windows LightScribe Software Development Kit are to:
This SDK provides access to the 2nd and 3rd pieces of functionality. The actual
components are distributed as part of the LightScribe System Software Version 1.10.19.1
and onwards. The software components provide almost all of the standard functionality a
LightScribe labeling application needs to support LightScribe printing. It provides a
simple way for an application to be enabled for LightScribe labeling.
Standard Usage:
In this usage model, the application launches the Print Options Dialog (using the
launch_print_options_dialog API). This dialog box provides the user with options to
initiate printing of a label to a LightScribe drive. Once the user selects the Print button
on the dialog, the print will begin and the Printing Dialog will be displayed to provide
monitoring of the print progress.
Applications should, in general, only interact with the Print Options Dialog (using the
launch_print_options_dialog API) rather than the Printing Dialog (using the
launch_printing_dialog API). The Printing Dialog is available to support direct
printing without requiring user interaction to select the print options.
Programmatic Usage:
In this usage model, the application gets the drive count and then iterates through the
number of drives to get the path, name, and status of each drive. These values are then
used to launch a print to a specific drive via the Printing Dialog (using the
launch_printing_dialog API). By default the Printing Dialog will appear and pop-up
dialogs will be displayed as necessary to resolve error conditions. The Printing Dialog
can be minimized with the noShow command line option. The pop-up dialogs can be
suppressed with the noOperator option. The application can then monitor the status of
print jobs using the get_print_status() API. If necessary the application can abort a
print in progress with the abort_print() API.
A sample application, AutoPrint, is included in the SDK to illustrate this usage model.
In this mode of use, the dialogs are launched directly and given command-line
parameters. The command line options are the same as used by the LSPrintAPI library.
The launch_print_options_dialog function corresponds to LSPrintDialog.exe, and
launch_printing_dialog function corresponds to LSPrintingDialog.exe. For example:
1.5 Localization
The LightScribe Printing Components are localized into these languages:
LangID
Primary Language 3-LA (dec)
The components are Microsoft Multilingual User Interface (MUI) enabled, so they will
detect which display language to use. Because of this, if the OS is running in one
language, but the user has set the Display Language to another language, the components
may be running in a different language than the application if the application is not MUI
enabled and thus is not reading the Display Language.
2 Library Usage
2.1 Library Footprint
The LightScribe Labeling Components Library consists of the following files:
LSPrintAPI.dll – dynamic link library
LSPrintAPI.lib – import library for linker
LSPrintAPI.h – header file with API
LSPrintStatusCodes.h – header file with print status codes
If this key is not present or the location it specifies cannot be loaded, a localized message
should be display to inform the user that they need to install the latest version of the
The ImageBurner2 sample application code can be built using the ImageBurner2 Visual
Studio 2005 project (ImageBurner2SDK.vcproj). The AutoPrint sample application code
can be built using the AutoPrint Visual Studio project (AutoPrintSDK.vcproj). Also
included is the “LightScribeSDK” folder which contains the files needed to use the API.
These files must be copied to a suitable location for the application’s build system.
Note: Because the LightScribe System Software components are not included in the
SDK, the developer must have the LightScribe System Software installed in order to test
the application.
Document Number: PWSDK Revision: 3, Date:12/10/2008
Page 11 of 23
LightScribe Public Windows Software Development Kit (SDK)
3 LSPrintAPI Library
3.1 API Definition
Below is an excerpt from LSPrintAPI.h showing the API. The remainder of this section
describes each API in detail.
/**************************************************************************************/
/** API entry point for launching the Print Options dialog.
* @param pOptions The string consists of a list of options, each option is prefixed
with "--".\n
* The options string can have the following parameters:\n
* "--version" or "--v" : Displays the version dialog\n
* "--help" or "--h" : Display dialog with description of the API for the developer (not
intended for end-user)\n
* "--filename" or "--f" : Source image file name (string)\n
* "--deleteImageFile" or "--d" : Automatically delete source file (boolean, default
value = "false" ("0"))\n
* @return 0 = Success, other error codes as per winerror.h
*/
LSPRINTAPI_EXPORT int launch_print_options_dialog(const wchar_t* pOptions);
/**************************************************************************************/
/**************************************************************************************/
/** API entry point for launching the Printing dialog.
* @param pOptions The string consists of a list of options, each option is prefixed
with "--".\n
* The options string can have the following parameters:\n
* "--version" or "--v" : Displays the version dialog\n
* "--help" or "--h" : Display dialog with description of the API for the developer (not
intended for end-user)\n
* "--filename" or "--f" : Image file name (string)\n
* "--index" or "--i", : Drive index (unsigned int)\n
* "--name" or "--n" : Drive name (string)\n
* "--quality" or "--q" : Label quality (string - "draft"/"normal"/"best", default value
= "normal")\n
* "--path" : Drive path (string)\n
* "--copies" or "--c" : Number of copies (unsigned int, default value = "1")\n
* "--targetfile" or "—t" : Print to file target file name (string)\n
* "--media" or "--m" : Media already detected (bool, default value = "1")\n
* "--deleteImageFile" or "--d" : Automatically delete source file (bool, default value
= "false" ("0"))\n
* "--autoClose" or "--a" : Close dialog when print completes (bool, default value =
"false" ("0"))\n
* "--noShow" or "--s" : Hide dialog during printing (bool, default value = "false"
("0"))\n
* "--autoEject" or "--e" : Automatically open tray when print completes (bool, default
value = "true" ("1"))\n
* "--useGeneric" or "--g" : Don't prompt if generic printing is intended (bool, default
value = "false" ("0"))\n
* "--noOperator" or "--o" : Unattended mode of operation with no user interface
interactions (bool, default value = "false" ("0"))\n
* @return 0 = Success, other error codes as per winerror.h
*/
LSPRINTAPI_EXPORT int launch_printing_dialog(const wchar_t* pOptions);
/**************************************************************************************/
/** These constant definitions are used by the PrintInfo related API's **/
const int LS_SUCCESS = 0; /* success */
const int LS_FAILURE = 1; /* unknown failure */
const int LS_INVALID_DRIVE_INDEX = 2; /* Drive index number is not within the range of
valid drives */
const int LS_INVALID_ARRAY_SIZE = 3; /* Array size specified is too small for return
value */
/**************************************************************************************/
/** API entry point for testing if there is a LightScribe drive on the system.
* Note: This requires the LightScribe System Software to be installed.
* @param rHaveDrive Output parameter: true = 1 or false = 0
* @return LS_SUCCESS or other error codes as per LSPrintAPI.h
*/
LSPRINTAPI_EXPORT int have_lightscribe_drive(bool& rHaveDrive);
/**************************************************************************************/
/**************************************************************************************/
/** API entry point to get the number of LightScribe drive on the system.
* Note: This requires the LightScribe System Software to be installed.
* @param rDriveCount Output parameter: Number of drives
* @return LS_SUCCESS or other error codes as per LSPrintAPI.h
**/
LSPRINTAPI_EXPORT int get_drive_count(unsigned int& rDriveCount);
/**************************************************************************************/
/**************************************************************************************/
/** API entry point to get the path name of a LightScribe drive. E.g. "D", "E"...
* Note: This requires the LightScribe System Software to be installed.
* @param driveIndex Index of drive. Drives are numbered from 0 to driveCount - 1.
* @param pDrivePath Output parameter: Name of the drive path
* @param drivePathSize Allocated size of the drive path array.
* @return LS_SUCCESS or other error codes as per LSPrintAPI.h
**/
LSPRINTAPI_EXPORT int get_drive_path(const unsigned int driveIndex, wchar_t* pDrivePath,
const unsigned int drivePathSize);
/**************************************************************************************/
/**************************************************************************************/
/** API entry point to get the name of a LightScribe drive.
* Note: This requires the LightScribe System Software to be installed.
* @param driveIndex Index of drive. Drives are numbered from 0 to driveCount - 1.
* @param pDriveDisplayName Output parameter: Display name of the drive
* @param driveDisplayNameSize The length, in number of characters, already allocated to
pDriveDisplayName
* @return code: LS_SUCCESS or other error codes as per LSPrintAPI.h
**/
LSPRINTAPI_EXPORT int get_drive_display_name(const unsigned int driveIndex, wchar_t*
pDriveDisplayName, const unsigned int driveDisplayNameSize);
/**************************************************************************************/
/**************************************************************************************/
/** API entry point to get the current status of a LightScribe drive.
* Note: This requires the LightScribe System Software to be installed.
* @param driveIndex index of drive. Drives are numbered from 0 to driveCount - 1.
* @param rDriveStatus Output parameter: Current status of the drive.
* @return code: LS_SUCCESS or other error codes as per LSPrintAPI.h
**/
enum LSDriveStatus {LS_DRIVE_STATUS_AVAILABLE, LS_DRIVE_STATUS_ERROR,
LS_DRIVE_STATUS_UPDATE, LS_DRIVE_STATUS_BUSY, LS_DRIVE_STATUS_UNKNOWN };
LSPRINTAPI_EXPORT int get_drive_status(const unsigned int driveIndex, LSDriveStatus&
rDriveStatus);
/**************************************************************************************/
/**************************************************************************************/
/** API entry point to get the current print status.
* Note: This requires the LightScribe System Software to be installed.
* @param driveIndex Index of drive. Drives are numbered from 0 to driveCount - 1.
* @param rPrintStatusCode Output parameter: Print status code.
* @param rCurrentCopyNo Output parameter: Number of the current copy being printed.
* @param rTotalNoOfCopies Output parameter: Total number of copies to print.
* @param rPercentComplete Output parameter: Percentage of the print job completed on
the given drive.
* @param rEstimatedTimeRemainingSecs Output parameter: Estimated time remaining in
seconds.
* @param pPrintStatusString Output parameter: Print status string.
* @param printStatusStringSize: Allocated size of the print status array.
/**************************************************************************************/
/** API entry point to request the current print be aborted.
* Note: This requires the LightScribe System Software to be installed.
* Note: The current implementation of this function returns after requesting the
* print be aborted. It does not wait for the abort to complete. The application
* should continue to monitor the print status with "get_print_status()" until
* a canceled status is returned from that function.
* This behavior may change in a future release.
* @param driveIndex index of drive. Drives are numbered from 0 to driveCount - 1.
* @return code: LS_SUCCESS or other error codes as per LSPrintAPI.h
**/
LSPRINTAPI_EXPORT int abort_print(const unsigned int driveIndex);
/**************************************************************************************/
3.2 launch_print_options_dialog
Definition:
int launch_print_options_dialog(const wchar_t* pOptions);
Input Parameter(s):
The pOptions argument is a C string with classic command line style parameters. Each
option has a long version and a short version. The long versions are preceded with a
double dash, “--", and the short versions by a single dash, “-“. Some options require a
value, while others have no associated value but are parsed for their presence or non-
presence only.
version – Using this (optional) option will display a dialog with the version number of the
component. This is intended to be used by developers only; i.e. not in application code.
This parameter has no value associated with it.
help - Using this (optional) parameter will display a dialog with the command parameters
described. This is intended to be used by developers only. ; i.e. not in application code.
This parameter has no value associated with it.
deleteImageFile – This (optional) parameter allows the client to either keep or hand-off
ownership of the source image file. This is useful for the case where a temporary bmp file
was created by the application for passing the LightScribe Print Component. In this case,
the LightScribe Print Component would know it should delete the source file and prevent
needlessly wasting storage space with the temporary file.
When using "-d 0" it is important that the application does not delete the file from
underneath the printing component. Hence, the recommended approach is for the
application to use "-d 1" as a command line argument. This will transfer ownership of the
file to the printing component, which will delete it when it is finished. In combination
with “-d 1”, it is recommended that the bitmap file passed in be a uniquely named file
stored in the user’s temp folder (usually C:\Documents and Settings\<user
name>\Local Settings\Temp). This is demonstrated in the ImageBurner2 sample code
function CBitmapView::OnLightScribePrint().
This parameter has a boolean value associated with it. The default value is 0.
filename – This (required) parameter is used to specify the filename of the source image
that is to be labeled. It should be a full path to the source bitmap.
This parameter has a string value associated with it. There is no default value.
Output Parameter(s):
None
Return Codes:
The return codes for this API are the standard Windows error codes defined in the
Platform SDK file “winerror.h”. Therefore a return code of 0 (ERROR_SUCCESS) is
returned upon a successful function execution.
3.3 launch_printing_dialog
Definition:
int launch_printing_dialog(const wchar_t* pOptions);
Input Parameter(s):
The pOptions argument is a C string with classic command line style parameters. Each
option has a long version and a short version. The long versions are preceded with an
double dash, “--", and the short versions by a single dash, “-“. Some options require a
value, while others have no associated value but are parsed for their presence or non-
presence only.
version – Using this (optional) option will display a dialog with the version number of the
component. This is intended to be used by developers only; i.e. not in application code.
This parameter has no value associated with it.
help - Using this (optional) parameter will display a dialog with the command parameters
described. This is intended to be used by developers only. ; i.e. not in application code.
This parameter has no value associated with it.
deleteImageFile – This (optional) parameter allows the client to either keep or hand-off
ownership of the source image file. This is useful for the case where a temporary bmp file
was created by the application for passing the LightScribe Print Component. In this case,
the LightScribe Print Component would know it should delete the source file and prevent
needlessly wasting storage space with the temporary file.
When using "-d 0" it is important that the application does not delete the file from
underneath the printing component. Hence, the recommended approach is for the
application to use "-d 1" as a command line argument. This will transfer ownership of the
file to the printing component, which will delete it when it is finished. In combination
with “-d 1”, it is recommended that the bitmap file passed in should be a uniquely
named file stored in the user’s temp folder (usually C:\Documents and Settings\<user
name>\Local Settings\Temp). This is demonstrated in the ImageBurner2 sample code
function -CBitmapView::OnLightScribePrint().
This parameter has a boolean value associated with it. The default value is 0.
filename – This (required) parameter is used to specify the filename of the source image
that is to be labeled. It should be a full path to the source bitmap. It is recommended that
the bitmap file passed in should be a uniquely named file stored in the user’s temp
Document Number: PWSDK Revision: 3, Date:12/10/2008
Page 16 of 23
LightScribe Public Windows Software Development Kit (SDK)
index – This (required) parameter is used to select drive to print on. It is a zero-based
logical LightScribe drive number. The numbers are assigned in alphabetical order of the
drive letter. i.e. if there are 3 LightScribe enabled drives with drive letters ‘E’, ‘G’ & ‘K’,
they would have indexes 0, 1 & 2 respectively.
This parameter has an unsigned integer value associated with it. The default value is 0.
name – This (required) parameter specifies the drive name. It is used only as a display
string in the GUI, not as the drive selection.
This parameter has a string value associated with it. There is no default value.
quality – This (required) parameter specifies the contrast level setting to use in this print.
This parameter has a string value associated with it. The default value is “best”. Other
possible values are “normal” and “draft”.
path – This (required) parameter specifies the path of the selected logical LightScribe
drive. On Windows should be a drive letter better ‘A’ to ‘Z’. The drive path must match
the actual path of the selected logical LightScribe drive. i.e. if there are 3 LightScribe
enabled drives, ‘E’, ‘F’ & ‘K’, they are normally drive indexes 0, 1 & 2 respectively. So,
in this case, using the parameters “--index 0 --path E” would be correct; whereas “--index
1 --path E” would be an incorrect combination and generate an error.
This parameter has a string value associated with it. There is no default value.
copies – This (optional) parameter specifies how many copies of a disc to print.
This parameter has an unsigned integer value associated with it. The default value is 1.
targetfile – This (optional) parameter can be used to specify an output file for the
LightScribe System Software to create. Using this parameter will invoke a “print to file”
mode. This is currently for test purposes only.
This parameter has a string value associated with it. There is no default value.
media – This (optional) parameter specifies whether media is known to be in the tray
already. If this value is 0, then the tray will be ejected and the user will be prompted to
insert media (even if there actually is LightScribe media loaded). If the value is 1, the
software will attempt to print to the drive (closing the tray if necessary).
This parameter has a boolean value associated with it. The default value is 1.
autoClose – This (optional) parameter specifies that the printing dialog shall
automatically close without user interaction. The default value is 0.
noShow – This (optional) parameter specifies that the printing dialog shall operate in the
background (minimized). Any pop-up dialogs will be presented unless suppressed with
the noOperator option. The default value is 0.
autoEject – This (optional) parameter specifies that the tray should be opened when the
print completes. If set to false (“0”) the tray will remain closed when the print completes.
The default value is true (“1”).
useGeneric – This (optional) parameter specifies that generic printing values should be
used if optimal printing values are not supported. If optimal printing values are not
supported for the target drive the printing dialog will, by default, prompt the user to
choose to use either generic printing or update the system software. This parameter can
be used to prevent the prompt and inform the printing dialog to use generic printing
values in this situation. Printing will continue without prompting the user. The default
value is false (“0”).
Output Parameter(s):
None
Return Codes:
The return codes for this API are the standard Windows error codes defined in the
Platform SDK file “winerror.h”. Therefore a return code of 0 (ERROR_SUCCESS) is
returned upon a successful function execution.
3.4 have_lightscribe_drive
Definition:
int have_lightscribe_drive(bool &rHaveDrive);
Input Parameter(s):
None
Output Parameter(s):
rHaveDrive – This parameter returns the value true if there is a LightScribe drive on the
system and false otherwise.
Return Codes:
This function returns a LightScribe Error Code as described in LSPrintAPI.h. On success,
the function returns LS_SUCCESS.
3.5 get_drive_count
Definition:
int get_drive_count(unsigned int &rDriveCount)
Input Parameter(s):
None
Output Parameter(s):
rDriveCount – The number of LightScribe drives in the system. The LightScribe drives
are numbered from 0 to driveCount -1.
Return Codes:
This function returns a LightScribe Error Code as described in LSPrintAPI.h. On success,
the function returns LS_SUCCESS.
3.6 get_drive_path
Definition:
int get_drive_path(const unsigned int driveIndex, wchar_t *pDrivePath,
const unsigned int drivePathSize)
Input Parameter(s):
driveIndex – The index number of a LightScribe drive. LightScribe drives are numbered
from 0 to driveCount – 1.
Output Parameter(s):
pDrivePath – The path name of the LightScribe drive with the given index number. The
path name is assigned by the operating system.
Return Codes:
This function returns a LightScribe Error Code as described in LSPrintAPI.h. On success,
the function returns LS_SUCCESS.
3.7 get_drive_display_name
Definition:
int get_drive_display_name(const unsigned int driveIndex, wchar_t
*pDriveDisplayName, const unsigned int displayNameSize)
Input Parameter(s):
driveIndex – The index number of a LightScribe drive. LightScribe drives are numbered
from 0 to driveCount – 1.
Output Parameter(s):
pDriveDisplayName – The display name of the LightScribe drive with the given index
number.
Return Codes:
This function returns a LightScribe Error Code as described in LSPrintAPI.h. On success,
the function returns LS_SUCCESS.
3.8 get_drive_status
Definition:
enum LSDriveStatus {LS_DRIVE_STATUS_AVAILABLE, LS_DRIVE_STATUS_ERROR,
LS_DRIVE_STATUS_UPDATE, LS_DRIVE_STATUS_BUSY, LS_DRIVE_STATUS_UNKNOWN
};
Input Parameter(s):
driveIndex – The index number of a LightScribe drive. LightScribe drives are numbered
from 0 to driveCount – 1.
Output Parameter(s):
rDriveStatus – One of the LSDriveStatus enumerated values.
Return Codes:
This function returns a LightScribe Error Code as described in LSPrintAPI.h. On success,
the function returns LS_SUCCESS.
3.9 get_print_status
Definition:
enum LSPrintStatusCode {LS_PRINT_STATUS_UNAVAILABLE,
LS_PRINT_STATUS_STARTING, LS_PRINT_STATUS_PREPARING,
LS_PRINT_STATUS_DETECTING, LS_PRINT_STATUS_DRIVE_START_UP,
LS_PRINT_STATUS_PRINTING, LS_PRINT_STATUS_COMPLETE,
LS_PRINT_STATUS_CANCELED, LS_PRINT_STATUS_CANCELING,
LS_PRINT_STATUS_GENERIC_ERROR };
Input Parameter(s):
driveIndex – The index number of a LightScribe drive. LightScribe drives are numbered
from 0 to driveCount – 1.
Output Parameter(s):
rPrintStatusCode – One of the enumerated values from LSPrintStatusCode.h. This
describes the current status of the print.
Return Codes:
This function returns a LightScribe Error Code as described in LSPrintAPI.h. On success,
the function returns LS_SUCCESS.
3.10 abort_print
Note:
The current implementation of this function returns after requesting the print be aborted.
It does not wait for the abort to complete. The application should continue to monitor the
print status with “get_print_status()" until a canceled status is returned from that function.
This behavior may change in a future release.
Definition:
int abort_print(const unsigned int driveIndex)
Input Parameter(s):
driveIndex – The index number of a LightScribe drive. LightScribe drives are numbered
from 0 to driveCount – 1.
Output Parameter(s):
None.
Return Codes:
This function returns a LightScribe Error Code as described in LSPrintAPI.h. On success,
the function returns LS_SUCCESS.