IPXC_Pages::InsertPagesFromDoc source document

A forum for questions or concerns related to the PDF-XChange Core API SDK

Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, 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
pschlan
User
Posts: 13
Joined: Thu Nov 15, 2018 10:14 pm

IPXC_Pages::InsertPagesFromDoc source document

Post by pschlan »

Hi,

is it safe to call InsertPagesFromDoc from multiple threads each with a separate destination document but a shared source document?

I.e. I open a single pSrcDoc in a thread, then I create a couple of worker threads which create new documents and call InsertPagesFromDoc using the same source doc.

Or do I have to use a dedicated instance of the source document in every worker thread, i.e. re-open it in every thread?

Thanks,

Patrick
User avatar
Lzcat - Tracker Supp
Site Admin
Posts: 677
Joined: Thu Jun 28, 2007 8:42 am

Re: IPXC_Pages::InsertPagesFromDoc source document

Post by Lzcat - Tracker Supp »

Hi, pschlan

In theory it is safe to do this, but when inserting pages from one document to another both documents are exclusively locked, so while one thread will do work all other will wait for source document became unlocked. For best performance you should have one copy of source document per each thread. Be aware that InsertPagesFromDoc may require significant amount of memory (depending on source and destination documents), so it is not recommended to do this in parallel in 32-bit code or when you have limited amount of RAM.

Kind regards,
Lzcat - Tracker Supp
Victor
Tracker Software
Project manager

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
pschlan
User
Posts: 13
Joined: Thu Nov 15, 2018 10:14 pm

Re: IPXC_Pages::InsertPagesFromDoc source document

Post by pschlan »

This is very useful information, thank you!
pschlan
User
Posts: 13
Joined: Thu Nov 15, 2018 10:14 pm

Re: IPXC_Pages::InsertPagesFromDoc source document

Post by pschlan »

Follow-up question: Any easy way to clone an IPXC_Document, or do I have to load from file multiple times?
User avatar
Lzcat - Tracker Supp
Site Admin
Posts: 677
Joined: Thu Jun 28, 2007 8:42 am

Re: IPXC_Pages::InsertPagesFromDoc source document

Post by Lzcat - Tracker Supp »

Hi, pschlan

There is no way to clone IPXC_Document, best solution is open multiple times.

Kind regards,
Lzcat - Tracker Supp
Victor
Tracker Software
Project manager

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
pschlan
User
Posts: 13
Joined: Thu Nov 15, 2018 10:14 pm

Re: IPXC_Pages::InsertPagesFromDoc source document

Post by pschlan »

Ok, even with the locking in place and shared documents I already see a tremendous speedup :)
Thanks again!
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17910
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

IPXC_Pages::InsertPagesFromDoc source document

Post by Tracker Supp-Stefan »

:)
Post Reply