Clone Content from one CoreDoc page to another  SOLVED

PDF-XChange Editor SDK for Developers

Moderators: TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan

Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.

When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
Post Reply
zarkogajic
User
Posts: 1370
Joined: Thu Sep 05, 2019 12:35 pm

Clone Content from one CoreDoc page to another

Post by zarkogajic »

Hi Support,

What's wrong with the below code - why is the resulting page newDoc's empty:

Code: Select all

//pseduo
IPXC_Content pContent = CoreDoc.Pages[0].GetContent(CAccessMode_FullClone);

//not sure if needed, but no changes in resulting page: 
//IPXC_Content pContentClone = pContent.Clone(false)

CoreDoc.Pages[0].Get_Box(PBox_MediaBox, stMediaBox)

newDoc = IPXC_Inst.NewDocument

newDoc.Pages.AddEmptyPages(0, 1, stMediaBox, nil, pUndoData);

newDoc.Pages[0].PlaceContent(pContent[Clone], PlaceContent_After);

newDoc.WriteToFile(...)
The resulting "newDoc" has one page but it is empty.

The pContent (content from 1st page of CoreDoc) does have items (so not empty).

What am I missing?

-žarko
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Clone Content from one CoreDoc page to another

Post by Sasha - Tracker Dev Team »

Hello zarkogajic,

The thing is that you cannot just simply copy contents between documents. This can be done only with the container that the content resides in. To put it simpler - you will need to copy a needed page to the needed document, copy the content from it and then remove the page.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
zarkogajic
User
Posts: 1370
Joined: Thu Sep 05, 2019 12:35 pm

Re: Clone Content from one CoreDoc page to another

Post by zarkogajic »

Hi Alex,

ok, thanks.
you will need to copy a needed page to the needed document
Any other way than InsertPagesFromDoc ?




-žarko
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Clone Content from one CoreDoc page to another

Post by Sasha - Tracker Dev Team »

Hello zarkogajic,

I'm afraid that you will have to cope with that one.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
zarkogajic
User
Posts: 1370
Joined: Thu Sep 05, 2019 12:35 pm

Re: Clone Content from one CoreDoc page to another  SOLVED

Post by zarkogajic »

Hi Alex,

Ok, noted, thanks.

Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Clone Content from one CoreDoc page to another

Post by Sasha - Tracker Dev Team »

:)
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Post Reply