ZSDK_API
1.4.957
|
This is a utility class for performing file operations on a printer. More...
#import <FileUtil.h>
Instance Methods | |
(BOOL) | - sendFileContents:error: |
Sends the contents of a file to the printer. | |
(NSArray *) | - retrieveFileNames: |
Retrieves the names of the files which are stored on the printer. | |
(NSArray *) | - retrieveFileNamesWithExtensions:error: |
Retrieves the names of the files which are stored on the printer. | |
This is a utility class for performing file operations on a printer.
Send file contents to a printer: @code
#import "TcpPrinterConnection.h" #import <UIKit/UIKit.h> #import "ZebraPrinter.h" #import "ZebraPrinterFactory.h"
TcpPrinterConnection *zebraPrinterConnection = [[TcpPrinterConnection alloc] initWithAddress:"192.168.1.101" andWithPort:6101]; [zebraPrinterConnection open]; NSError *error = nil; id<ZebraPrinter,NSObject> printer = [ZebraPrinterFactory getInstance:zebraPrinterConnection error:&error]; // If SAMPLE.FMT contains a CPCL format, it will be printed
BOOL success = [[printer getFileUtil] sendFileContents:"/Documents/SAMPLE.FMT" error:&error];
if (error != nil || success == NO || printer == nil) { UIAlertView *errorAlert = [[UIAlertView alloc] initWithTitle:"Error" message:[error localizedDescription] delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil]; [errorAlert show]; [errorAlert release]; }
[zebraPrinterConnection close]; [zebraPrinterConnection release];
Get directory listing from a printer:
- (NSArray*) retrieveFileNames: | (NSError **) | error |
Retrieves the names of the files which are stored on the printer.
error | Will be set to the error that occured. |
- (NSArray*) retrieveFileNamesWithExtensions: | (NSArray *) | extensions | |
error: | (NSError **) | error | |
Retrieves the names of the files which are stored on the printer.
This method only returns files which have the extensions in extensions
.
extensions | The extensions to filter on. |
error | Will be set to the error that occured. |
- (BOOL) sendFileContents: | (NSString *) | filePath | |
error: | (NSError **) | error | |
Sends the contents of a file to the printer.
filePath | The full file path (e.g. @"/Documents/sample.txt"). |
error | Will be set to the error that occured. |
NO
if there was an error sending the contents.