Memory issue while performing Text Container Searching and Stamping text into 10000 Pages PDF Document.

May 31, 2018

Copy link to clipboard

Copied

Hi

i will searching Text object Containers for all the pages in the PDF Doc.

The following code Demonstrates the above functionality.

if (AVAppGetActiveDoc())

{

for (int i = iSPage; i <iEPage; i++)

{

PDPage pdpage = PDDocAcquirePage(pdDoc, i);

PDEContent pdeContent;

CString rcsTag;

pdeContent = PDPageAcquirePDEContent(pdpage, gExtensionID);

PDEElement pdeElement;

ASInt32 NumEle = PDEContentGetNumElems(pdeContent);

for (NumEle = PDEContentGetNumElems(pdeContent) - 1; NumEle >= 0; NumEle--)

{

pdeElement = PDEContentGetElem(pdeContent, NumEle);

if (PDEObjectGetType((PDEObject)pdeElement) == kPDEContainer)

{

ASAtom asaActualTag = PDEContainerGetMCTag((PDEContainer)pdeElement);

LPCSTR csActualTagvalve = ASAtomGetString(asaActualTag);

CString csActualTag = (CString)csActualTagvalve;

if (csActualTag.Find(L"ACUTAHeader") != -1 || csActualTag.Find(L"ACUTAFooter") != -1)

{

HeaderPresent = true;

}

}

}

PDPageReleasePDEContent(pdpage, gExtensionID);

PDPageRelease(pdpage);

}

}

After Searching completes, in Task manager Acrobat takes 1.5 GB memory.

for each iteration in the Loop, memory not released even one Time.

Please give some Solution about how to release memory for each iteration.

Thanks.

TOPICS
Acrobat SDK and JavaScript

Views

178

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Memory issue while performing Text Container Searching and Stamping text into 10000 Pages PDF Document.

May 31, 2018

Copy link to clipboard

Copied

Hi

i will searching Text object Containers for all the pages in the PDF Doc.

The following code Demonstrates the above functionality.

if (AVAppGetActiveDoc())

{

for (int i = iSPage; i <iEPage; i++)

{

PDPage pdpage = PDDocAcquirePage(pdDoc, i);

PDEContent pdeContent;

CString rcsTag;

pdeContent = PDPageAcquirePDEContent(pdpage, gExtensionID);

PDEElement pdeElement;

ASInt32 NumEle = PDEContentGetNumElems(pdeContent);

for (NumEle = PDEContentGetNumElems(pdeContent) - 1; NumEle >= 0; NumEle--)

{

pdeElement = PDEContentGetElem(pdeContent, NumEle);

if (PDEObjectGetType((PDEObject)pdeElement) == kPDEContainer)

{

ASAtom asaActualTag = PDEContainerGetMCTag((PDEContainer)pdeElement);

LPCSTR csActualTagvalve = ASAtomGetString(asaActualTag);

CString csActualTag = (CString)csActualTagvalve;

if (csActualTag.Find(L"ACUTAHeader") != -1 || csActualTag.Find(L"ACUTAFooter") != -1)

{

HeaderPresent = true;

}

}

}

PDPageReleasePDEContent(pdpage, gExtensionID);

PDPageRelease(pdpage);

}

}

After Searching completes, in Task manager Acrobat takes 1.5 GB memory.

for each iteration in the Loop, memory not released even one Time.

Please give some Solution about how to release memory for each iteration.

Thanks.

TOPICS
Acrobat SDK and JavaScript

Views

179

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
May 31, 2018 0
Adobe Employee ,
Jun 01, 2018

Copy link to clipboard

Copied

Memory will get released as needed As long as you remember to release things (as you appear to be doing), then just let Acrobat (and your OS) worry about it.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 01, 2018 1
Jun 03, 2018

Copy link to clipboard

Copied

You set the variable HeaderPresent. But you don't use it.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 03, 2018 1