Home

Printing Utilities
  SmartPhonePrint
  PrintPocketCE
  PIEprint
  PocketPixPrint
  PocketShot
 
PocketClipPrint
   + + + + +

Software Developers
  PrinterCE SDK
 
PrinterCE.NetCF SDK
  PocketHTMLprint SDK

Special Topics
  Supported Printers
  Bluetooth Printing
  Network Printing

Arcade Games
  SockOut
  MazeCraze

Contact Info

PocketHTMLprint_NetCF SDK v1.2.5.5
Add fully formatted HTML printing to your .NetCF apps using C# and VB.Net
Supports VS2008, VS2005, VS2003, Compact Framework 3.x, 2.x, 1.x
Version 1.2.5.5 Available  See What's New

PocketHTMLprint_NetCF SDK provides a set of HTML printing-related functions that allows .NetCF developers using C# and VB.Net to easily add fully formatted printing of HTML files to Windows Mobile Pocket PC and CE.Net ARM/XScale apps.  Note: For eVC (C/C++/MFC) apps: PocketHTMLprint SDK

Purchase PocketHTMLprint_NetCF SDK
To Purchase: Follow "Download and Installation Instructions" below to evaluate PocketHTMLprint_NetCF SDK free for 30 days. When you purchase at the "Buy Now" link, you will receive a Developer's License Key that is used with the HTMLpr contructor (see documentation below) to permanently unlock the evaluation mode for purchased installations
10 Installations - $149.50 25 Installations - $311.25 100 Installations - $945.00
If you need a different number of installations (minimum 10),
p
lease contact sales@fieldsoftware.com
bullet

PocketHTMLprint_NetCF SDK is for software developers.

bullet

Minimum package available is $149.50 (USD) for up to 10 installations.

bullet

License Keys for PocketHTMLprint_NetCF SDK and PocketHTMLprint SDK are interchangeable - your purchased Developer's License for one will work on the other.

bullet

For quotes on larger volumes, info for purchase orders, or other questions email sales@fieldsoftware.com.

bullet

Read PocketHTMLprint License Agreement

bullet

PocketHTMLprint SDK Limitations:
a. Supports Pocket PC and CE.Net ARM/XScale devices only.
b. D
oes NOT support the following tag categories:
    - Script tags (ie. Java Script)
    - CSS (Cascading Style Sheet)
    - Link, inclusion, style and form tags.

 

Download and Installation of PocketHTMLprint_NetCF SDK
Supporting Pocket PC and CE.Net ARM/XScale devices only
Evaluate the full functionality of PocketHTMLprint.NetCF SDK free for 30-days.
The zipped download files contain 3 dlls: PocketHTMLprint_NetCF.dll, PocketHTMLprint.dll & PrintDC.dll
Pocket PC: WM6 Classic & Pro, WM5 and 2003
Pocket PC 2002

PPC 2000:    ARM     MIPS    SH3
Download for CE.Net 5.x:    ARMV4/XScale
Download for CE.Net 4.x:    ARMV4/XScale      ARMV4I      ARMV4T

C# - Installing and getting started (VB.Net is below):

  1. Download and unzip the file for your device at the download links above.

  2. Copy the three files to your app's folder on your device.

  3. Start Microsoft's Visual Studio .Net

  4. Open/Create your C# "Smart Device" enabled application.

  5. In Solution Explorer for your app, right click References and "Add Reference".

  6. In "Add Reference" dialog, click Browse. Navigate to PocketHTMLprint_NetCF.dll. Select and click Open.

  7. You should now see this added to the "Selected Components" list in the "Add Reference" dialog. Click OK to add the reference. If you see a message box starting "The reference PocketHTMLprint_NetCF.dll may or may not be valid for the active platform...", click OK and continue.

  8. In the "Using" namespace section at the start of your app's code, add:
     
    using FieldSoftware.PocketHTMLprint_NetCF;

  9. Add your PocketHTMLprint_NetCF related code.

The C# example code below prints out an HTML file stored on the device.

