Skip to content
This repository has been archived by the owner on Nov 14, 2020. It is now read-only.

liangminhua/PrintBrowser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PrintBrowser

PrintBrowser is a client for printing content in front-end without extra popups. Using Xaml as the print template language makes it easier to print complex content than using the ESC / TSC command.

Feature

getPrinters

Get all printers include virtual printer.

var printers = Internal.getPrinters(); //It is an array containing the name of the printer.

print

Print Xaml template to printer.

  • printerName = string -Should be vaild printer name.
  • template = string - Just use the FlowDocument and its child content. All content will wrap.
var printerName =""; //use Internal.getPrinters method get printers' name.
var template = ' \
<FlowDocument PagePadding="0" \
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> \
    <Paragraph TextAlignment="Center">Print Test</Paragraph> \
</FlowDocument>';
Internal.print(printerName,template);
// If you want to get the error
try{
    Internal.print(printerName,template);
}catch(e)
{
    console.log(e);
}

More information

中文ReadMe