Planet PDF Forum Archive

Planet PDF ForumThe page you are viewing is part of our 160,000 page PDF discussion forum archive spanning 1999-2008. Would you believe we have a 2nd forum archive which covers 2008 - 2011? But... if you really want to bust-a-move head to the LIVE Planet PDF Forum. It features more than 10 conferences, covering everything from beginner discussions to in-depth developer and pre-press discussions.


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

LockLizard Safeguard PDF Security

Made specifically for publishers of high value information published in PDF format, it protects your PDF...

Download free demo

ARTS PDF Aerialist X

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

Download free demo

Ubiquitous PDF: DIY PDF magazines, courtesy of CNET and Magazinify

Thanks to Magazinify.com, it's possible to have web articles delivered right to your inbox in PDF form. If that weren't enough, the nice folks at CNET have been nice enough to publish a step-by-step guide about how to set this all up using just a little time and a free Magazinify account.

September 06, 2011
Search Planet PDF
more searching options...
PDF Resources
Platinum Sponsor

ARTS PDF

Create & Edit PDF - Nitro PDF Software

Silver Sponsors

LockLizard DRM PDF Security Quick PDF Library: The Unrivaled PDF Developer Toolkit

Featured Product

ARTS PDF Crackerjack X

The most popular Acrobat plug-in for PDF-based color print production and automation.

Featured Event

Adobe Digital Marketing Summit

March 20-23, 2012 -- Salt Palace Convention Center, Salt Lake City, Utah

The Digital Marketing Summit is the premier event for digital marketers and advertisers to learn about and share key strategies for driving marketing innovation. Attend Summit to learn how you can create, measure, and optimize digital experiences to revolutionize how the world engages with ideas and information.

PDF Store Categories