we printing labels, created third party. serve them directly, passing base64 data blank window, user can print himself.
no matter how many ways try it, cannot image display.
here's excerpt of data returned server (in other display, full of � characters):
png ihdr,Â_gbásrgb®Îégama±üa phys88?'õÿ¥idatx^ì½ ÅöÏî÷íþ÷Û½×t$$1`Îy130b@ Âq@%t8äs<d1¢sÆ|õÞëÝ÷_ÏÛsÓÍp}fúlo'ßßÝg'õtwÕtc=ç·ª 3*ub%$×môqÝn!þîmâü«$ÓÍí$×môqÝn!þîmâü«$ÓÍí$×môqÝn!þîmâü«$ÓÍí$×môqÝn!þîmâü«$ÓÍí$×môqÝn!þîmâü«$ÓÍí$×môqÝn!þîmâü«$ÓÍí$×môqÝn!þîmâü«$ÓÍí$×môqÝn!þîmâü«$ÓÍí$×môqÝn!þîmâü«$ÓÍí$×môqÝn!þîmâü«$ÓÍí$×môqÝn!þîmâü«$ÓÍí$×môqÝn!þîmâü«$ÓÍí$×môqÝn!þîmâü«$ÓÍí$×môqÝn!þîmâü«$ÓÍí$×môqÝn!þîmâü«$ÓÍí$×môqÝn!þîmâü«$ÓÍí$×môqÝn!þîmâü«$ÓÍí$×môqÝn!þîmâü«$ÓÍí$×môqÝn!þîmâü«$ÓÍí$×môqÝn!þîmâü«$ÓÍí$×môqÝn!þîmâü«$ÓÍí$×môqÝn!þîmü 4¥b!ÿ* ü¼¹£fë&@ú¸n7 l÷¶i~p©r1«pÈ¿jà?oî¨äº >n£ÛÂm ÄÓ½mwb ùwi<àçÍ5\7aÒÇmt[¸iøcº·mòbiyêiÀÈ¿jàÜÜq!Éu }Üf·a?¦{Û$/u*¢jÅ¥¤þ¯ 9+È¿jàÜÜq!Éu }Üf·a?¦{Û$o¨ÿ+¢bþn1d] xÁº¹cbë&@ú¸n7 l÷¶i!bÎ[)fÔ¥¨s)Ô1ùwi<ßÍm\7aÒÇmt[¸iøcº·mª(ð&0(±bx%*bÙsÆüdþuä{sg$×môqÝn!þîm¼ m ¢)ªtr¥¤¨oÃt1Ⱥøûïü«$¨ÈÍ\7aÒÇmt[¸iøcº·mò6)0$¼q)ö^1Íó7Ä"ÿ* *rsÇ$×môqÝn!þîm¼` ×sui= ¹¹ãbë&@ú¸n7 l÷¶iÙ@ü$w ùwi<ëÍg\7aÒÇmt[¸iøcº·mÊoËqbþuäzsÇ$×môqÝn!þîm²i`¹ªpÈ¿jà\oî8äº >n£ÛÂm ÄÓ½mrÁqº¹½äº >n£ÛÂm ÄÓ½mr6l¹*n*ò¯ x ×;$¹n¤Ûè¶p ñÇto s® ü«$Èõæ#i® éã
etc. etc.
this i'm trying - various false starts:
vm.getlabelbinarydata = function (labelid){ labelsservice.getshippinglabel(labelid).then ( function success(response) { vm.openwindowforlabels(response.data); }, function fail(response) { toastr.error(response.data); } ); }; vm.openwindowforlabels = function (responsedata) { //var b64response = btoa(rawresponse) var image = new image(); image.src = 'data:image/png;base64,' + responsedata; var popupwin = window.open('', '_blank', 'width=1000,height=1000'); popupwin.document.open(); popupwin.document.write('<html><head></head><body></body></html>'); popupwin.document.body.appendchild(image); //popupwin.document.close(); };
when inspect html, see this:
<html><head></head><body><img src="data:image/png;base64,�png
strangely, in browser window, see closing img bracket, , closing body , html tags. fact didn;t copy leads em believe data either long 'too long edit', or special character killing before displays.
either way, broken image icon.
i'm stumped.
update:
i found sample here: https://en.wikipedia.org/wiki/data_uri_scheme plugged in code:
image.src = 'data:image/png;base64,ivborw0kggoaaaansuheugaaaauaaaafcayaaacnbyblaaaaheleqvqi12p4//8/w38giaxdibke0dhxgljnbaao9txl0y4ohwaaaabjru5erkjggg==';
...and indeed shows red dot fine.
this suggests code working fine , problems lies parsing data properly. (i have verified api dev seeing working image in postman.)
Comments
Post a Comment