PDA

View Full Version : Printing To Label Printer



azinyama
21 Sep 2012, 9:49 AM
Good day all!!!

I have an application that I'm developing that would at some point require a label to be printed from on of the windows.
The printer is a 'Brother QL-700' label printer which comes with the SDK. I am able to use ActiveX to print from internet explorer but, unfortunately ActiveX does not work with any of the other browsers, i.e. FireFox, Opera, etc. Is there a way of printing to this label printer using ExtJS to create the printer object in JavaScript. Sample of what is done when using internet explorer is below:



<title>b-PAC 3.0 Javascript Sample</title>
<script language="javascript" type="text/javascript">
<!--
var DATA_FOLDER = "C:\\Program Files\\Brother bPAC3 SDK\\Templates\\";
//------------------------------------------------------------------------------
// Function name : DoPrint
// Description : Print, Preview Module
//------------------------------------------------------------------------------
function DoPrint(strExport)
{
var theForm = document.getElementById("myForm");
var nItem = theForm.cmbTemplate.selectedIndex;
var strPath = DATA_FOLDER + theForm.cmbTemplate.options[nItem].value;
console.log(strPath);


//var objDoc = new ActiveXObject("bpac.Document");


var objDoc = {};

if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
objDoc=new XMLHttpRequest();
}
else
{ // code for IE6, IE5
objDoc=new ActiveXObject("bpac.Document");
}

objDoc.open("GET",this.url,false); // make a synchronous request
objDoc.send(null);




console.log(objDoc);
if(objDoc.Open(strPath) != false)
{
objDoc.GetObject("objCompany").Text = theForm.txtCompany.value;
objDoc.GetObject("objName").Text = theForm.txtName.value;
theForm.txtWidth.value = objDoc.Width;
//console.log(theForm.txtCompany.value);
//console.log(theForm.txtCompany.value);
if(strExport == "")
{
//objDoc.SetMediaByName(objDoc.Printer.GetMediaName(), true);
objDoc.StartPrint("", 0);
objDoc.PrintOut(1, 0);
objDoc.Close();
objDoc.EndPrint();
}
else
{
strExport = DATA_FOLDER + strExport;
objDoc.Export(4, strExport, 180);
objDoc.Close();
window.location.href = strExport;
}
}
}
-->
</script>

scottmartin
21 Sep 2012, 1:51 PM
Would this help?
http://jsprintsetup.mozdev.org/

Scott.

metalinspired
22 Sep 2012, 5:24 AM
If you're using PHP as back-end you can generate PDF with labels that need to be printed.

scottmartin
22 Sep 2012, 8:53 AM
In the case of printing PDF from server ... you use iText (Java), or TCPDF (PHP)

Also there is:
http://sourceforge.net/projects/html2fpdf/

Scott.

azinyama
26 Sep 2012, 11:12 PM
Unfurtunately I'm using ASP.Net as my backend. Any other suggestions???

metalinspired
26 Sep 2012, 11:46 PM
Maybe PDFsharp (http://sourceforge.net/projects/pdfsharp/)?
Never used ASP so I can't really help you in any way.
Sorry.