private void PrintHtmlTest_Click(object sender, System.EventArgs e)
{

  HTMLpr hpr = new HTMLpr("YourLicenseKey");
//No License Key for evaluation
  //Let user select print options and printer settings
  hpr.SetupAll(HTMLpr.USER_SELECT.ALL_OPTIONS);
  hpr.SendFile(@"\My Documents\HTML\PocketHTMLprint.htm");
  hpr.Close();
  HTMLpr.STATUS status=hpr.GetStatus;
  if (status!=HTMLpr.STATUS.errNoError)
  {
    //User pressed Cancel or print error...
    //Handle if your code needs to know.
  }
}
 

VB.Net  - Installing and getting started (C# is above):

  1. Download and unzip the file for your device at the download links above.

  2. Copy the three files to your app's folder on your device.

  3. Start Microsoft's Visual Studio .Net

  4. Open/Create your VB.Net "Smart Device" enabled application.

  5. In Solution Explorer for your app, right click References and "Add Reference".

  6. In "Add Reference" dialog, click Browse. Navigate to PocketHTMLprint_NetCF.dll. Select and click Open.

  7. You should now see this added to the "Selected Components" list in the "Add Reference" dialog. Click OK to add the reference. If you see a message box starting "The reference PocketHTMLprint_NetCF.dll may or may not be valid for the active platform...", click OK and continue.

  8. In the "Imports" namespace section at the start of your app's code, add:
     
    Imports FieldSoftware.PocketHTMLprint_NetCF

  9. Add your PocketHTMLprint_NetCF related code.

The VB.Net example code below prints out an HTML file stored on the device.

  Dim hpr As HTMLpr
  hpr = New HTMLpr("YourLicenseKey") 'No License Key for evaluation
  'Let user select print options and printer settings
  hpr.SetupAll(HTMLpr.USER_SELECT.ALL_OPTIONS)
  hpr.SendFile("\My Documents\HTML\PocketHTMLprint.htm")
  hpr.Close()
  Dim status As HTMLpr.STATUS
  status = hpr.GetStatus
  If (status <> HTMLpr.STATUS.errNoError) Then
    'User pressed Cancel or print error...
    'Handle if your code needs to know.
  End If

 

New: PrintJob() - the new PrintJob method allows for printing more than one HTML file or site using one instance of HTMLpr. See description for PrintJob() below for full details - here is a PrintJob code example:

//Define global instance of HTMLpr
HTMLpr glob_hpr=null;

private void PrintHTML_Click(object sender, System.EventArgs e)
{
  //If this is first time through, create instance of HTMLpr
  if (glob_hpr==null)
  {
    glob_hpr = new HTMLpr("YourLicenseKey");
//No License Key for evaluation
  }
  glob_hpr.SetupAll(HTMLpr.USER_SELECT.ALL_OPTIONS);
  glob_hpr.SendFile(@"\My Documents\HTML\first.html");
  glob_hpr.PrintJob(true); //Print job, leave printer connection open
  glob_hpr.SendFile(@"\My Documents\HTML\second.htm");
  glob_hpr.PrintJob(false); //Print second job, close printer connection
}

 

PocketHTMLprint_NetCF SDK
Commands & Properties

HTMLpr Constructors: (PocketHTMLprint_NetCF class is shortened to HTMLpr for convenience!!)

Create an instance of HTMLpr (PocketHTMLprint_NetCF) using one of the following overloaded versions:

Syntax: (2 overloaded versions):
  public HTMLpr();
  public
HTMLpr(string initstr);

Parameter: initstr- Developer's License Key (received by email after purchase) used to unlock HTMLpr. Default is to run in evaluation mode. After evaluation time limit has expired on a device, HTMLpr will display an error dialog and not function.

Example:
HTMLpr hpr = new HTMLpr("YOURLICENSEKEY");  //No License Key for evaluation

 

HTMLpr Methods and Properties
Note: PocketHTMLprint_NetCF class is shortened to HTMLpr for convenience

Cancel - Cancels the current print job and frees all resources used by PocketHTMLprint.

Syntax: void Cancel();

CancelJob - Cancels the current print job without printing. Like PrintJob(), leaves the instance of HTMLpr alive and ready to receive another print job.

Syntax: void CancelJob(bool KeepPrinterConnection);

Parameter: KeepPrinterConnection - If true, keeps the current printer connection open after canceling the print job. If false, closes the printer connection.

Close - Prints the previously specified HTML page and frees all resources used by PocketHTMLprint. If an error condition has previously been found or set (nHTML_AbortPr != errNoError) no printing will occur, but all resources will be freed.

Syntax: bool Close();

Returns:
true if successful, false otherwise. Check ErrVal property for more info on errors (see below)

GetStatus: Property - Get error condition:

Example:
HTMLpr.
STATUS err = hpr.GetStatus;

STATUS Enumeration

Description

errNoError

No error

errUserCancel

User cancelled print job

errAbortOperation

Error aborted the last print operation (but the print job is still viable).

errAbortPrint

Error aborted the print job

GetVersion - Property Returns current version number of PocketHTMLprint

Syntax: int vsn = hpr.GetVersion;

Returns: Integer representation of version number = (Major * 1000) + Minor. For example: version 1.3 would return value of 1300.

PrintJob - Prints the current job and leaves the instance of PocketHTMLprint ready to receive another HTML print job. To close the instance of HTMLpr after the print job, use HTMLpr_Close() instead).

Syntax: bool PrintJob(bool KeepPrinterConnection);

Parameter: KeepPrinterConnection - If true, keeps the current printer connection open after canceling the print job. If false, closes the printer connection.

Returns: true if successful, false otherwise. Check ErrVal property for more info on error (see below)

SendFile
- Print HTML file - can either be local file or Internet-based URL to HTML web page that will be downloaded and printed.

Syntax: bool SendFile(string pfilename);

Parameter: pfilename - Filename (with path if local file, or full URL if remote web page). For example, local file might look like:
  
"file://\\My%20Documents\\HTML\\testing1.htm"
 while a remote URL might look like:
   "http://www.fieldsoftware.com/PrintPocketCE.htm"

Returns: true if successful, false otherwise. Check ErrVal property for more info on error (see below)

SendStr - Adds HTML string to current print job. This method can be called multiple times to send strings of HTML code until the HTML page has been fully sent. Close() must be called to print the final HTML page.

Syntax: 2 overloaded versions
bool
SendAsciiStr(string pstr);
bool
SendAsciiStr(string pstr, int scnt);

Parameters:

pstr -
HTML text string
scnt - count of characters to print in string (if omitted or <= 0, entire string will be used 

Returns: true if successful, false otherwise. Check ErrVal property for more info on error (see below)

SetupAll - Do initial setup and prep, including optionally allowing user to select HTML printing options and printer settings.

Syntax: bool SetupAll(USER_SELECT whichoptions);

Parameter:
whichoptions - Selects which optional user settings will be used:

USER_SELECT Enumeration

Description

ALL_OPTIONS

Show both HTML print options and Select Printer options dialogs

HTML_PRINT_OPTIONS

Display HTML print options dialog only

SELECT_PRINTER_OPTIONS

Display Select Printer dialog only

NO_OPTIONS

Skip both HTML printing options and Select Printer options dialogs

Note that if user presses "Quick Print" on "HTML printing options" dialog, the Printer Selection dialog will be skipped, even if HTML_AllOptions is used.

Returns: true if successful, false otherwise. Check ErrVal property for more info on error (see below).

Notes:
#1:
HTML print options can be programmatically set using SetupHTMLOptions.
#2: Select Printer options can be programmatically set - see "Programmatically Selecting Printer and Paper Types" section below.

SetupHTMLOptions - Programmatically set HTML print options (allows skipping HTML Options dialog).

Syntax:  
void SetupHTMLOptions(PRINTSIZE sizing,int CustomSize,PAGERANGE range,int PgFrom,
 
int PgTo,int Copies,bool PrintHeader,bool ReduceTextSize)


Parameters:
sizing
- Select one of 3 size options:

PRINTSIZE Enumeration

Description

NORMAL 

Print HTML page as defined

SHRINKTOFIT  

Shrink HTML width to fit in current page

CUSTOM 

Shrink/enlarge HTML page "CustomSize" percentage

CustomSize - If "PrintSizing" is set to PRINTSIZE_CUSTOM, CustomSize is percentage to shrink/enlarge the printed HTML page. Valid range is 25% to 250%.

range - Select one of two page range options:

PAGERANGE Enumeration

Description

ALL

Print all pages

PAGES

Print pages from "PgFrom" to "PgTo"

PgFrom - starting page to print if PrintRange set to PAGERANGE_PAGES

PgTo - last page to print if PrintRange set to PAGERANGE_PAGES

Copies - Number of copies of HTML document to print

PrintHeader - If true, prints header containing HTML page title and page number, plus footer containing URL address and date/time of print job. 

ReduceTextSize - If true reduces all text sizes by about 1/4

 

Programmatically Selecting Printer and Paper Types

Most programs that use PocketHTMLprint will want to allow the user to select the printer, connection type (ie. Infrared, Bluetooth, network, serial) as well as paper type. However, some applications need to programmatically set the printer and paper settings in order to restrict users to one specific printer, connection and paper combination. The methods detailed below can be used to set printer and paper values programmatically.

Here is an example of code that programmatically sets HTML print options and printer settings. SetScaleMode() is used to set scale mode of measurement values for SetupPaper to inches, centimeters, etc (see ScaleMode method in PrinterCE SDK documentation).

//Set HTML print options and Printer settings
hpr.SetupHTMLOptions(PRINTSIZE_SHRINKTOFIT,0,PAGERANGE_ALL,0,0,1,true,true);
hpr.SetupNetPath(@"\\FieldSoft\HP995c");
hpr.SetupPrinter(PR_HP_PCL, PORT_NETPATH, S_DONTCARE);
hpr.SetScaleMode(HTMLpr.MEASUREMENT_UNITS.INCHES);
hpr.
SetupPaper(vbLetter, vbPortrait, 0, 0, 0.5, 0.5, 0.5, 0.5);
hpr.SetupPrinterOther(FFEED_NORMAL,1.0,DENSITY_NORMAL,SOFTWARE_HANDSHAKE,BITFLAG_COLOR,
           COMPRESSED_ON,DITHER_ON,DRAFTMODE_OFF);
//Now, setup HTMLpr but do not pop up HTML options or Select Printer dialog
hpr.SetupAll(
NO_OPTIONS);

SetupNetIPPrinter

Set IP address and port for networked print server. SetupNetIPPrinter must be called before calling SetupPrinter().

Syntax: void SetupNetIPPrinter(string netstr,int port,bool OpenPort);

Parameters

netstr - IP address string
port - IP port value
OpenPort - true if want to establish communication link immediately

Example: prce.SetupNetIPPrinter("192.168.0.234",9101,false);

SetupNetSharedPrinter

Set IP address and port for networked print server. SetupNetIPPrinter must be called before calling SetupPrinter().  SetupNetSharedPrinter must be called before calling SetupPrinter().

Syntax: void SetupNetSharedPrinter(string netstr,bool OpenPort);

Parameters

netstr - Network path string to shared printer.
OpenPort - true if want to establish communication link immediately

Example: prce.SetupNetSharedPrinter("\\\\FieldSoft\\HP995c",true);
This establishes connection to printer "HP995c" on networked PC "FieldSoft".

SetupPrinter

Programmatically set the printer and port settings. (See also SetupAllPrinterSettings).

Syntax: 2 overloaded versions
void SetupPrinter(PRINTER Printer,PORT Port,bool OpenPort);
void
SetupPrinter(PRINTER Printer,PORT Port,PORT_SPEED Baudrate,bool OpenPort);

Parameters

Printer - One of the following PRINTER selections:

PRINTER Enumeration

Description

USE_CURRENT

Use most recently saved printer from registry.

ABLE_AP1300 Able Systems Ap1300
AXIOHM_A631 Axiohm A631
BROTHER Brother MPrint

CANONBJ360

Canon BubbleJet compatible printers (360 dpi)

CANONBJ600 Canon PIXMA iP90, i80, i70
CANONBJ300 Canon BubbleJet 300 dpi

CITIZEN_203

Citizen 203DPI printers

CITIZEN_CMP10

Citizen CMP-10

CITIZEN_PD22

Citizen PD-22

CITIZEN_PD04

Citizen PD-04, PD-24

CITIZEN_PN60

Citizen PN60i

ELTRADE

Eltrade Mobilife

EPSON_ESCP2

Epson ESC/P 2 compatible printers

EPSON_STYLUS

Epson Stylus compatible printers

EPSON_TM_P60

Epson TM-P60

EXTECH_2

Extech 2" Thermal

EXTECH_3

Extech 3" Thermal

EXTECH_4

Extech 4" Thermal

FUJITSU_FTP628

Fujitsu FTP-628WSL110

GEBE_FLASH

GeBE Flash 4" Thermal

GENERIC24_180

Generic Epson compatible 180DPI 24-pin printers (LQ/ESC)

GENERIC24_360

Generic Epson compatible 360DPI 24-pin printers (LQ/ESC)

GENERIC24_203

Generic Epson compatible 203DPI 24-pin printers (LQ/ESC)

HP_PCL

HP PCL compatible - includes DeskJet and LaserJet

INTERMEC

Intermec PB/PW/68/78 Thermal

IPC_PP50

IPC PP-50

IPC_PP55

IPC PP-55

OMNIPRINT

OMNIPrint 6240 and 6400

ONEIL

O'Neil MicroFlash

PANASONIC_JTH200PR

Panasonic JTH200PR

PENTAX_200

Pentax PocketJet 3 and PocketJet 200

PENTAX_300

Pentax PocketJet 3 Plus and PocketJet II

PENTAX_RUGGEDJET

Pentax RuggedJet 3 and RuggedJet 4

PERIPHERON_NOMAD

Peripheron Nomad

POCKET_SPECTRUM

Pocket Spectrum

S_PRINT

CUSTOM s'print

SATO

SATO MB200i

SEIKO3445

Seiko DPU-3445

SEIKO_L465

Seiko DPU-L465

TALLY_MIP360

TallyGenicom MIP360 rugged 24-pin dot matrix printer

TALLY_MTP4

TallyGenicom MTP4 4" thermal printers

ZEBRA Zebra Cameo, Encore and QL

SIPIX

SiPix A6 printer

DYMOCOSTAR

DymoCoStar label printers

SEIKOLABELWRITER

Seiko LabelWriter printers

Port - One of the following PORT selections:  

PORT Enumeration

Description

USE_CURRENT

Use most recently saved port from registry.

INFRARED

Infrared port

NETPATH

Print to shared printer on a networked host PC

NETIP

Print to network IP printer - a printer with its own IP address

COMPAQ_BT

HP/Compaq Bluetooth iPAQ or sleeve

IPAQ_BT

HP/Compaq Bluetooth iPAQ or sleeve

SOCKETCOM_BT

Socket Bluetooth card support

WIDCOMM_BT Device using WIDCOMM Bluetooth stack

COM1

Com1: serial port

COM2

Com2: serial port

COM3

Com3: serial port

COM4

Com4: serial port

COM5

Com5: serial port

COM6

Com6: serial port

COM7

Com7: serial port

COM8

Com8: serial port

COM9 Com9: serial port

TOFILE

Print to file "\OUTPUT.PRN"

LPT

LPT: parallel port

BTQUIKPRINT

Special for WIDCOMM, HP iPAQ Bluetooth devices that pop up "Bluetooth Browser" to find/select BT printer at print time: using this flag bypasses the BT browser and uses most recent selected BT printer. To let user discover and select BT printer, use COMPAQ_BT, IPAQ_BT, WIDCOMM_BT