RTTSoftware Support Forum
PDF Explorer => General => Topic started by: Padanges on September 05, 2016, 08:55:20 AM
-
Hi,
can we call Extract/Merge Tools in custom scripts with predefined parameters (i.e., requiring no user input dialogs)? For example, I want a custom script which would take selected file entries and extract specific pages from them all, then combine all the pages into one single document. How can I do that using custom scripts?
Thanks in advance
-
You can do it with the IDocumentMerger object (http://www.rttsoftware.com/Manuals/Index.htm?pageURL=PDFE/English/MyScriptsAPI.htm#IDocumentMerger).
Some practical examples (http://www.rttsoftware.com/forum/index.php?action=search2;params=eJwtzL0OwjAMBOB3YWHx0PArZlh5hih1ThSUxsh1i5Dy8CSo291n60JcQmbEsi1d2ZReW9rRnk50oCOd6UKuI-fqbRrk41nGd4KhfjWa-xfYvOT0XUXUalIk_IdX8vGplSMmboKgPNR-VQTDTXgeke0OfUB_zMA2Ig..) in the forum.
-
Thanks, that will help. But how do I extract pages? Is there some sort of IDocumentExtractor object?
-
You don't need to extract the page in order to merge it into a new document.
var Merger = pdfe.CreateDocumentMerger();
Merger.MergeDocument(pdfe.SelectedFiles(0).Filename,'1,5-2');
Merger.MergeDocument(pdfe.SelectedFiles(1).Filename,'5');
var page=pdfe.SelectedFiles(2).pages(5);
Merger.MergePage(page);
Merger.EndAndSaveTo('C:\\PDFs\\MyPagesSelection.pdf');