Print Page | Close Window

CopyPageRanges very slowly!

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=2148
Printed Date: 05 Jul 25 at 10:58PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: CopyPageRanges very slowly!
Posted By: AlexCasual
Subject: CopyPageRanges very slowly!
Date Posted: 14 Feb 12 at 8:12AM
I want to create multipage pdf with function LoadFromString()...And if I use CopyPageRanges() from document created by  LoadFromString() to my multipage document it's VERY slowly!
Please help!



Replies:
Posted By: Ingo
Date Posted: 14 Feb 12 at 9:37AM
Hi Alex!
 
This could depend on the type of your pdfs (where's a sample?).
Perhaps it have to do with your code (where's a sample?).
You should deliver more infos if you need help.
And don't forget: It's a user-user-forum here - not the official support pages ;-)
 
Cheers, Ingo


Posted By: AlexCasual
Date Posted: 14 Feb 12 at 2:53PM
Part of C++ code :

..........
int pdf_id = m_QP->NewDocument();

for (SIZE_T i = 0; i < this->count_; ++i)
{
   m_QP->SetOrigin(1);

   std::string pdf_source;
   this->GetDataPdf(i,pdf_source); // <- Read pdf files from disk

   load_result = m_QP->LoadFromString(pdf_source,L"");
   
   int curr_id = m_QP->SelectedDocument();

   m_QP->SelectDocument(pdf_id);

   m_QP->CopyPageRanges(curr_id,L"1"); // <- VERY SLOWLY!!!

   m_QP->RemoveDocument(curr_id);
}
std::string pdf_source;
try
{
    m_QP->DeletePages(1,1);

    pdf_source = m_QP->SaveToString();

   m_QP->SaveToFile(L"c:\\Z.pdf");

   m_QP->RemoveDocument(pdf_id);
}
catch(...){}


Posted By: Ingo
Date Posted: 15 Feb 12 at 7:20PM
Hi!

At other parts you can save time.
First you load into string and then the string into QP.
At least you save to string and then from string via QP to file.
Why?
In your case i would remove the load/save to string?
If you want to copy pages from one document to the other
and want to delete them later in the original document
you should better use the capture functions (so one step less ;-).
To save further performance you can use the DA-functionalities.

Cheers, Ingo


Posted By: AlexCasual
Date Posted: 16 Feb 12 at 6:56PM
Capture functions will be working better?


Posted By: AlexCasual
Date Posted: 16 Feb 12 at 7:06PM
But I need copy pages from one document to another,can I use capture functions in this case?  


Posted By: Ingo
Date Posted: 16 Feb 12 at 7:50PM
I've seen copy and then delete - so i thought it was better to capture ;-)


Posted By: edvoigt
Date Posted: 16 Feb 12 at 9:16PM
Hi,

working with capture is only possible in one document, so you need merge in any form before.

As Ingo said, explain please more accurate what you want. I assume you want to build a new PDF and your source is another (bigger) PDF from which you need only a few pages?

Remember about the difference between your PDF on disk and the document in QP, which is a construct in memory. First you should use the "normal" way loadfromfile without going a way over a string. This string needs memory, QP->document needs memory. So you help QP to be slow.

If you have one PDF from which you need some pages, so the easiest way is to take it and delte the unneeded pages. So you have only one document in memory. After deleting process it is to save and you are ready.

If the PDF is very big, it may be better to use DA..., but try first easy

QP.Loadfromfile('name.pdf', '');
QP.DeletePage(12, 6); // example: without 12,13,..17
QP.SaveToFile('name_new.pdf');

 
to get a feeling for the possibilities of QP. More as this kernel operations is not needed.

Werner




Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk