Page 1 of 1

print out from grid array with graphic and ccsid(1200)

Posted: Mon Apr 30, 2018 6:51 am
by m400mail
Hello to all

i have a grid with a tooltip. this tooltip is defined as graphic Field with 15000 and ccsid(1200)
i must print this. i have the following Javascript:

printSelectedReports();

function printSelectedReports() {
alert('start');

var griddata = getObj("Grid01").grid.getAllDataValues(true);

var printWindow = window.open("", "", 'left=50,top=50,width=1200,height=800');
printWindow.document.write("<h1> <p>BOHLE Report</p> </h1>");

printWindow.document.write( '<font size="8" face="Courier" >');
// Grid lesen und drucken

for (var i=0; i<griddata.length; i++) {
//******************************************************************
// print if checkbox on
//******************************************************************
if (griddata.CHECKBOX == '1' )
{
var aHeader = griddata.FLD001 + ' ' + griddata.FLD002 + '<br><br>';
printWindow.document.write(aHeader);

//******************************************************************
// print Text ( Textarea / variable Tooltip )
//******************************************************************
var atextvalue = griddata.IMGTOOLTIP + '<br> <br>' ;
printWindow.document.write(atextvalue);

//var atextvalue2 = griddata.FLD003 + '<br> <br>' ;
//printWindow.document.write(atextvalue2);

//******************************************************************
// Ende Kennzeichen
//******************************************************************
var aEndText = '---------------------------------------------------------------<br>';
printWindow.document.write(aEndText);
}
}
//printWindow.document.write( '</font');

printWindow.document.close();
printWindow.focus();
printWindow.print();
printWindow.close();

}

The variable atextvalue shows this characters
image01.PNG
image01.PNG (110.37 KiB) Viewed 417 times
Does anyone have an idea how to print via Javascript graphic variables?

Re: print out from grid array with graphic and ccsid(1200)

Posted: Mon Apr 30, 2018 11:42 am
by matt.denninghoff
Data from graphic fields are encoded in Base64 strings to prevent the HTTP server from trans-coding the original character's incorrectly. When Profound UI JavaScript reads the Base64-encoded graphic field data, then Profound UI decodes the Base64 string into a Unicode character string.

To read the raw grid data as you are attempting, you must decode the Base64 string. You can use the Base64-decoding function on the open-source version of the Profound UI framework, found here:
https://github.com/ProfoundLogic/profou ... pi.js#L915