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.
    at java.lang.AbstractStringBuilder.enlargeBuffer(
    at java.lang.AbstractStringBuilder.append0(
    at java.lang.StringBuilder.append(
    at com.rootsoft.pdfwriter.EnclosedContent.toPDFString(
    at com.rootsoft.pdfwriter.IndirectObject.render(
    at com.rootsoft.pdfwriter.IndirectObject.toPDFString(
    at com.rootsoft.pdfwriter.Body.render(
    at com.rootsoft.pdfwriter.Body.toPDFString(
    at com.rootsoft.pdfwriter.PDFDocument.toPDFString(
    at com.rootsoft.pdfwriter.PDFWriter.asString(
    at com.rootsoft.pdfwriter.myPDFWriter.ConverseDocument(
    at com.wildcatapps.stonemobile.poreceiving._createporeport(
    at com.wildcatapps.stonemobile.poreceiving._btnsigsubmit_click(
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(
    at anywheresoftware.b4a.BA.raiseEvent2(
    at anywheresoftware.b4a.BA.raiseEvent2(
    at anywheresoftware.b4a.BA.raiseEvent(
    at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(
    at android.view.View.performClick(
    at android.view.View$
    at android.os.Handler.handleCallback(
    at android.os.Handler.dispatchMessage(
    at android.os.Looper.loop(
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(
    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?


    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.
  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