PrintDocument

Description

Loads the specified file and sends the content directly to the printer. The file bytes are not rendered in any way, they are sent to the printer for the printer to interpret. In this way, postscript can be sent directly to the printer or label printing commands.

This method is synchronous; it will not return until the file load and print is complete.

Syntax

rawPrinting.printDocument(url)

Parameter Description
url (String) url of the file whose contents are to be sent to the printer. The url must be absolute but may refer to local (file://) resources.

Return Value

none.

Applies To

 

rawPrinting

 

Examples

The following simple but complete example shows how to print a label stored on the web server to a Zebra printer. The sample is assuming that some process has run on the server to generate and store the required label.

<head>

<!-- MeadCo Security Manager - using evaluation license -->
<object viewastext style="display:none"
classid="clsid:5445be81-b796-11d2-b931-002018654e2e"
codebase="smsx.cab#Version=8,0,0,56
">
  <param name="GUID" value="{C4DB5D29-BE52-46B9-9DDF-46A167170F81}
">
  <param name="Path" value="sxlic.mlf">
  <param name="Revision" value="0">
</object>

<!-- MeadCo ScriptX -->
<object id="factory" viewastext style="display:none"
classid="clsid:1663ed61-23eb-11d2-b92f-008048fdd814">
</object>

<script defer>

function printLabel() {
  var p = factory.rawPrinting;

  // select the Zebra printer
  p.printer = "Zebra  LP2844-Z"

  // must give the full url of the file...
  // The printDocument method is synchronous
  p.printDocument(factory.baseURL("label.txt"));

}
</script>


</head>

See Also

printString