Extract selected pages

PDF-XChange Viewer SDK for Developer's
(ActiveX and Simple DLL Versions)

Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange

Rad1
User
Posts: 108
Joined: Wed May 13, 2009 2:21 pm

Extract selected pages

Post by Rad1 »

hello friends,

I want to Extract selected pages to the new pdf file and save it on disk. But the problem is how to Extract and save with one button ? it must be transparent for user. no action is needed.

I can't find all commands, I know there are over 400 commands. Can you send me the complete list of these commands ?

I contacted 'support@pdf-xchange.com' forthis, but I have not received a response.

Thank you for help.
Corwin - Tracker Sup
User
Posts: 664
Joined: Tue Nov 14, 2006 12:23 pm

Re: Extract selected pages

Post by Corwin - Tracker Sup »

List of all possible commands are found in "Commands" sample. In this sample you can also execute any command to see how it works (but notice that for some commands you need to have opened document).

Possible solutions to extract pages are:
1. Execute "ExtractPages" command. But this will show "Extract pages" dialog.

Code: Select all

PDFView.DoVerb(0, "ExecuteCommand", "ExtractPages", 0)
2. Use PDF Java Script. To learn more about it you can look at the "Acrobat JavaScript Object Specification"
Just a little sample form there:

Code: Select all

/* Extract Pages to Folder */
// regular expression acquire the base name of file
var re = /.*\/|\.pdf$/ig;
// filename is the base name of the file Acrobat is working on
var filename = this.path.replace(re,"");
try {
	for (var i = 0; i < this.numPages; i++) 
		this.extractPages(
		{
			nStart: i,
			cPath: "/C/"+filename+"_" + i +".pdf"
		});         
} catch (e) { 
	console.println("Aborted: "+e) 
}
This will create new PDF file for each page in the document.
3. Use PDF-XChange Tools SDK which allows to manipulate any PDF without using Viewer ActiveX.

In future we planning to add new functions to Viewer ActiveX to allow easily extract pages from document by using only Viewer ActiveX functions.
Rad1
User
Posts: 108
Joined: Wed May 13, 2009 2:21 pm

Re: Extract selected pages

Post by Rad1 »

Hello,

Thanks for response.

The java Script code work well, but how can I get the list of selected pages ?

I searched for this function, but I can't find it in the SDK help file.

10x
Corwin - Tracker Sup
User
Posts: 664
Joined: Tue Nov 14, 2006 12:23 pm

Re: Extract selected pages

Post by Corwin - Tracker Sup »

What do you mean by saying "list of selected pages"?
Rad1
User
Posts: 108
Joined: Wed May 13, 2009 2:21 pm

Re: Extract selected pages

Post by Rad1 »

Corwin wrote:What do you mean by saying "list of selected pages"?
Hi,

Whene I want to extract selected pages, I use PDF Java Script present at the "Acrobat JavaScript Object Specification". (see the sample). But if I want to extract the set of selected pages in the "Mosaics" mode (I use Ctrl + Right clic to select separate thumbnails), I can not because I don't know how to GetSelectedPages.

Look at the attached picture
http://www.monsterup.com/image.php?url= ... 649796.jpg
Corwin - Tracker Sup
User
Posts: 664
Joined: Tue Nov 14, 2006 12:23 pm

Re: Extract selected pages

Post by Corwin - Tracker Sup »

I'm afraid that this is not possible in current version of Viewer ActiveX. :(
Rad1
User
Posts: 108
Joined: Wed May 13, 2009 2:21 pm

Re: Extract selected pages

Post by Rad1 »

Corwin wrote:I'm afraid that this is not possible in current version of Viewer ActiveX. :(
No I don't think so. How can extract the selected pages if we don't know which are selected.

I think if this is not possible in viewer activex, it's possible by running java script.
Corwin - Tracker Sup
User
Posts: 664
Joined: Tue Nov 14, 2006 12:23 pm

Re: Extract selected pages

Post by Corwin - Tracker Sup »

In this case JS doesn't receive any information from the Viewer UI.
Rad1
User
Posts: 108
Joined: Wed May 13, 2009 2:21 pm

Re: Extract selected pages

Post by Rad1 »

Hello,

Please help us to do that, I'm going to buy the activex version of PDF Xchange. But this a very important function to have in our product.

thanks for helping me.
Corwin - Tracker Sup
User
Posts: 664
Joined: Tue Nov 14, 2006 12:23 pm

Re: Extract selected pages

Post by Corwin - Tracker Sup »

Hello Rad1.
Good news - in new build of Viewer ActiveX you will be able to extract pages without showing "Extract pages" dialog.
Rad1
User
Posts: 108
Joined: Wed May 13, 2009 2:21 pm

Re: Extract selected pages

Post by Rad1 »

