Hello,
This is caused by using the PDInsertAll flag. In the Acrobat SDK documentation for PDDocInsertPages there's a (subtle) note:
"The insertFlags
parameter controls whether bookmarks and threads are inserted along with the specified pages. Setting The PDInsertAll flag has two effects:
- The parameters indicating which pages to insert are ignored: all the pages of
doc2
are inserted.
[...]"
If you remove the PDInsertAll flag, the call should honor the requested page to insert (the 6th page, in the example you give, because it is 0-based). You can supply PDInsertBookmarks | PDInsertThreads for flags to get bookmarks and threads copied into pdDocFirst.