DisplayFromByteArray with javascript
DisplayFromByteArray with javascript
Hello, i have a problem with DisplayFromByteArray function, and i'm going crazy...
I have this javascript that works fine:
<script type="text/javascript">
VisorPDF.DisplayFromURL("www.gdpicture.com", "/ressources/specifications/ActivexCOM.pdf");
</script>
but when i want to use DisplayFromByteArray function it doesn''t work... what kind of variable do i have to pass to this function?
This piece of javascript gives a type mismatch javascript error:
var vArray = [37,80,68,70,45,49,46,49,13,10,13,10,57,32,48,32,111,98,106,13,10,60,60,13,10];
VisorPDF.DisplayFromByteArray(vArray);
but this piece is ok:
var vArray = "edasdasd";
VisorPDF.DisplayFromByteArray(vArray);
both cases are just for test, when i know what kind of variable i need i will put the correct data inside.
So, do i have to pass a string to DisplayFromByteArray function?? why an array of bytes variable gives a type mistatch error? And, i have to pass a string... in wich format?
Thanks in advance,
Tuco
I have this javascript that works fine:
<script type="text/javascript">
VisorPDF.DisplayFromURL("www.gdpicture.com", "/ressources/specifications/ActivexCOM.pdf");
</script>
but when i want to use DisplayFromByteArray function it doesn''t work... what kind of variable do i have to pass to this function?
This piece of javascript gives a type mismatch javascript error:
var vArray = [37,80,68,70,45,49,46,49,13,10,13,10,57,32,48,32,111,98,106,13,10,60,60,13,10];
VisorPDF.DisplayFromByteArray(vArray);
but this piece is ok:
var vArray = "edasdasd";
VisorPDF.DisplayFromByteArray(vArray);
both cases are just for test, when i know what kind of variable i need i will put the correct data inside.
So, do i have to pass a string to DisplayFromByteArray function?? why an array of bytes variable gives a type mistatch error? And, i have to pass a string... in wich format?
Thanks in advance,
Tuco
Re: DisplayFromByteArray with javascript
Hi,
in JS:
is not an array of byte. I this each entry are encoded in 32-bit value (and not 8-bit). It is why you got the type mismatch error.
This:
Can be considered as an array of byte. This is an array of char and each char are encoded as a byte (8-bit).
Solution:
Catch your data as string value and use the DisplayFromString() method instead the DisplayFromByteArray().
Best regards,
Loïc
in JS:
Code: Select all
var vArray = [37,80,68,70,45,49,46,49,13,10,13,10,57,32,48,32,111,98,106,13,10,60,60,13,10];
This:
Code: Select all
var vArray = "edasdasd";
Solution:
Catch your data as string value and use the DisplayFromString() method instead the DisplayFromByteArray().
Best regards,
Loïc
Re: DisplayFromByteArray with javascript
Thanks for your reply
I understand what you say... but i can't solve my problem.
I didn't give you all the information, so, now i'm going to explain my case:
I'm working with asp.net, c#. I have a byte[] variable at server side, with the data of the pdf document. On asp.net page load event, i write this byte[] variable data into value of an html textarea. Then, at the end of the aspx code there is a javascript script that calls the display method passing the value of this textarea to the activex object.
When i write the byte[] variable to the value of the input, i do a transformation byte[] --> string. But, wich codification do i have to do?
Both methods of the gridviewer activex, DisplayFromByteArray and DisplayFromString, expect a javascript string parameter... but with wich codification? I think i could use any of both methods... the problem is that i don't know how to pass them te information.
Maybe i'm not realizing something... maybe i'm doing too complicate... i just want to pass the information in a byte[] variable at server side to the activex gridviewer, but i can't see how. There must be a simple way, isn't?
Thanks,
Tuco
I understand what you say... but i can't solve my problem.
I didn't give you all the information, so, now i'm going to explain my case:
I'm working with asp.net, c#. I have a byte[] variable at server side, with the data of the pdf document. On asp.net page load event, i write this byte[] variable data into value of an html textarea. Then, at the end of the aspx code there is a javascript script that calls the display method passing the value of this textarea to the activex object.
When i write the byte[] variable to the value of the input, i do a transformation byte[] --> string. But, wich codification do i have to do?
Both methods of the gridviewer activex, DisplayFromByteArray and DisplayFromString, expect a javascript string parameter... but with wich codification? I think i could use any of both methods... the problem is that i don't know how to pass them te information.
Maybe i'm not realizing something... maybe i'm doing too complicate... i just want to pass the information in a byte[] variable at server side to the activex gridviewer, but i can't see how. There must be a simple way, isn't?
Thanks,
Tuco
Re: DisplayFromByteArray with javascript
I have the same problem.DisplayFromByteArray(DisplayFromString) with javascript or vbscript. Is there any sample code now?This post is very old but there is no answer.
Re: DisplayFromByteArray with javascript
I am also facing the exact issue..any suggestions?
Who is online
Users browsing this forum: No registered users and 1 guest