Corwin wrote:Hello Rad1.
Good news - in new build of Viewer ActiveX you will be able to extract pages without showing "Extract pages" dialog.
I must wait for next build to buy the activex !!!
Can you tell me whene this will be available ?
Corwin - Tracker Sup
User
Posts: 664
Joined: Tue Nov 14, 2006 12:23 pm

Re: Extract selected pages

Post by Corwin - Tracker Sup »

I think, you may expect to see it within the next two weeks.
User avatar
John - Tracker Supp
Site Admin
Posts: 5223
Joined: Tue Jun 29, 2004 10:34 am

Re: Extract selected pages

Post by John - Tracker Supp »

We are now hoping this will be towards the end of this week/weekend.

HTH
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.

Best regards
Tracker Support
http://www.tracker-software.com
Irbis
User
Posts: 1
Joined: Wed Jun 03, 2009 1:47 pm

Re: Extract selected pages

Post by Irbis »

Hi There,

I also need this feature :) Is this available yet?
Corwin - Tracker Sup
User
Posts: 664
Joined: Tue Nov 14, 2006 12:23 pm

Re: Extract selected pages

Post by Corwin - Tracker Sup »

Nope. We have little delay with release of new build.
User avatar
John - Tracker Supp
Site Admin
Posts: 5223
Joined: Tue Jun 29, 2004 10:34 am

Re: Extract selected pages

Post by John - Tracker Supp »

It will be released for sure this weekend.
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.

Best regards
Tracker Support
http://www.tracker-software.com
Rad1
User
Posts: 108
Joined: Wed May 13, 2009 2:21 pm

Re: Extract selected pages

Post by Rad1 »

Is the new release available ?
I need this function to complete my software developement.

I have tried to do this :

Code: Select all

PDFView.DoVerb(0, "ExecuteCommand", "ExtractPages", 0)
PDFView.SetProperty("Prompts.ConfirmExtractPages.UserChoice", 0, 0);
But the seconde insctruction doesn't work. I think it is not implemented yet (Prompts.ConfirmExtractPages).

thanks for help.
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2448
Joined: Thu Jun 30, 2005 4:11 pm

Re: Extract selected pages

Post by Vasyl - PDF-XChange »

Code: Select all

PDFView.DoVerb(0, "ExecuteCommand", "ExtractPages", 0)
In the current build activeX will display ui-dialog for extracting pages always (flag 'PXCVA_NoUI' wil be ignored).
In the new build (coming soon) activeX can be process 'PXCVA_NoUI' flag.

For skip confirmation about replacing files you should process of special situation:

Code: Select all

OnEvent(Type, Name, ..)
{
     if ((Type == PXCVA_OnDisplayPrompt) && (Name == "Prompts.ConfirmFileReplace"))
     {
          PDFView.SetProperty("Prompts.ConfirmFileReplace.UserChoice", "YesToAll", 0);
     }
}
PDF-XChange Co. LTD (Project Developer)

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
Rad1
User
Posts: 108
Joined: Wed May 13, 2009 2:21 pm

Re: Extract selected pages

Post by Rad1 »

Vasyl-Tracker Dev Team wrote: For skip confirmation about replacing files you should process of special situation:

Code: Select all

OnEvent(Type, Name, ..)
{
     if ((Type == PXCVA_OnDisplayPrompt) && (Name == "Prompts.ConfirmFileReplace"))
     {
          PDFView.SetProperty("Prompts.ConfirmFileReplace.UserChoice", "YesToAll", 0);
     }
}
thanks for response :roll: but I'm not asking for replacing file. I need to select and extract a discontinuous range of pages using the Extract Pages option WITHOUT displaying UIDialog.

when can we expect the new version ?
Rad1
User
Posts: 108
Joined: Wed May 13, 2009 2:21 pm

Re: Extract selected pages

Post by Rad1 »

I thought of another solution. Is if we can customize the ExtractPages dialog box. I want to hide or disable the check box : Extract to separate file. and the "Save as" panel. Can I customize the interface of this dialog box ?

regards
Corwin - Tracker Sup
User
Posts: 664
Joined: Tue Nov 14, 2006 12:23 pm

Re: Extract selected pages

Post by Corwin - Tracker Sup »

Hi.
As I was informed new build is available for download.
In new build you may extract selected pages by using next code:

Code: Select all

var dti = 0;
var dto = 0;
PDFView.SetProperty('Operations.ExtractPages.RangeType','Selected',0);
PDFView.DoVerb('Documents[0]','ExtractPages', dti, dto, 2);
Rad1
User
Posts: 108
Joined: Wed May 13, 2009 2:21 pm

Re: Extract selected pages

Post by Rad1 »

Hi John, :D Thank you very much for this good work.

is it possible to delete pages after extraction from the original file ?

Regards :wink:
Corwin - Tracker Sup
User
Posts: 664
Joined: Tue Nov 14, 2006 12:23 pm

Re: Extract selected pages

Post by Corwin - Tracker Sup »

is it possible to delete pages after extraction from the original file ?
Yes, it is - sure. You can set next property:

Code: Select all

