• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

PDDocDeletePages causing blank page that is "in use" to appear

Explorer ,
Aug 31, 2023 Aug 31, 2023

Copy link to clipboard

Copied

I am running the code below to attempt to remove a page I created and added a legend to. It gets no error. I created a test file that only had one page and a legend. If I step in the debugger, I see the scroll bar change as if there is no second page and then change back. the second page is now a blank page and does not have the legend content. The bookmark is gone. If I attempt to delete the pag in the UI, I get an error indicating the page is in use. If I save and close thfile, then reopen it, I still get an error saying the page is in use if I try to delete it in the UI.

 

void RemoveLegendBookmark(PDDoc pdDoc)
{
DURING
// We make top-level bookmarks only, so add a new bookmark to the root
PDBookmark bmRoot, bmNode;
bmRoot = PDDocGetBookmarkRoot(pdDoc);
if (PDBookmarkHasChildren(bmRoot))
{
bmNode = PDBookmarkGetByTitle(bmRoot, pOptions->LegendBookmarkTitle.c_str(), pOptions->LegendBookmarkTitle.length(), -1);
if(PDBookmarkIsValid(bmNode))
{
// get the action for the current bookmark
PDAction bookmarkAction = PDBookmarkGetAction(bmNode);
// get the view destination for the current bookmark's action
PDViewDestination bookmarkViewDestination = PDActionGetDest(bookmarkAction);
bookmarkViewDestination = PDViewDestResolve(bookmarkViewDestination, pdDoc);
ASInt32 pageNum;
ASAtom fitType;
ASFixedRect destRect;
ASFixed zoom;
PDViewDestGetAttr(bookmarkViewDestination, &pageNum, &fitType, &destRect, &zoom);
PDViewDestDestroy(bookmarkViewDestination);
PDBookmarkDestroy(bmNode);
PDDocDeletePages(pdDoc, pageNum, pageNum, NULL, NULL);
 
}
}
HANDLER
// exception handling
char errorMsg[256];
ASGetErrorString(ASGetExceptionErrorCode(), errorMsg, 256);
void LogError(string errorMsg);
END_HANDLER
}
TOPICS
Acrobat SDK and JavaScript

Views

66

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
community guidelines
Explorer ,
Aug 31, 2023 Aug 31, 2023

Copy link to clipboard

Copied

LATEST

a follow up...
If I create the legen, then add a page after it, then remove the legend (with code above) the blank page is appended; it does not repleace thone I am deleting. I think the delete works, but for some reason is triggering something that appends a page.

Votes

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
community guidelines