We have 2 issues that we need to resolve on one of our aspx webforms pages. The affected markup and JavaScript is below.
When we type text into the text input element on a desktop the text shows as a script font and is perfect. However, when I use Chrome browser in Android phone the text is no longer script but plain text.
I would like to make the savePngToServer() a single function so that the script text is both placed in the img control and also saved to the server. If I run the textToPng() function first, then the savePngToServer() it works perfectly. I tried placing
textToPng(); in first line of savePngToServer() but it did not work as it saved an empty png file.
The second question: If you want to merge these two functions into one, you can call the savePngToServer() function in the onrendered callback function, or you can add a hard code at the end.
[WebMethod]
public static void SaveImage(string imageData, string strSavePath) {
byte[] imageBytes = Convert.FromBase64String(imageData);
//Save the Byte Array as Image File.
Image saveImage;
using (MemoryStream ms = new MemoryStream(imageBytes))
{
saveImage = Image.FromStream(ms);
}
string path = HttpContext.Current.Server.MapPath(strSavePath);
saveImage.Save(path);
}
Result:
Hope this can help you.
Best regards,
Xudong Peng
ASP.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today. Learn more >
Member
361 Points
1581 Posts
Font issue and combine functions
Jul 30, 2020 08:32 PM|dlchase|LINK
We have 2 issues that we need to resolve on one of our aspx webforms pages. The affected markup and JavaScript is below.
Contributor
2400 Points
749 Posts
Re: Font issue and combine functions
Jul 31, 2020 07:16 AM|XuDong Peng|LINK
Hi dlchase,
First question: This means that you are developing a mobile website. Do you add the required meta tags to it?
Please refer to the answer in the case below:
CSS Font-size not working properly on mobile device
The second question: If you want to merge these two functions into one, you can call the savePngToServer() function in the onrendered callback function, or you can add a hard code at the end.
Something like this:
Result:
Hope this can help you.
Best regards,
Xudong Peng