Capture bitmap problem

Dman

Active Member
Licensed User
Longtime User
I am trying to copy an html page to an image and can't seem to do it. I only found 1 topic here dealing with this error and I can't seem to get it working. I made a sample app to test it. It gives a height and width must be >0 error.

Any help would be appreciated. TIA
 

Attachments

  • caperror.zip
    10.8 KB · Views: 158
Last edited:

Dman

Active Member
Licensed User
Longtime User
This?

java.lang.IllegalArgumentException: width and height must be > 0
at android.graphics.Bitmap.createBitmap(Bitmap.java:638)
at android.graphics.Bitmap.createBitmap(Bitmap.java:620)
at anywheresoftware.b4a.objects.drawable.CanvasWrapper$BitmapWrapper.InitializeMutable(CanvasWrapper.java:543)
at anywheresoftware.b4a.objects.WebViewWrapper.CaptureBitmap(WebViewWrapper.java:131)
at com.reportsample.njdude.main._webview1_pagefinished(main.java:509)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:165)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:153)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:149)
at anywheresoftware.b4a.objects.WebViewWrapper$1.onPageFinished(WebViewWrapper.java:60)
at android.webkit.CallbackProxy.handleMessage(CallbackProxy.java:327)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
java.lang.IllegalArgumentException: width and height must be > 0
 
Upvote 0

Dman

Active Member
Licensed User
Longtime User
Hmm. This appears to make an image from a html page on a website just fine but it doesn't seem to work on an html page stored on the device.
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
The problem is in the WebView1_PageFinished routine that doesn't seem allow to capture the bitmap.
I modified the program:
- Added a menu Item SaveBitmap
- The SaveBitmap_Click routine saves the bitmap of the Report WebView.

Best regards.
 

Attachments

  • caperror_1.zip
    12.8 KB · Views: 243
Upvote 0
Top