Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > I need help - I can help
  New Posts New Posts RSS Feed - Delete optionalcontentgroup
  FAQ FAQ  Forum Search   Register Register  Login Login

Delete optionalcontentgroup

 Post Reply Post Reply
Author
Message
nieguizhi View Drop Down
Beginner
Beginner


Joined: 12 Jan 16
Location: shanghai
Status: Offline
Points: 12
Post Options Post Options   Thanks (0) Thanks(0)   Quote nieguizhi Quote  Post ReplyReply Direct Link To This Post Topic: Delete optionalcontentgroup
    Posted: 25 Jan 16 at 8:49AM
Hi, I use the following code to delete the optionalcontentgroup, however it does not remove the optionalcontentgroup. Could somebody give me some suggestion, thanks! look forward to your replay.

DPL.LoadFromFile(L"contentstream.pdf", L"");
int contentNum = DPL.ContentStreamCount();

int optionNum = DPL.OptionalContentGroupCount();

for (int i=0; i<=optionNum; ++i)
{
int optionID = DPL.GetOptionalContentGroupID(i);
CStringW optionalName = DPL.GetOptionalContentGroupName(optionID).c_str();
DPL.DeleteOptionalContentGroup(optionID);
}
DPL.SaveToFile(L"no_option.pdf");
Back to Top
tfrost View Drop Down
Senior Member
Senior Member


Joined: 06 Sep 10
Location: UK
Status: Offline
Points: 437
Post Options Post Options   Thanks (1) Thanks(1)   Quote tfrost Quote  Post ReplyReply Direct Link To This Post Posted: 25 Jan 16 at 12:21PM
You should first re-sequence the loop. You should always start with the highest value and descend from the top down when deleting, because deleting the value i makes the next item become i.  Also the content group ID index base is documented as 1, not 0.
Back to Top
nieguizhi View Drop Down
Beginner
Beginner


Joined: 12 Jan 16
Location: shanghai
Status: Offline
Points: 12
Post Options Post Options   Thanks (0) Thanks(0)   Quote nieguizhi Quote  Post ReplyReply Direct Link To This Post Posted: 26 Jan 16 at 4:10AM
could you mean this:
for (int i=optionNum; i>=1; --i) 
{
 int optionID = DPL.GetOptionalContentGroupID(i);
DPL.DeleteOptionalContentGroup(optionID);
 }

thanks!
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store