Html2Canvas. Save to File Not Working WiseJ 2.5

0
0

Hello,

I’m building a web app based on a WiseJ 2.5 Desktop app using vb.net.  I’ve successfully used Html2Canvas to place an image of a panel into a picturebox as a sort of icon for the panel which represents a page in a pdf report.  The vb.net WiseJ example of the Html2Canvas shows how this is done.  It works great! :

“Html2Canvas.Screenshot(Me.panel1, Sub(Image) PicPage.Image = (Image))”        This works

I’d like to save the resulting image as Base64String in an XML file for storage in my database.  I tried to get the image as a bitmap first:
“dim tempBMP as Bitmap
Html2Canvas.Screenshot(Me.panel1, Sub(Image) tempBMP = Image)”           This Fails with tempBMP as nothing.
 I also tried to insert the image into a temporary picturebox then extract it from that:
“Html2Canvas.Screenshot(Me.panel1, Sub(Image) tempPictureBox.Image = Image)          This Fails with tempPictureBox.Image as nothing.
tempBMP = tempPictureBox.Image”

I found the example code in C# from https://docs.wisej.com/extensions/extensions/html2canvas.  This example was not in the vb.net example above.  My vb.net translation is here:

“Html2Canvas.Screenshot(Me.panel1, Sub(image) image.Save(“C:\Users\Gerry\Documents\HAAImage.png”))”         This Fails without error as the file is not created,
I’m curious if you have any suggestions on how to get the image as a bitmap so I can then convert it to a Base64String.
Thanks very much!
Gerry
  • You must to post comments
0
0

Hi!

I do understand the need to provide working examples of issues very much.  Especially with a high volume of requests.  It forces developers to discover issues on their own as well as providing a basis for establishing a potential real bug.  In some cases, though, a tip might be sufficient.  In my case, my answer was that I needed to use the Async version of the Html2Canvas code.  This solved the problem.

Thanks for responding and providing a great framework!

Gerry

  • You must to post comments
0
0

Can you please provide a sample in Wisej 2.5 using vb.net that includes all the code snippets here?
Follow the guidelines under “Before posting an issue” here: https://wisej.com/support/question/forum-guidelines

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.