please implement a simple web service, which takes a post request, then print the label xml in the request body. I think this can be done through the web proxy in the web api.
this will open up the label printing for any web client, and also make it very simple to implement label printing on the client side.
You will have to install the Proxy service first. It is a part of the beta version of DLS. See Web SDK post for more information. I have no sample unfortunately. To print a label you should POST to the ‘printLabel’ uri. the request body/payload is a JSON string of js object with following fields
jobId – unique id for the job. The SDK itself uses uuids for the ids, but it can be any unique string.
printerName – a printer name to print on. Should be the name of the printer as visible to Windows, in other words the same as displayed in Printers folder
labelXml – label xml definition
printParamsXml – printing parameters xml, like number of copies, etc.
labelSetXml – data to print multiple labels
printParamsXml and labelSetXml can be empty strings if not needed.
Just curios, what is language/environment for your client application?
The uri seems to be the right one. Try http://localhost:8631/getPrinters in the browser. If the service is running you should get a list of installed printers. To check that the service is running, check
‘DYMO Label Proxy Service’ service status in ‘Computer Management’/Services. Do you have a firewall? The installer should open the port for Windows Firewall. If you have a different firewall software you will have to do it manually. Even for Windows Firewall, try to disable it. If it helps, try to modify the rules manually to open the port.
I tried http://localhost:8631/getPrinters, and it returned, so the proxy service is running fine. I think the problem is the json string I passed over to the proxy service.
I tried to use Http Resource Test (a Firefox add on) to directly post following json string to http://localhost:8631/printLabel, and could not get a connection.
I still think make the request as json string in post body is a better option for this web service. maybe this something you can implement in the future.
now I got the label printed, I ran into another problem.
I want to use LabelSetXml to pass some data to the label printer, but the label won’t print, if I set LabelSetXml to empty string, the label prints fine.
here is my labelSetXml
IL2011061118 Orange pomace, test 11, 1:1 pomace to water ratio, 3 min grind, freeze-dried Fiber, Insoluble Dietary Fiber Fiber, Soluble Dietary Fiber
basically I want to use labelSetXml to pass multiple values to the label printer, do you have an example, or point me to documents on format for labelSetXml.
by the way, does Dymo has a developer support forum? it will be a lot easier to communicate that way.
Hi
please implement a simple web service, which takes a post request, then print the label xml in the request body. I think this can be done through the web proxy in the web api.
this will open up the label printing for any web client, and also make it very simple to implement label printing on the client side.
Thanks
Dong
Yes, you can print a label this way by using the Proxy service
Hi Vladimir
can you provide or point me to some examples on how to do this? I assume I need to install the beta web api.
Thanks
Dong
You will have to install the Proxy service first. It is a part of the beta version of DLS. See Web SDK post for more information. I have no sample unfortunately. To print a label you should POST to the ‘printLabel’ uri. the request body/payload is a JSON string of js object with following fields
{
‘jobId’: jobId,
‘printerName’: printerName,
‘labelXml’: labelXml,
‘printParamsXml’: printParamsXml,
‘labelSetXml’: labelSetXml
}
where
jobId – unique id for the job. The SDK itself uses uuids for the ids, but it can be any unique string.
printerName – a printer name to print on. Should be the name of the printer as visible to Windows, in other words the same as displayed in Printers folder
labelXml – label xml definition
printParamsXml – printing parameters xml, like number of copies, etc.
labelSetXml – data to print multiple labels
printParamsXml and labelSetXml can be empty strings if not needed.
Just curios, what is language/environment for your client application?
Thanks,
Vladimir
Hi Vladimir
this is great! I am going to call this web service from a Ruby script.
Thanks
Dong
Hi Vladimir
I am running some problems.
I installed the beta web SDK, verified the proxy service is running.
but, when I posted request to http://localhost:8631/printLabel, I could not get a connection.
Did I miss any steps? is that the right url send post to? anyway to check the proxy service is running properly?
Thanks
Dong
Hi Dong,
The uri seems to be the right one. Try http://localhost:8631/getPrinters in the browser. If the service is running you should get a list of installed printers. To check that the service is running, check
‘DYMO Label Proxy Service’ service status in ‘Computer Management’/Services. Do you have a firewall? The installer should open the port for Windows Firewall. If you have a different firewall software you will have to do it manually. Even for Windows Firewall, try to disable it. If it helps, try to modify the rules manually to open the port.
Vladimir
Hi Vladimir
I tried http://localhost:8631/getPrinters, and it returned, so the proxy service is running fine. I think the problem is the json string I passed over to the proxy service.
I tried to use Http Resource Test (a Firefox add on) to directly post following json string to http://localhost:8631/printLabel, and could not get a connection.
{“jobId”:”b032544cd507″,”printerName”:”DYMO LabelWriter 400 Turbo”,”labelXml”:”nntLandscapentLargeShippingnt30256 ShippingntnttntntnttntttTEXTntttntttntttntttRotation0ntttFalsentttFalsentttLeftntttTopntttShrinkToFitntttTruentttFalsentttnttttnttttthellontttttnttttttnttttttntttttnttttntttnttnttntnn”,”printParamsXml”:””,”labelSetXml”:””}
I don’t know if you can spot a problem with this json string.
Do you have an example of json string I can try?
Thanks
Dong
that json string did not come up right in my last message, the xml tags are stripped away by this site.
anyway, if you can provide an example of json string, I will try to figure out what is wrong with mine.
Thanks
Dong
I am terrible sorry. The data in the POST is not in json, it is an url-encoded form data with the same fields as in json. For example,
jobId=3FE647EE-9415-4D47-BDC4-A84084D977E5&printerName=DYMO+LabelWriter+450+Turbo&labelXml=%3C%3Fxml+version%3D%221.0%22+encoding%3D%22UTF-8%22%3F%3E%0D%0A%3CDieCutLabel+Version%3D%228.0%22+Units%3D%22twips%22%3E%0D%0A++++%3CPaperOrientation%3ELandscape%3C%2FPaperOrientation%3E%0D%0A++++%3CId%3EAddress%3C%2FId%3E%0D%0A++++%3CPaperName%3E30252+Address%3C%2FPaperName%3E%0D%0A++++%3CDrawCommands%3E%0D%0A++++++++%3CRoundRectangle+X%3D%220%22+Y%3D%220%22+Width%3D%221581%22+Height%3D%225040%22+Rx%3D%22270%22+Ry%3D%22270%22%2F%3E%0D%0A++++%3C%2FDrawCommands%3E%0D%0A++++%3CObjectInfo%3E%0D%0A++++++++%3CAddressObject%3E%0D%0A++++++++++++%3CName%3EAddress%3C%2FName%3E%0D%0A++++++++++++%3CForeColor+Alpha%3D%22255%22+Red%3D%220%22+Green%3D%220%22+Blue%3D%220%22%2F%3E%0D%0A++++++++++++%3CBackColor+Alpha%3D%220%22+Red%3D%22255%22+Green%3D%22255%22+Blue%3D%22255%22%2F%3E%0D%0A++++++++++++%3CLinkedObjectName%2F%3E%0D%0A++++++++++++%3CRotation%3ERotation0%3C%2FRotation%3E%0D%0A++++++++++++%3CIsMirrored%3EFalse%3C%2FIsMirrored%3E%0D%0A++++++++++++%3CIsVariable%3ETrue%3C%2FIsVariable%3E%0D%0A++++++++++++%3CHorizontalAlignment%3ELeft%3C%2FHorizontalAlignment%3E%0D%0A++++++++++++%3CVerticalAlignment%3EMiddle%3C%2FVerticalAlignment%3E%0D%0A++++++++++++%3CTextFitMode%3EShrinkToFit%3C%2FTextFitMode%3E%0D%0A++++++++++++%3CUseFullFontHeight%3ETrue%3C%2FUseFullFontHeight%3E%0D%0A++++++++++++%3CVerticalized%3EFalse%3C%2FVerticalized%3E%0D%0A++++++++++++%3CStyledText%2F%3E%0D%0A++++++++++++%3CShowBarcodeFor9DigitZipOnly%3EFalse%3C%2FShowBarcodeFor9DigitZipOnly%3E%0D%0A++++++++++++%3CBarcodePosition%3EBelowAddress%3C%2FBarcodePosition%3E%0D%0A++++++++++++%3CLineFonts%2F%3E%0D%0A++++++++%3C%2FAddressObject%3E%0D%0A++++++++%3CBounds+X%3D%22332%22+Y%3D%22150%22+Width%3D%224455%22+Height%3D%221260%22%2F%3E%0D%0A++++%3C%2FObjectInfo%3E%0D%0A%3C%2FDieCutLabel%3E&printParamsXml=&labelSetXml=%3CLabelSet%3E%3CLabelRecord%3E%3CObjectData+Name%3D%22Address%22%3E123%3C%2FObjectData%3E%3C%2FLabelRecord%3E%3C%2FLabelSet%3E
that is it, my Ruby script prints label fine now.
Thanks
Dong
I still think make the request as json string in post body is a better option for this web service. maybe this something you can implement in the future.
Thanks
Dong
Agreed, will look into it…
Hi Vladimir
now I got the label printed, I ran into another problem.
I want to use LabelSetXml to pass some data to the label printer, but the label won’t print, if I set LabelSetXml to empty string, the label prints fine.
here is my labelSetXml
IL2011061118 Orange pomace, test 11, 1:1 pomace to water ratio, 3 min grind, freeze-dried Fiber, Insoluble Dietary Fiber Fiber, Soluble Dietary Fiber
any ideas why it is not working?
Thanks
Dong
the xml in my last message is messed up.
basically I want to use labelSetXml to pass multiple values to the label printer, do you have an example, or point me to documents on format for labelSetXml.
by the way, does Dymo has a developer support forum? it will be a lot easier to communicate that way.
Thanks
Dong