Planet PDF Forum Archive

Planet PDF  ForumThe page you are viewing is part of our 160,000 page discussion forum archive. See below for PDF-related discussions spanning 1999-2008. To ask questions and get help, head to the live Planet PDF Forum.


How to search this archive. The quickest way is to use the filters on our Advanced Search page so that only archive pages are included in the results.


Previous | Next | (P-PDF) JavaScript


Topic: appOpenDoc Question
Conf: (P-PDF) JavaScript, Msg: 80961
From: klgc
Date: 2/6/2003 12:33 PM

Sorry to take so long to get back to you - I was in the middle of working on a linking problem. I think the results will answer your questions also. So first take a look at the forum thread:

http://www.adobeforums.com/cgi-bin/webx?128@116.MjcDa3cwDVf.3@.1de7ab0d

If you open more than one PDF at a time in a single execution of Acrobat, you are going to have a window for each (just as many applications function). When you close a PDF, its window is gone.

What you do and when you do it is important in JavaScript as the various guides caution. My problem was getting script actions in the right places for smooth linkage transitions.

Besides what is discussed in the above forum thread, the resulting JavaScript I settled on follows:
(you can remove the lines noted as trace)

//=========================================
// from Doc to Link JS action
//=========================================
global.ALtoDoc = "VLtestB.pdf";
global.ALtoDest = "Lvl2LT.indd:B1"; // *** set when link created B1,B2 or B3 ***
global.ALfromDoc = this.path;
global.ALfromPage = this.pageNum;
console.println ("\n LINK from=" + (/\w+\.pdf$/.exec(global.ALfromDoc)) + // trace
" page=A" + (global.ALfromPage + 1)); // trace
console.println ("\n to=" + global.ALtoDoc + " dest=" + // trace
global.ALtoDest); // trace
global.ALtoDoc = global.ALfromDoc.replace(/\w+\.pdf$/, global.ALtoDoc);
global.LinkVariable = true;
app.openInPlace = true;
app.openDoc (global.ALtoDoc);
//=========================================
// to Doc return link JS action
//=========================================
console.println ("\n*** RETURN from page B" + ((this.pageNum) + 1) + // trace
" To=" + (/\w+\.pdf$/.exec(global.ALfromDoc)) + // trace
" page=A" + (global.ALfromPage + 1)); // trace
global.LinkVariable = false;
app.openInPlace = true;
app.openDoc (global.ALfromDoc);
//=========================================
// Common Doc First Page Open JS action
//=========================================
if (global.LinkVariable)
{
//=========================================
// to Doc First Page Open JS action
//=========================================
console.println ("\n*** Doc B first page open JS ***"); // trace
if (typeof global.ALtoDest != "undefined")
{
var Docs = app.activeDocs; // trace
for (var i = 0; i < Docs.length; i++) // trace
{ // trace
console.println ("\nActive Doc[" + i + "]=" + // trace
(/\w+\.pdf$/.exec(Docs[i].path))); // trace
} // trace
this.gotoNamedDest(global.ALtoDest);
delete global.ALtoDest;
var Docs = app.activeDocs;
for (var i = 0; i < Docs.length; i++)
{
if (Docs[i].path == global.ALfromDoc)
{
console.println ("\nActive Doc[" + i + "]=" + // trace
(/\w+\.pdf$/.exec(Docs[i].path)) + " closed"); // trace
Docs[i].closeDoc(true);
break;
}
}
}
}
else
{
//=========================================
// from Doc First Page Open JS action
//=========================================
console.println ("\n*** Doc A first page open JS ***"); // trace
if (typeof global.ALfromPage != "undefined")
{
var Docs = app.activeDocs; // trace
for (var i = 0; i < Docs.length; i++) // trace
{ // trace
console.println ("\nActive Doc[" + i + "]=" + // trace
(/\w+\.pdf$/.exec(Docs[i].path))); // trace
} // trace
this.pageNum = global.ALfromPage;
delete global.ALfromPage;
var Docs = app.activeDocs;
for (var i = 0; i < Docs.length; i++)
{
if (Docs[i].path == global.ALtoDoc)
{
console.println ("\nActive Doc[" + i + "]=" + // trace
(/\w+\.pdf$/.exec(Docs[i].path)) + " closed"); // trace
Docs[i].closeDoc(true);
break;
}
}
}
}
//=========================================
// COMMON DOCUMENT LEVEL JAVASCRIPT
//=========================================
try
{
console.println ("\n*** Common Doc level JS ***"); // trace
if (typeof global.intOpen == "undefined")
{
console.println ("\n*** Initial Doc Open ***"); // trace
global.intOpen = false;
global.LinkVariable = false;
if (app.viewerVersion < 5.05 )
{
throw "Test environment: Acrobat 5.0.5 or Acrobat Reader 5.1";
}
}
app.focusRect = false; // Turn off focus rectangle
app.fs.backgroundColor = color.black; // background color black
app.fs.clickAdvances = false; // no page advance
app.fs.cursor = cursor.visible; // keep cursor visible
app.fs.defaultTransition = "Replace"; // Dissolve page transition
app.fs.escapeExits = true; // Escape exits full screen
app.fs.useTimer = false; // No page timed advance
app.fs.isFullScreen = true; // View full screen
this.layout = "SinglePage"; // Single page layout
this.zoomType = zoomtype.fitP; // Fit page to window
this.disclosed = true;
}
catch (e)
{
app.e, 0);
app.execMenuItem ("Close");
event.rc = false;
}
//=========================================

Hope this helps with your problem.

Regards,
Lee C


PDF In-Depth Free Product Trials Ubiquitous PDF

Pitstop Pro

Now graphic arts professionals have even broader and more expert control over their PDF documents. With...

Download free demo

ARTS PDF Aerialist

The ultimate plug-in for Adobe Acrobat and #1 selling product at PDF Store. Advanced splitting, merging,...

Download free demo

Ubiquitous PDF: 2009 IRS income tax forms available for download

With less than a month to go until Americans will be scrambling to file their 2009 tax paperwork. Luckily, printable PDF versions of forms such as the 1040 can be downloaded for free from the IRS website.

March 18, 2010
Search Planet PDF
more searching options...







Download PDF Creator

PDF Resources
Platinum Sponsor
Create & Edit PDF - Nitro PDF Software

ARTS PDF

Silver Sponsors

PDF-Tools QuickPDF: The Unrivaled PDF Developer Toolkit

Get Nitro PDF Professional
Featured Product

NITRO PDF Professional

Built from the ground up, the perfect desktop PDF product for business and enterprise. Nitro PDF Professional has an uncompromising feature set so you can create, combine, edit, collaborate on and...

Featured Event

No upcoming events

PDF Store Categories