PDFView.SetProperty("Operations.ExtractPages.DeleteAfterExtract",1,0);
Rad1
User
Posts: 108
Joined: Wed May 13, 2009 2:21 pm

Re: Extract selected pages

Post by Rad1 »

Hi,

Thanks for reply.

I want to do the same thing to insert page without IU. Can I do this :

DFView.SetProperty('Operations.InsertPages.Source','FromFile',0);
PDFView.DoVerb('Documents[0]','InsertPages', 0, 0, 2);

Thank you.
Corwin - Tracker Sup
User
Posts: 664
Joined: Tue Nov 14, 2006 12:23 pm

Re: Extract selected pages

Post by Corwin - Tracker Sup »

Hello.
No, in current build you can insert only empty pages.
We will try to add inserting pages from file as soon as possible.
Rad1
User
Posts: 108
Joined: Wed May 13, 2009 2:21 pm

Re: Extract selected pages

Post by Rad1 »

thanks. :wink:
ugradedeveloper
User
Posts: 223
Joined: Wed Aug 22, 2007 4:40 pm

Re: Extract selected pages

Post by ugradedeveloper »

There is already the ability to insert pages from a file using Javascript ("this.insertPages").
Corwin - Tracker Sup
User
Posts: 664
Joined: Tue Nov 14, 2006 12:23 pm

Re: Extract selected pages

Post by Corwin - Tracker Sup »

ugradedeveloper is right :). For now you can insert existed pages from another PDF document by using JS.
Rad1
User
Posts: 108
Joined: Wed May 13, 2009 2:21 pm

Re: Extract selected pages

Post by Rad1 »

Yes man ! It wooooooorks. I have wath I needed.
Thanks. I think I can do the same thing with ReplacePages ?
Corwin - Tracker Sup
User
Posts: 664
Joined: Tue Nov 14, 2006 12:23 pm

Re: Extract selected pages

Post by Corwin - Tracker Sup »

Nope. For now Viewer dosn't have functionality for ReplacePages..
Rad1
User
Posts: 108
Joined: Wed May 13, 2009 2:21 pm

Re: Extract selected pages

Post by Rad1 »

ok, I hope that will be available for the next releases. ( it is not realy necessary for our product, but it can be a funny function to add in).
johnnyjoe
User
Posts: 35
Joined: Thu Nov 26, 2009 3:14 am

Re: Extract selected pages

Post by johnnyjoe »

Is it available to insertpage by using VB via code?
Corwin - Tracker Sup
User
Posts: 664
Joined: Tue Nov 14, 2006 12:23 pm

Re: Extract selected pages

Post by Corwin - Tracker Sup »

Yes, please see "Objects::Documents::<Item>::InsertPages" section in PDF-XChange Viewer ActiveX SDK Help file.
johnnyjoe
User
Posts: 35
Joined: Thu Nov 26, 2009 3:14 am

Re: Extract selected pages

Post by johnnyjoe »

It's only insert before page and specify how many page from the file we want.

How about insert to last page
How about based on thumbnail, which i select i want it insertafter.

Can it be done?
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2448
Joined: Thu Jun 30, 2005 4:11 pm

Re: Extract selected pages

Post by Vasyl - PDF-XChange »

Hi johnnyjoe.
For insert pages after last page you should specify:

Code: Select all

SetProperty("Operations.InsertPages.InsertBefore", <PagesCount>, 0);
That is, if target document contains 5 pages then:

Code: Select all

SetProperty("Operations.InsertPages.InsertBefore", 5, 0);
Best
Regards.
PDF-XChange Co. LTD (Project Developer)

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
johnnyjoe
User
Posts: 35
Joined: Thu Nov 26, 2009 3:14 am

Re: Extract selected pages

Post by johnnyjoe »

How i able to detect which page is selected in Thumbnail via code?
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2448
Joined: Thu Jun 30, 2005 4:11 pm

Re: Extract selected pages

Post by Vasyl - PDF-XChange »

Hi, johnnyjoe.

No way for this in current realization. :(
Will be in the new version..

Best
Regards.
PDF-XChange Co. LTD (Project Developer)

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
johnnyjoe
User
Posts: 35
Joined: Thu Nov 26, 2009 3:14 am

Re: Extract selected pages

Post by johnnyjoe »

When will the new realease will be available?

How about can i able to know the page number of the current viewed document in the viewer?
I know how to get the total page of the document.

What i want to do was:
I able to go via code go to First Page, Next page, Previous page, Last Page.
User avatar
Chris - PDF-XChange
Site Admin
Posts: 798
Joined: Tue Apr 14, 2009 11:33 pm

Re: Extract selected pages

Post by Chris - PDF-XChange »

Hi Johnnyjoe,

Please refer to page 111 of the Viewer ActiveX SDK
topic 2.2.2.10.1.2 Pages

Regards
Chris
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.


Chris Attrell
Tracker Sales & Support North America
http://www.tracker-software.com