Android Question PDFWriter & Signature Capture - Out of Memory

Discussion in 'Android Questions' started by boastrike, Apr 15, 2015.

  1. boastrike

    boastrike Member Licensed User

    I know that the PDFWriter can't handle a lot of large images or it will run out of memory. I'm writing an app that requires a signature capture. It has two small weight logo images (16.3Kb, 66Kb) and we are calling the signature capture that saves the signature and then pastes it on the PDF (6Kb) document.

    Doing this causes it to run out of memory randomly about 30% of the time. We had done some ftp gets prior to that for maybe a dozen records that we store in a map. If we don't run the signature capture then it does not break.

    My question is has anyone found a way to help clear up any memory during this process to keep from running out of memory? Even if I comment out the logo images it still runs out of memory. Everything else works great but this is a show stopper. Any ideas would be greatly appreciated.

    Thanks, Jim
     
  2. boastrike

    boastrike Member Licensed User

    A little more information to see if it can help. We have tried to save the signature as a jpeg instead of a bitmap but doesn't fix the random out of memory. One thing that seems to be strange is that if we comment out inserting the signature image and instead load a different png file that is larger, the app doesn't seem to run out of memory. Is there something about the saved signature file that could be causing this? We even set a 3 second delay timer to make sure the app had time to save the image to the device prior to going on with the PDF. It stops in the conversing portion of the PDF write process.

    Here are the log error details.

    Conversing PDF.
    java.lang.OutOfMemoryError
    at java.lang.AbstractStringBuilder.enlargeBuffer(AbstractStringBuilder.java:94)
    at java.lang.AbstractStringBuilder.append0(AbstractStringBuilder.java:145)
    at java.lang.StringBuilder.append(StringBuilder.java:216)
    at com.rootsoft.pdfwriter.EnclosedContent.toPDFString(EnclosedContent.java:70)
    at com.rootsoft.pdfwriter.IndirectObject.render(IndirectObject.java:103)
    at com.rootsoft.pdfwriter.IndirectObject.toPDFString(IndirectObject.java:123)
    at com.rootsoft.pdfwriter.Body.render(Body.java:83)
    at com.rootsoft.pdfwriter.Body.toPDFString(Body.java:93)
    at com.rootsoft.pdfwriter.PDFDocument.toPDFString(PDFDocument.java:57)
    at com.rootsoft.pdfwriter.PDFWriter.asString(PDFWriter.java:113)
    at com.rootsoft.pdfwriter.myPDFWriter.ConverseDocument(myPDFWriter.java:90)
    at com.wildcatapps.stonemobile.poreceiving._createporeport(poreceiving.java:1631)
    at com.wildcatapps.stonemobile.poreceiving._btnsigsubmit_click(poreceiving.java:1156)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:187)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:175)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:171)
    at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:77)
    at android.view.View.performClick(View.java:4754)
    at android.view.View$PerformClick.run(View.java:19605)
    at android.os.Handler.handleCallback(Handler.java:733)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:146)
    at android.app.ActivityThread.main(ActivityThread.java:5752)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1291)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1107)
    at dalvik.system.NativeStart.main(Native Method)
     
    Last edited: Apr 15, 2015
  3. Yvon Steinthal

    Yvon Steinthal Active Member Licensed User

    I am having a similar problem, anyone found a solution?
    ----

    Nevermind,

    SetApplicationAttribute(android:largeHeap, "true")

    solved it for me
     
    Last edited: May 10, 2016
  4. DonManfred

    DonManfred Expert Licensed User

    Then you should reate a new thread for your issue giving us enough informations.
     
  5. Yvon Steinthal

    Yvon Steinthal Active Member Licensed User

    I will in the future, but i fixed my problem, as stated above.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice