Click here to Skip to main content
15,896,201 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi, I don't have much experience with Crystal Reports and I am in need of some assistance. I have a canvas which I am using for an online signature. I'm using Javascript to get the image, then place it in a hidden field. I then submit the image to the db and I drag and drop my signature field in the crystal report. When I export the report as a PDF the image displays as a black box. I have retrieved the image and saved it on my local machine as a test and it works fine.

Here is my coding.

JavaScript
var image = document.getElementById("sketch").toDataURL("image/png");
image = image.replace('data:image/png;base64,', '');
var hiddenField = document.getElementById('<%= hidImg.ClientID %>');

hiddenField.value = image;

C#
 protected void btnSubmit_Click(object sender, EventArgs e)
    {
        //TODO: Find a way to save Canvas.
        var img = hidImg.Value;
        byte[] data = Convert.FromBase64String(img);
        Logsheets_Online LOs = new Logsheets_Online();
        LOs.LogsheetID = long.Parse(txtLogNumber.Text);
        LOs.Date = DateTime.Parse(txtDate.Text);
        LOs.OrderNumber = txtOrderNumber.Text;
        LOs.CallReferenceNumber = txtCallReferenceNumber.Text;
        LOs.CompanyID = int.Parse(ddlCompany.SelectedValue);
        LOs.ClientID = int.Parse(ddlCompany.SelectedValue);
        LOs.ClientName = txtOther.Text;
        LOs.EmployeeID = int.Parse(ddlEmployee.SelectedValue);
        LOs.TimeArrived = TimeSpan.Parse(txtTimeArrived.Text);
        LOs.TimeDeparted = TimeSpan.Parse(txtTimeDeparted.Text);
        LOs.TravelTime = int.Parse(txtTravelTime.Text);
        LOs.BillableKilometers = int.Parse(txtBillableKilometers.Text);
        LOs.SLA = int.Parse(txtSLA.Text);
        LOs.Other = int.Parse(txtOther.Text);
        LOs.BillableTime = int.Parse(txtBillableTime.Text);
        LOs.Rate = decimal.Parse(txtRate.Text);
        LOs.Name = txtName.Text;
        LOs.ClientSignature = data;
        LO.Logsheets_Onlines.InsertOnSubmit(LOs);
        LO.SubmitChanges();
}


Any help would be appreciated. Thanks
Posted

1 solution

Hi...
See this one, may its help full to u! Using asp.net and Mysql.
How to store images and displaying images in crystal reports using asp.net,my sql[^]
Thank u.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900