Planet PDF Forum Archive

Planet PDF ForumWowsers! This is page is old, head to the LIVE Planet PDF Forum. It features more than 10 conferences, covering everything from beginner to in-depth developer and pre-press discussions. If you wish to continue... one & two archive covers 1999-2011 (160,000 pages).


New Forum | Previous | Next | (P-PDF) Developers


Topic: Put bookmark into extracted pages to folder. (Via Email), 1 Attachments
Conf: (P-PDF) Developers, Msg: 142842
From: chopinmadison
Date: 11/17/2005 02:18 AM

I have a pdf that has multiple pages and a bookmark for each page. I want to read the bookmarks into an array to save the names, then use this.extractPages to separated each page into a new document. I need to put the name of each bookmark into the new name of each new pdf.

I get the following errors:
Exception in line 41 of function top_level, script Batch:Exec
Aborted: NotAllowedError: Security settings prevent access to this property or method.

I know I am reading the bookmark names into the array, but extra characters are added. I get : [object Bookmark="CORP ID: 071100"] into the array, but the bookmark name is CORP ID: 071100.

My code is below and attached. Anyone have a suggestion?

David Reese

/* Gather Bookmarks into an Array */
// 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,"");
// Page2 is the parameter for nEnd
var Page2 = 0;
//Define corp name space.
var Corp;
// Define the array
if ( typeof global.bmArray == "undefined" )
{
global.bmArray = new Array();
}
//Load the array with the bookmarks.
{
for ( var i = 0; i < this.bookmarkRoot.children.length; i++)
global.bmArray[i] = this.bookmarkRoot.children[i];
//Sample of what is loaded in to the array - [object Bookmark="CORP ID: 071100"]
}

console.clear();
console.show();
console.println("Show all bookmarks in the document.");
//Show what is in the array
{
for ( var i = 0; i < this.bookmarkRoot.children.length; i++)
console.println(global.bmArray[i]);
}
/* Extract Pages to Folder */
try
{
for ( var i = 0; i < this.numPages; i ++)
{
Page2 = i;
Corp = global.bmArray[i];
this.extractPages
({
nStart: i,
nEnd: Page2,
cPath: "/O/SQLInOut/Client_Data_Services/"+"Nme_"+Corp+i+".pdf"
});
}
}
catch (e) { console.println("Aborted: " + e)
console.println("Current File: " + this.path);
event.rc = false;
delete global.counter;
}


Click to open!bookmarks_to_form.js
(1,514 bytes)


PDF In-Depth Free Product Trials Ubiquitous PDF

Debenu Aerialist

The ultimate plug-in for Adobe Acrobat. Advanced splitting, merging, stamping, bookmarking, and link...

Download free demo

Debenu PDF Tools Pro

It's simple to use and will let you preview and edit PDF files, it's a Windows application that makes...

Download free demo

Back to the past, 15 years ago! Open Publish 2002

Looking back to 2002, it's amazing how much of the prediction became a reality. Take a read and see what you think!

September 14, 2017
Platinum Sponsor





Search Planet PDF
more searching options...
Planet PDF Newsletter
Most Popular Articles
Featured Product

Debenu PDF Aerialist

The ultimate plug-in for Adobe Acrobat. Advanced splitting, merging, stamping, bookmarking, and link control. Take Acrobat to the next level.

Features

Adding a PDF Stamp Comment

OK, so you want to stamp your document. Maybe you need to give reviewers some advice about the document's status or sensitivity. This tip from author Ted Padova demonstrates how to add stamps with the Stamp Tool along with related comments.