100% found this document useful (1 vote)
4 views

Beginning JavaScript for Adobe Acrobat A non programmer s Guide John Deubert download

The document is a guide titled 'Beginning JavaScript for Adobe Acrobat' by John Deubert, aimed at non-programmers looking to enhance their skills in creating Acrobat forms using JavaScript. It covers various topics including form field validation, dynamic controls, and database interaction, providing step-by-step instructions for implementing features in Acrobat. The book is designed for users with some experience in Acrobat but little to no programming background, and it includes resources for further learning and sample files for practice.

Uploaded by

eshanicorpus
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
4 views

Beginning JavaScript for Adobe Acrobat A non programmer s Guide John Deubert download

The document is a guide titled 'Beginning JavaScript for Adobe Acrobat' by John Deubert, aimed at non-programmers looking to enhance their skills in creating Acrobat forms using JavaScript. It covers various topics including form field validation, dynamic controls, and database interaction, providing step-by-step instructions for implementing features in Acrobat. The book is designed for users with some experience in Acrobat but little to no programming background, and it includes resources for further learning and sample files for practice.

Uploaded by

eshanicorpus
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 63

Beginning JavaScript for Adobe Acrobat A non

programmer s Guide John Deubert pdf download

https://ebookname.com/product/beginning-javascript-for-adobe-
acrobat-a-non-programmer-s-guide-john-deubert/

Get Instant Ebook Downloads – Browse at https://ebookname.com


Instant digital products (PDF, ePub, MOBI) available
Download now and explore formats that suit you...

Adobe Acrobat 8 for Windows and Macintosh Visual


QuickStart Guide 1st Edition John Deubert

https://ebookname.com/product/adobe-acrobat-8-for-windows-and-
macintosh-visual-quickstart-guide-1st-edition-john-deubert/

Ivor Horton s Beginning Visual C 2010 Wrox Programmer


to Programmer 1st Edition Ivor Horton

https://ebookname.com/product/ivor-horton-s-beginning-
visual-c-2010-wrox-programmer-to-programmer-1st-edition-ivor-
horton/

Learning JavaScript Design Patterns A JavaScript and


React Developer s Guide 2nd Edition Adnan Osmani

https://ebookname.com/product/learning-javascript-design-
patterns-a-javascript-and-react-developer-s-guide-2nd-edition-
adnan-osmani/

Fundamentals of Healthcare Finance 1st Edition Louis C.


Gapenski

https://ebookname.com/product/fundamentals-of-healthcare-
finance-1st-edition-louis-c-gapenski/
Essentials of Business Communication Book Only Eighth
Edition Mary Ellen Guffey

https://ebookname.com/product/essentials-of-business-
communication-book-only-eighth-edition-mary-ellen-guffey/

Funny Pictures Animation and Comedy in Studio Era


Hollywood 1st Edition Daniel Goldmark

https://ebookname.com/product/funny-pictures-animation-and-
comedy-in-studio-era-hollywood-1st-edition-daniel-goldmark/

Indigenous Peoples and Ethnic Minorities of Pakistan


Constitutional and Legal Perspectives 1st Edition
Shaheen Sardar Ali

https://ebookname.com/product/indigenous-peoples-and-ethnic-
minorities-of-pakistan-constitutional-and-legal-perspectives-1st-
edition-shaheen-sardar-ali/

The Dixon Rule 1st Edition Elle Kennedy

https://ebookname.com/product/the-dixon-rule-1st-edition-elle-
kennedy/

Instrumentation Theory and Applications 1st Edition


Satya Sheel

https://ebookname.com/product/instrumentation-theory-and-
applications-1st-edition-satya-sheel/
Innovative drug development for headache disorders 1st
Edition Jes Olesen

https://ebookname.com/product/innovative-drug-development-for-
headache-disorders-1st-edition-jes-olesen/
switch (itemPicked) {
{
Statement.nextRow() case "See close-up":
ar row = gStatement.getRow() this.pageNum = 2
opulateFields(row) var gHelpText = [

Beginning
ostMessage("") “What’s your full name?”,
“Where do you live?”,
break
case "About the artis

JavaScript “What is it you’re hoping to do here?”,


this.pageNum = 6
break

for if (pwd == "axolotl") {


this.submitForm("http://www.langerhans.com/submit.js", false, true)

Adobe Acrobat®
app.beep()
app.alert("Your order has been submitted.")
A non-programmer’
}
s guide
else {
if (pwd != null)
app.alert("That is not the password!\n\n
¬ (Hint: it’s a small, rather repulsive amphibian.)")
}

var re7Digits = /^(\d{3})(\d{4})$/

E
var re10Digits = /^(\d{3})(\d{3})(\d{4})$/

John Deubert
if (re7Digits.test(event.value))
QDGuides
var orderInfoTemplate = this.getTempla
var addressTemplate = this.getTemplate
Quality Electronic Documentation
event.value = RegExp.$1 + "-" + RegExp.$2 from Acumen Training

else if (re10Digits.test(event.value)) –1–


QED
Dedication
For (in order of descending height) Barbara, Elizabeth, Gigi, and Julia.

Beginning JavaScript for Adobe Acrobat


John Deubert
Copyright © 2012 John Deubert

ISBN-13: 978-0-9850512-0-4
ISBN-10: 0-985-05120-5

Version 1.1

To report errors, send a note to [email protected]

Notice of Rights
All rights reserved. This book may not be redistributed to another computer.

Notice of Liability
The information in this book is distributed “as is,” without warranty. While every precaution has been taken
in the preparation of the book, the author shall not have any liability to any person or entity with respect to
any loss or damage caused or alleged to be caused directly or indireclty by the instructions contained in this
book or by the computer software and hardwre products described in it.

Trademarks
Trademarks are used throughout this book. Rather than put a trademark symbol in every occurrence of a
trademarked name, we aver that we are using the names in an editorial fashion only and to the benefit of the
trademark owner with no intention of infringement of the trademark.

Adobe Acrobat is a trademark of Adobe Systems Incorporated.

–i–
QED Beginning JavaScript for Adobe Acrobat
Table of Contents

0 Introduction iii 10 Keystroke Checking with Regular Expressions 77


In which we point you to the sample files and thank you for buying the book In which we learn how to use regular expressions to efficiently examine text.

1 Welcome to JavaScript 1 11 Field Validation with Regular Expressions 84


In which we look over the book and establish some ground rules In which we use regular expressions to validate user’s text input.

2 Page and Document JavaScripts 16 12 Formatting Text Fields with Regular Expressions 94
In which we learn the basics of creating and editing JavaScripts in Acrobat. In which we use regular expressions to automatically re-format user’s text input.

3 Form Field Highlighting 23 13 Alerts and Dialog Boxes 100


In which we learn about JavaScript variables and the On Focus and On Blur events. In which we learn to display messages to the user.

4 Checking Acrobat Version 28 14 JavaScript Functions 108


In which we learn about the if & else commands and how to display an alert. In which we learn to assign a name to frequently-used pieces of JavaScript code.

5 Calculating Form Fields 33 15 Creating Pop-up Menus 119


In which we learn how to make a form field calculate its own value. In which we learn to create pop-up menus in your forms.
6 Auto-Entering Form Data 45 16 Blinking Buttons, Spinning Stars, and Other Simple Animation 131
In which we learn how to use arrays and automatically set a field’s value. In which we learn to create animated doo-dads on your pdf pages.

7 Roll-Over Help 51 17 Interacting with Databases 141


In which we learn how to present help text to the user. In which we learn the basics of sql and how Acrobat works with databases.

8 Dynamic Form Fields 58 18 Reading and Writing a Database 154


In which we learn how to make fields appear and disappear. In which we learn to load our form fields’ contents from a database.

9 Dynamic Controls with Templates 69 19 Where to Go from Here 173


In which we learn how to use templates to make entire pages appear dynamically. In which we list some other sources of JavaScript learnin’.

–ii–
QED Chapter 0
Introduction

Welcome to Acrobat JavaScript.

You are about to open a new chapter in your work with Acrobat forms. In reading this book, you will learn
how to add features and abilities to your forms that are not otherwise possible: roll-over help, automatic text
field formatting, database connectivity, and more will all become routine parts of your form design. You will
also learn a programming language, perhaps your first: JavaScript. Even if you’ve never had a hankering to
write software and sling code, you’ll find JavaScript an important arrow in your quiver; it’s supremely useful,
relatively easy, and surprisingly fun.

Of course, you don’t need JavaScript skill to create an Acrobat form; you’ve no doubt been doing perfectly
well for quite some time without it. However, a knowledge of JavaScript adds immeasurably to your ability
to make your forms look and behave exactly as you want. JavaScript will open to you a world of possibility
whose scope is hard to overstate. Sufficient to say that the knowledge and techniques you will learn in this
book will allow your forms to take on a sophistication that is otherwise completely impossible.

If this sounds like hyperbole, think again. It’s true.

This Book

What this book is


This e-book is a non-programmer’s guide to the JavaScript programming language as used in Adobe Acrobat;
it teaches you, step-by-step, how to add specific features to your Acrobat forms and, in so doing, teaches you
about the JavaScript language.

If you are an experienced Acrobat form designer, but have never written a line of programming code in your
life (and pretty much wanted to keep it that way), then this book is written for you. Together we’ll explore
programming concepts while learning how to add features to your Acrobat forms: we discuss arrays while
creating a dynamic list of prices; we talk about case statements while creating a pop-up menu; we teach a
form to check the version of Acrobat on which it’s running and, along the way, talk about if–else constructs.

When you’re done with the book, you will be in good shape to read more formal books on JavaScript and to
make use of Adobe’s technical specification of Acrobat JavaScript.

–iii–
QED About the Book
What this book isn’t
This book is not a complete reference to the JavaScript language or to using JavaScript in Acrobat. JavaScript
is a broad and deep language and is capable of much that we don’t discuss here.

The purpose of this book is to bootstrap you to a point where you can learn the rest of the language’s
abilities on your own; it assumes you are an experienced Acrobat forms designer, but have little or no
experience with computer programming languages. If you are already comfortable with Objective C, Java, or
other programming language, this book will be paced too slowly for you; you should go directly to Adobe’s
Acrobat JavaScript Object Specification.

Also, this book does not teach you how to make form fields and other components of Acrobat forms;
I assume you have reasonable experience with the mechanics of designing and creating forms.

Mac or Windows?
With one exception the examples in this book will work with either the Macintosh or Windows version of
Adobe Acrobat. The exception is the pair of chapters on Acrobat database connectivity, which is available
only in Windows. Otherwise, the Mac and Windows versions of Acrobat work identically, except for minor
differences dialog box labelling, etc. Illustrations in this book are taken from both versions of Acrobat.

How to use this book


The first two chapters of this book present basic information and terminology and must be read before
attempting the rest. The remaining chapters are probably best read in order, since learning a programming
language is inevitably a cumulative activity. Nonetheless, Chapters 3-19 are designed so that one can usefully
read them in any order; if you need to add roll-over help to a form, feel free to skip to Chapter 7 and see
how to do it. Just don’t be surprised if you find yourself having to go back to earlier chapters to clarify
references to mysterious terminology.

Some chapters need to be read in order; for example, the discussion of regular expressions is spread across
Chapters 10, 11, and 12 and they must be read in that order to be sensible at all. Most chapters, however, are
intended to be semi-independent.

All of the chapters, however, assume you have read Chapters 1 and 2.

–iv–
QED About the Book
Reading the book on-screen
Being an e-book, Beginning JavaScript for Adobe Acrobat is distributed electronically; its pages are designed
to be easily read on-screen. Since it’s distributed as a self-contained pdf file, you can read the book on nearly
any computer or tablet. It turns out that the page size works particularly well on a 768x1024 screen, such as
that of the iPad; that’s probably a coincidence.

The pdf file has been “enabled” for commenting in Adobe Reader, so you should be able to make notes to
yourself on the pages in either the full Acrobat or Reader.

URL links within the book are all “live” and will open the appropriate page in your default web browser.

Printing the book


Many people (myself included) prefer to read technical tutorials on paper. To that end, feel free to print
Beginning JavaScript; it works very well printed two-up and double-sided (Figure 0.1).

Sharing the book


I’d rather you didn’t, really. Beginning JavaScipt is reasonably priced and I’m hoping to write additional books
on this and other topics. However, I do need to be able to make at least a minimal living at it. So, if your
friends or colleagues want to read the book, encourage them to buy their very own copy. They’ll feel good
about themselves.

Registering the book


E-books are similar to software; in particular, it is possible for an author to update an e-book, improving
explanations, fixing the grammar, killing typos, and eliminating flat-out errors. (This particular e-book, of
course, has neither errors nor tpyos.)

If you register your book purchase (go to www.acumentraining.com/QEDGuides/qedregister.html), you’ll Figure 0.1 This book’s page size works well printed two-up on A4 or
American Letter-size paper.
be notified whenever there is a new update for your book. It’s worth doing.

–v–
QED About the Book
Online Resources
There are two sources of information that are specifically intended to be used with this book.

Sample Files and Support


Each chapter in this book is built around one or two sample forms to which we add JavaScripts to complete the
chapter’s goals. Each sample form has two files associated with it:

■ The complete, functioning form, with all JavaScripts in place. This shows you how the form is supposed to
behave and allows you to inspect the chapter’s JavaScripts in place. This version of the form has a filename
ending with “end.”

■ A version of the form with all form fields and other elements in place, but no JavaScripts attached. Use
this version if you want to follow along while reading the chapter, writing, debugging, and executing the
JavaScripts as you go. The file for this version of the form will have a name ending in “start.”

The sample form files are available for downloading at www.acumentraining.com/QEDGuides/acrojs.html. This
web page is also where you will find errata, update information, and other useful information.
Figure 0.2 Each issue of the Acumen Journal has an Acrobat-related article; many of
these are about JavaScript usage.
Acumen Journal
The Acumen Journal (Figure 0.2) is a free periodical that I produce three or four times per year. Each issue has
an article on advanced Acrobat usage and many of these are about JavaScript. The back issues make a good
supplemental to the topics in this book; there are more than 60 issues accumulated since I began writing the
Journal back in 2000. You can download them at www.acumentraining.com/acumenjournal.html.

If you wish to be notified when a new issue of the Journal comes out, there is a link on the Acumen Journal
web page to an appropriate form.

Thank You
Finally, thank you for buying this book or looking at the sample chapters. Either way, you are participating in
an ongoing experiment in publishing.

–vi–
QED Chapter 1
Welcome to JavaScript

Periodically in life, you learn something that broadens your world immeasurably, revealing an expanse of
What We’ll Learn in this Chapter
new experience, problems, opportunities, play, and work. Whole worlds that had invisibly surrounded
In this chapter, we’ll learn:
you ­suddenly appear, providing a new space to explore. Reading, sex, driving, children, all bring with them
­concerns, interests, and interactions that had been previously inaccessible and unsuspected. ■ What’s a JavaScript?

In its own small way, learning JavaScript will be just such a threshold event in your professional life. If you’ve ■ Types of JavaScript
been working with Acrobat for any length of time, you’ve probably gotten pretty good at it and have ■ Attaching a JavaScript to a form field
­become quite comfortable at creating forms, adding music, creating slide shows, and all the other features
■ JavaScript objects, data types, and syntax
Acrobat offers.
■ JavaScript errors and the debugger
This book introduces the New World. A knowledge of JavaScript allows you to do things within Acrobat that
■ How to use your own text editor with Acrobat
far exceed what you’ve done so far: You can interface with databases; add your own pop-up menus; create
JavaScripts
forms with sophisticated, interactive interfaces; and implement form fields that can look up p ­ rices and other
data. These are only a few of the things you can do within your Acrobat documents using ­Java­Script. The
­extent to which you can manipulate your Acrobat files is vastly greater with JavaScript skills than without.

Hence, this book.

Here you will learn how to accomplish a variety of useful tasks in Acrobat using JavaScript. Along the way, you
will learn a great deal about JavaScript, programming, and Adobe Acrobat.

What You Should Know Already


This book assumes you have reasonably extensive experience in working with Acrobat and creating A ­ crobat
forms. In particular, I assume you know how to create forms in Acrobat; you should be able to create a form
field, set its properties, and assign actions to it. If you feel vaguely uneasy about any of these tasks, you may
want to run right off and buy a book on the subject (see the sidebar on the next page).

Beyond that, this book does not assume any knowledge of programming; you will learn the programming
skills you need as we proceed through our examples.

Again, this book is intended for programming novices; if you are an experienced programmer, you may it to
be paced slower than you’d like. Experienced programmers may do better to just go to a more-advanced
book to learn JavaScript (there are myriad such books, though they all teach JavaScript in the context of web
pages) and then look at Adobe’s JavaScript reference site to see how to apply it to Acrobat.

–1–
QED 1. Welcome to JavaScript
What Version of Acrobat Should You Have? Books on Acrobat Forms
Although this e-book presumes you are working with Acrobat XI, the current version, it works equally well Although there are a number of books that will teach you how
with Acrobat X, whose interface is nearly identical. The instructions we step through will nearly all apply to to create Acrobat forms., most of them are out of print. The only
Acrobat 9, as well. Where there is a large difference in Acrobat 9, I’ll provide a note on what you should do extant book is:
in the earlier software. • PDF Forms Using Acrobat and LiveCycle Designer Bible
Ted Padova and Angie Okamoto
What Is JavaScript? Ted Padova is the king of the “Bible” style books and this
volume shows why.
JavaScript is a programming language. The term “programming language” often induces jitters in n­ ewcomers,
but, conceptually, it’s not very scary: A programming language is a language that is used to describe the There are other books specific to Acrobat forms that, though
steps involved in carrying out some task. In Acrobat, these tasks include moving to a particular page of a out of print, are still available if you look around. In particular, my
own old book is still available, though it’s getting pretty long in
­document, sending data to a database, and calculating a form field value. Carrying out the steps described
the tooth, I admit:
by a ­JavaScript is referred to as executing the program.
• Creating Forms in Adobe Acrobat – John Deubert
As a programming language, JavaScript’s most significant characteristic is that it’s simple enough that many
Finally, any reasonably complete book on Adobe Acrobat will
­applications use it as their built-in scripting language. Web browsers can all interpret JavaScripts embedded
have at least a chapter or two on creating forms. This includes my
in Web pages, and, particular to our topic, Acrobat can execute JavaScripts attached to form fields, pages,
own book:
and pdf files.
• Adobe Acrobat X: Visual Quickstart Guide – John Deubert
Like any language, JavaScript has its own vocabulary (words that have meaning) and syntax (rules by which
• Acrobat X Classroom in a Book – Adobe Creative Team
you make statements with those words). Learning JavaScript, therefore, has much in common with learning a
human language, such as Spanish or German, only it’s much easier. JavaScript is vastly simpler than any human • Acrobat X PDF Bible – Ted Padova
language: there are no metaphors, no literally nonsensical idioms, no synonyms, no subtle shades of ­meaning. These are all available through Amazon.com, as is pretty much
Just very precise statements telling Acrobat to do something very specific. everything in the world.

JavaScript in Acrobat
Acrobat allows you to create five different kinds of JavaScripts:

■ Form Field JavaScripts are attached to form fields. Acrobat executes the script when a particular event
occurs in that form field, such as a button click. Most JavaScripts in Acrobat are attached to form fields.

■ Page JavaScripts are executed when the user moves to or leaves a particular page in the Acrobat ­document.

■ Document JavaScripts are executed when the Acrobat Document opens.

■ Document Action JavaScripts are executed user opens, closes, saves, or prints a document.

■ Application JavaScripts are executed when Acrobat launches.

–2–
QED 1. Welcome to JavaScript
We shall talk about Page, Document, and Document Action JavaScripts in Chapter 2; we won’t be discussing
application JavaScripts at all in this book. For now, let’s look at how you type in and use a Form Field JavaScript.

Our First JavaScript


Let’s start exploring our new world by adding a simple JavaScript to the button in Figure 1.1.

This form consists of a set of flash cards that are intended to be printed double-sided and then used to quiz
students on vocabulary terms. Our pdf file has only a few flash cards; each card has a button that takes u­ sers
to an order form they can use to purchase the complete set of cards. We are going to add a JavaScript to
the Order Form button that takes the user to the order form, located on the last page of the Acrobat file
(­Figure 1.2).

As will be true throughout this book, there are two versions of this form on the JavaScript for Acrobat web page:

■ JSAcro_Ch01_Example_Final.pdf is the full form, complete with all relevant JavaScripts.


Figure 1.1 We’re going to add a JavaScript to the “Order
■ JSAcro_Ch01_Example_Start.pdf, the “raw” version, lacks the chapter’s JavaScripts so that you may type in Form” ­button in this form.
the ­Java­Script yourself if you wish.

These are available at www.acumentraining.com/QEDGuides/acrojs.html.

Figure 1.2 The Order Form button’s Java­Script will move


the user to the pdf file’s final page, which is the order form.

Where Do the Sample Files Live?


Remember that all of the sample files in this eBook are available
at www.acumentraining.com/QEDGuides/acrojs.html.

–3–
QED 1. Welcome to JavaScript
Attaching a JavaScript to a Form Field
As a reminder of something you may already know, let’s step through the process of attaching a Java­Script to
a button, in this case our Order Form button.
Figure 1.3 Enter Form Editor mode by
To attach a JavaScript to a button: clicking the Edit button in the Forms

x Note
panel.
Start with the form open in Adobe Acrobat and the Tools
pane exposed. Acrobat 9 doesn’t have a Tools pane, but
it does have a Forms menu. To get to the Form
1 In the Tools pane’s Forms panel, click on the Edit tool Editor, select Forms > Add or Edit Fields. Having
(Figure 1.3). done this, you can follow the steps exactly as listed.

Acrobat will enter Form Editor mode, displaying all of the


form fields on the current page as a set of r­ ectangles and replacing the usual three Tasks panes with
a single Forms pane (Figure 1.4). Note in the fi­ gure that our form has only one field on its first page, a
pushbutton field with the name ­btnOrderForm.

2 Double-click the Order Form button.

Acrobat will present you with the Field Properties dialog box (Figure 1.5). Figure 1.4 Acrobat’s Form Editor mode gives you a Forms pane, new
­toolbars, and presents each form field as a rectangle with handles..
3 Click on the Actions tab.

You will now be looking at the set of controls that specify what
should happen when you click on this ­button (Figure 1.6).

4 In the Select Trigger pop-up menu, select Mouse Up.

This tells Acrobat that this button’s action should trigger when
the mouse button is released after clicking in the b­ utton. (See
the sidebar, at right.)

5 In the Select Action pop-up menu, select Run a ­Java­Script and


then click the Add button.
Figure 1.5 Double-clicking on the ­button yields the Button
Acrobat will present you with the JavaScript Editor, a dialog ­Properties dialog box.
box with a simple text editor (­Figure 1.7 , next page). This is
where you type in the JavaScript that should be associated with the Order Form button.
Figure 1.6 The Actions tab of the Button Properties dialog box is where
we specify what should happen when the user clicks our button.

–4–
QED 1. Welcome to JavaScript
6 Type your JavaScript into the text field of this dialog box. Form Field Events
In the case of our order form, the JavaScript is a two-line The Select Trigger pop-up menu, shown in Figure
­program that moves the user’s view of the document to 1.6, offers six form field events to which you can
the page containing the order form and then causes the ­attach an action:
user’s computer to beep: ■ Mouse Down occurs when the user presses the
mouse button with the pointer in the form field.
this.pageNum = 6
app.beep() ■ Mouse Up occurs when the user clicks on the
field and then releases the mouse button with
Type these lines into the text-editing field exactly as the mouse pointer still in the field.
above, making sure to match upper and lowercase. The Figure 1.7 The JavaScript Editor window is a simple text editor that you
first line of code says, “In this document, set the ­current ■ Mouse Enter occurs when the mouse pointer
will use to type in your JavaScripts.
first rolls over the form field.
page number to 6.” The second line tells the Acrobat
­application to beep. ■ Mouse Exit occurs when the mouse pointer rolls
out of the form field.
7 Click the ok button of the JavaScript Editor and the Close
■ On Focus occurs when the user clicks on or tabs
button of the Field Properties dialog box to return to the
into the form field, so that it becomes the target
Acrobat form.
for keyboard or other input.
You are now looking at the Acrobat flash card page with ■ On Blur occurs when the user tabs out of a form
the Form tool still selected, as in Figure 1.4. field or clicks on some other form field, so that
our field is no longer the target for user input.
8 Exit the Form Editor by clicking the Close Form Editing (Blur is the opposite of Focus, of course.)
button in the Forms pane (Figure 1.8).
The Field Properties dialog box, Figure 1.6, lets you
You are now back where you started, looking at your associate one or more A ­ ctions (a ­­­Java­Script action,
Figure 1.8 You exit the Form Editor by clicking Close Form Editing button.
document page. in our case) with any of these events.
This button is in the Forms pane in Acrobat X (above right) and above the
pane in the newer Acrobat XI (above left).
So, now try it out. Click the Order Form button, and Acrobat
will move to the order form page and then beep.

JavaScript Objects
Our two-line JavaScript makes use of two JavaScript objects. A JavaScript object is the representation of some
piece of data within your JavaScript program. Before your program can manipulate or examine a form field, it
must first create an object that represents that field. Most of the things you can manipulate in ­JavaScript (pages,
signatures, database connections, and so on) are represented in your program as objects.

In our sample program, this refers to a Doc object. A Doc object represents an open Acrobat file to your
JavaScript program; you use this object to change pages, save the document, and otherwise manipulate the

–5–
QED 1. Welcome to JavaScript
document from within your program. The word this in our sample JavaScript refers particularly to the A ­ crobat
document in which our JavaScript resides (the Flash Cards file, in our case); think of it as short for this document.

The word app is an App object, a reference to the Acrobat application being used to view the current
­document. You use an App object to tell the Acrobat application to do something: open a file, put up an
alert dialog box, or, in our case, beep.

Commonly used JavaScript object types include:

■ Annot represents an annotation (for example, a “sticky note”) in the current document.

■ App represents the Acrobat application being used to view the current document.

■ Connection represents a connection to an external database.

■ Doc represents an open Acrobat document.

■ Field represents a form field.

■ Sound represents a sound embedded in the current document.


Data Types
Object properties
The Data Type column of Table 1.1 lists the type of ­information
JavaScript objects are analogous to physical objects in the world around us, such as books, vases, and dogs. associated with each of the properties it lists. Computer
Every real-world object possesses a set of characteristics that define it (such as, for a dog, color, tail length, ­programming, including JavaScript, uses special terms to p­ recisely
and number of fleas). describe types of data. Here are the terms commonly used in
JavaScript:
The characteristics of a JavaScript object are referred to as that object’s properties. These are elements of an ■ Integer is a whole number, such as 1, 2, 87, or -6293.
object that our JavaScript programs can examine and change as needed. Each type of object has a set of
properties that characterize it; for example, Doc objects have, among other things, a title, a current page ■ Floating Point is a number with a fractional part, such as 1.7,
-842.9011, 1024.0. Note that the fractional part may be zero, as
number, an author, and a number of pages (see Table 1.1).
in 1024.0; in this case, the floating point number has the same
Table 1.1 Document Object Properties (Partial) value as an integer, though internally it is still a floating point
number. Floating point numbers are often referred to as “floats.”
Property Data Type Description
author String The person who wrote the document ■ Boolean is an entity that can have two values: true or false.
Boolean data are used to describe characteristics that can
fileSize Integer The size of the PDF file, in bytes
have only two states. (For example, the spayed property in
numPages Integer The number of pages in the document
our dog object is a Boolean value; a dog either is or isn’t.)
pageNum Integer The page number currently visible to the user
■ String is text, that is, a “string of characters.”
title String The name of the document.

–6–
QED 1. Welcome to JavaScript
The phrase this.pageNum addresses the pageNum property of the Document object; this property is the “Program” vs. “Script” vs. “Code”
page number the document is currently displaying to the user. Our program moves the user to the ­order
Here are three closely related terms that we’ll be using
form page by setting the current document’s pageNum property to the order form’s page number:
throughout this book.
this.pageNum = 6
■ A program is a general term for a series of instructions that
Some observations about this page number assignment: tell a computer in detail how to carry out a particular task. In
general, a program is a stand-alone set of instructions, such as
■ You address the property of an object by naming both the object and the property, joined by a period: an ­application.

object-name.property-name ■ A script is a program that is intended to manipulate and run


within another program. JavaScript is a scripting l­anguage,
■ The equal sign in the line of code above is an assignment command; it sets the value of something. In our ­because you use it to control the behavior of another
case, it sets the current document’s page number to 6. ­program, such as Acrobat or FireFox.

■ Code is the term applied to the set of instructions that


■ JavaScript is case-sensitive. Upper- and lowercases are distinct; our program would have failed if we had
make up a program. Your JavaScript program is made up of
typed This.PageNum.
­JavaScript code.
■ Acrobat internally numbers a document’s pages starting at zero; the seven pages in our Acrobat file are
numbered zero through six. Thus, when our JavaScript set the pageNum property to 6, it was moving us to
the last page in the document.

Object methods
A method is a command that is associated with a JavaScript object. Just as a dog can be given commands
(“Sit,” “Heel,” “Spit that out this instant!”), JavaScript objects have commands that they can carry out. The set of
commands is different for each type of object. For example, Table 1.2 lists some of the commands the app
object knows how to execute.

Table 1.2 App Object Methods


Method Arguments Description
beep Play the system’s “beep” sound
alert String Put up an alert dialog box with the specified text
goBack Go to the previous view
goForward Go to the next view
newDoc Open a new, blank Acrobat document
openDoc String Open an Acrobat file. The string argument
­contains the name of the file

–7–
QED 1. Welcome to JavaScript
In our Order Form JavaScript, we executed (“called”) the app object’s beep method:
app.beep()

Note that we call an object’s method in the same way that we refer to one of its properties: the object
name, a “dot,” and the method name. The method name is followed by parentheses enclosing the method’s
arguments; let’s talk about what those are.

Arguments and Return Values


Some methods need additional information in order to carry out their task; for example, the openDoc
­method listed in Table 1.2 needs to know the name of the file you want to open. Information handed to a
method is called an “argument” to that method. The openDoc method takes a filename as its argument; this
information, surrounded by parentheses, must follow the method name. An invocation of openDoc looks
something like this:
app.openDoc("TermPaper.pdf")

The above JavaScript statement would open an Acrobat file named TermPaper.pdf. Note that our earlier call
to app.beep had empty parentheses because the method doesn’t take any arguments; you still need the
parentheses, though.

Sometimes when you give a dog a command, you expect the dog to give you something back: the ­command,
“Fetch the stick, boy!” should yield a stick in your hand (along with some gratuitous drool). S­ imilarly, many
JavaScript methods have a return value, some piece of data they give back to the JavaScript program.
The openDoc method we invoked above actually returns a Doc object representing the newly opened
­document, though our single-line use of ­openDoc just ignores it. We shall look at return values in much more
detail in the next chapter.

Named Arguments
Generally, you must supply arguments to a method in a certain order; the app object’s alert method, which
we’ll talk about in detail in the next chapter, wants a string and an icon code:
app.alert("Woah! Somethin' weird just happened!",2)

The string and the integer must be supplied in that order so that JavaScript can identify them.

However, you can also pass arguments to a method by name. The Acrobat JavaScript Guide (described at the
end of this chapter) defines a name associated with each of the arguments a method requires; in the case of
app.alert, the names are cMsg and nIcon.

–8–
QED 1. Welcome to JavaScript
You can supply these arguments, in any order, using the following call to the method:
app.alert({cIcon: 2, cMsg:"Woah! Somethin' weird just happened" })

Note that we have braces within the method’s parentheses and within those we have our method arguments.
Each argument is represented by the name of the argument, a colon, and then the argument’s value; the
arguments are separated by commas.

This is not as concise as passing the arguments by position, but it is clearer as to the purpose of each of the
arguments. (Our first call to app.alert, for example, gives no clue to the purpose of the 2.) Also, passing
arguments by name give you great flexibility in formatting your code. In particular, you can place line breaks
within the argument list and supply the arguments in any order; our previous example could have been written
app.alert({ cIcon: 2,
cMsg: "Woah! Somethin' weird just happened" })

In this book, we shall pass arguments by position; we’ll use argument names only when it’s necessary—usually
for clarity—to a particular JavaScript example. I shall, however, often supply the names of the arguments when
describing methods so that you can use them if you wish.

Usually, there’s no overwhelming reason to do so.

JavaScript Program Syntax


Here we must discuss a couple of short topics regarding how JavaScript commands are put together into a program.

JavaScript Statements
A JavaScript program—any computer program—consists of a series of statements, each of which carries out
one step in the overall task. Our sample program consists of two statements: a page assignment and a call to
the app object’s beep method.
this.pageNum = 6
app.beep

Usually, each line within a JavaScript program will contain a single JavaScript statement, as in our program. You
can put more than one statement on a line, separated by semicolons. Our two-line program could have been
written on a single line:
this.pageNum = 6; app.beep

–9–
QED 1. Welcome to JavaScript
Why would you do this? Purely for esthetics; some people just prefer to combine very simple statements
­together. I recommend against this practice; most programs are much easier to read if you have only one
statement per line.

If you read other people’s JavaScripts, you may notice that many programmers put semicolons at the end of
every line in their program:
this.pageNum = 6;
app.beep;

This doesn’t hurt anything, but it’s unnecessary. Most of them do it out of habit; JavaScript looks very much
like the programming languages C and C++, both of which require that all statements end with s­ emicolons.
You can leave out the semicolons.

JavaScript Text
JavaScript programs are simply text files; you can write them with any text editor or word processor and then
copy and paste them into the Acrobat JavaScript Editor dialog box. In fact, ­Acrobat lets you specify an e­ xternal
editor that should be used for editing your JavaScripts; we’ll discuss how to do this at the end of the chapter.

By the way, space and tab characters within a JavaScript line have no particular meaning in JavaScript. You can
use them as you wish to format your program. This is a purely visual issue; you want to format your Java­Script
code so that it’s easy to read.

Use whitespace characters lavishly! Reading program code is tedious at best; a program can be nearly
­undecipherable if the programmer has not formatted the code for easy reading. This is an important enough
issue that I shall be providing formatting tips for many of the JavaScript constructs we use in this book.

JavaScript Comments
JavaScript code can be pretty cryptic. Puzzling over someone else’s code (or even your own code from six
months ago), trying to figure out exactly what it’s trying to do, can be tedious. As a courtesy to others looking
at your code and as an aid to your future self, it is very important to place comments in your JavaScript code.

A JavaScript comment is text in your code that is ignored by the JavaScript “machine.” The purpose is to let
you place your own notes to be read by human beings examining the code.

–10–
QED 1. Welcome to JavaScript
JavaScript recognizes (that is, ignores) two kinds of comments:

■ Single-line comments start with a double slash (//) and extend to the end of the current line in the
­JavaScript code. These are intended for brief comments.
// This is a single-line comment.

■ Block comments start with a /* and end with a */. Between these two delimiters can be as much text as
you wish, spread out over as many lines as you wish within the JavaScript file. Use this for longer comments.
/* Here we have a block comment.
This text will be completely ignored
until we end the comment, right here. */

An Example
Consider the following, uncommented JavaScript from later in this book:
var txtField = event.target
txtField.fillColor = color.red
txtField.textColor = color.white

Since we have not yet discussed these commands, the exact purpose of this script and how it carries out that
purpose is very unclear, although it does seem to have something to do with color.

On the other hand, if we include comments in the code, then it becomes possible for someone unfamiliar
with the program to at least know what the intent of the program is and generally what it’s doing:
/* This program changes the background and text color of
a text field when the user tabs into or clicks in the
field. */
var txtField = event.target // Get a reference to the text field
txtField.fillColor = color.red // Set the background to red
txtField.textColor = color.white // Set the text color to white

This version of the program is much clearer, even to someone new to the code.

Comments are a Force for Good in programming. Any script more complex than a couple of lines should
include comments that describe what it does and how it works.

All of the examples in the rest of this book will be heavily commented to make them as comprehensible as possible.

You’re welcome.

–11–
QED 1. Welcome to JavaScript
JavaScript Errors
In the (ahem) rare event that you have an error in your JavaScript—you misspelled a variable name, ­mis-copied
a piece of code, and so on—you will be faced with the task of figuring out what is wrong with your code,
a process known as debugging. Acrobat left to itself treats these errors quietly; if the code fails, Acrobat
just aborts the script; to all appearances, clicking on the button did nothing at all, although there was really
a failed script h­ appening beneath the hood. This isn’t useful for debugging; if a JavaScript fails, we’d like to
know about it and, ­furthermore, be told what went wrong, so we can fix it.

To get this diagnostic information about failed scripts, we need to enable something called the JavaScript Debugger.

The JavaScript Debugger


The JavaScript Debugger is a window that presents information about JavaScripts executing in your A ­ crobat
document (Figure 1.9). In particular, the Debugger presents diagnostic information about errors in your
­Java­Scripts, allowing you to figure out why they are misbehaving.

With the JavaScript Debugger enabled, whenever one of your JavaScripts fails, Acrobat will open the
D­ebugger with an error message (“ReferenceError,” in Figure 1.9). This will allow you to determine what went
wrong and what to do about it.

Error messages can be somewhat cryptic at first, but with time and familiarity they become useful. The most
common messages you are likely to see are the following:

■ Reference Error: XXX is not defined

This indicates that you misspelled something; the name “xxx” (or whatever) is not one that JavaScript Figure 1.9 The JavaScript Debugger window presents information about errors in
knows. Remember that JavaScript is case-sensitive; there is a difference between app (which JavaScript your JavaScript, as well as providing a variety of other tools.
knows) and App (which it doesn’t know).

■ Syntax Error

This means that JavaScript could not make sense of something in the code. This usually means you omitted
­something (a comma, a number, a parenthesis) from your script. An example of a syntax error would be
app.alert("Hi, Mom", 3

This line is missing its closing parenthesis.

The set of possible error messages is very large, though most are pretty hard to provoke. Just sit tight, read
the message, and carefully examine the aberrant JavaScript code for misspellings and omissions.

–12–
QED 1. Welcome to JavaScript
Enabling the JavaScript Debugger
You enable the JavaScript debugger in the Preferences of your copy of Acrobat. Open your Acrobat
­preferences and select JavaScript in the long list of preference categories (Figure 1.10). All of the checkboxes
in the JavaScript Debugger section should be selected, as in the figure.

Using Your Own Text Editor


The text editor built into Acrobat’s JavaScript Editor (see Figure 1.7) is pretty minimal. It lets you type in your
JavaScript, but it has no particularly fancy editing capabilities. For short JavaScripts, this is not important; when
typing long, complex scripts, however, you will miss having a fully featured text editor.

You can ask Acrobat to use text editing software of your choice to edit your JavaScripts. Having told A
­ crobat
Figure 1.10 You enable the JavaScript debugger in your Acrobat preferences. Select
what editor you want to use, it will automatically launch this software when you click on the Add or Edit
all of the checkboxes in the Debugger section, as above.
­button in the Document JavaScripts dialog box (Figure 1.11).

To set this up, you must specify in Acrobat’s Preferences the editor you wish to use for working with Java­Scripts.

To specify a text editor to use when editing JavaScripts:

Start with Acrobat open.

1 On the Mac, select Acrobat>Preferences; in Windows, select Edit>Preferences.

Acrobat will present you with its Preferences dialog box (Figure 1.12, next page).

2 Select JavaScript in the list of Preferences categories.

The Preferences dialog box will display the controls that affect Acrobat’s JavaScript support, as in Figure 1.12.

3 Among the JavaScript Editor controls, at the bottom of the dialog box, select Use External JavaScript ­Editor.
Figure 1.11 Acrobat will launch your external text editor whenever you click the Ad
4 Click the Choose (Windows) or Browse (Mac) button and then navigate to the .exe or .app file for the
or Edit button in the Document JavaScripts dialog box.
editor you want to use when editing JavaScripts.

5 Click the ok button.

That’s all there is to it. Now, when you edit a JavaScript, Acrobat will automatically launch your text e­ ditor.
Type your JavaScript code into the text editor’s window, save the text, and then close the editor. Your
­JavaScript will be automatically entered into Acrobat.

–13–
QED 1. Welcome to JavaScript
For what it’s worth, my favorite programmers’ editor on the Mac is TextWrangler (www.barebones.com); it
is a first-rate editor and completely free, omigawd. Among Windows text editors, I’m rather fond of TextPad
(www.textpad.com); it’s relatively inexpensive shareware and well worth the money.

JavaScript References
This book is a non-programmer’s introduction to using JavaScript within Adobe Acrobat; it offers full
coverage of neither the JavaScript language nor a complete description of the ins and outs of the Figure 1.12 You can tell Acrobat to use an external editor when typing or modifying
implementation of JavaScript that resides in Adobe Acrobat. When you are done with this book, you will JavaScript code.
have two other references you can use to further your studies.

Client-Side JavaScript Reference


There are myriad books on JavaScript, as I said at the start of this chapter. However, the official JavaScript
definition is presented in a web-resident document called the Client-side JavaScript Reference, which resides
on Oracle’s website, here.

Figure 1.13 shows a part of a page from the Reference. As you can see, this is not intended to be fun reading;
it’s a reference, not a tutorial. Still, if you want to learn the complete set of features that are built into the
JavaScript language (as opposed to the Acrobat version of it), this is the place to go.

Acrobat JavaScript Guide


The full description of all of the things you can do with JavaScript in Acrobat is presented in a document
available from Adobe’s Developer website: the JavaScript for Acrobat API Reference or “JSAPI,” from now on
(Figure 1.14, next page). This is the technical specification of all of the object types available to your JavaScript
programs within Acrobat. There is also an excellent on-line version available through Adobe’s Developer website.

Figure 1.13 The Client-side JavaScript Reference is a web site


that presents the formal definition of the JavaScript language.
It is very useful, if not very fun to read.

–14–
QED 1. Welcome to JavaScript
Like the Client-Side Reference, the JSAPI is a technical specification, not a document you would willingly read
from one end to the other. It gives a detailed description of every JavaScript object type available in Acrobat

x
and the properties and methods of each. Where the book you are
Note
reading presents a series of examples of how to carry out specific
The JSAPI is available as a Kindle book from
tasks in JavaScript, the JSAPI describes everything you can do in amazon.com.
Acrobat with JavaScript.

To give you a bit of the flavor of the ­JSAPI, Figure 1.15 shows a screenshot of the complete description of the
app object’s beep method. I shall be making occasional r­ eferences to the JSAPI throughout this book.

Figure 1.14 The JavaScript for A


­ crobat API Reference
is the f­ormal technical document that lays out the
how Acrobat’s J­avaScript implementation works.

Figure 1.15 The description of the app object’s beep method is a good
example of the type of description provided for every object., method, and
property in the JavaScript for Acrobat API Reference.

–15–
QED Chapter 2
Page and Document JavaScripts

There are five broad types of JavaScripts in Acrobat, each differing in where it’s used in the Acrobat ­document.
What We’ll Learn in this Chapter
■ Form Field JavaScripts are attached to form fields. As we saw in the previous chapter, Form Field scripts are In this chapter, we’ll learn how to:
associated with events that occur with a form field: Mouse Down, On Focus, and so on. ■ Run a JavaScript when a document opens
■ Document JavaScripts are associated with the opening of the Acrobat file. Acrobat executes these when ■ Run a JavaScript when a document closes
the document is first opened. ■ Run a JavaScript when entering or leaving a page
■ Document Action JavaScripts are executed when one of a set of predefined events happens with the ■ Using JavaScript variables
­Acrobat file: the file closes, is saved, and so on.

■ Page JavaScripts are associated with a particular page. You can provide scripts that Acrobat will execute
when the user enters that page, leaves that page, or both.

■ Application JavaScripts are scripts that are executed by Acrobat when the application first opens. These
can perform a variety of interesting tasks, such as add items to the Acrobats menus. We won’t be talking
about application scripts in this book, because their use is specialized and infrequent; they’ll be a topic for
an eventual book 2.

We discussed Form Field JavaScripts in Chapter 1. In this chapter, we’ll look at how to write the other three
types of scripts.

The Project
(Files: JSAcro_Ch02_Example_Start.pdf, JSAcro_Ch02_Example_Final.pdf )

Our sample file for this chapter is the pet store catalog pictured in Figure 2.1. In the course of our discussion,
we’ll add examples of Document, Document Action, and Page JavaScripts to this file.

Figure 2.1 In this chapter, we are going to add several scripts


to this pdf document.

–16–
QED 2. Page and Document JavaScripts
The JavaScript Tools Panel
Several of the JavaScript-related tools we’ll be using in this chapter reside in the JavaScript panel in the
­Acrobat X Tools pane (Figure 2.2).

If you examine your own copy of Acrobat, you’ll probably find the JavaScript panel is missing; A ­ crobat Figure 2.2 The Javascript
doesn’t show this panel by default. (This is reasonable; the vast majority of Acrobat users don’t have anything panel lives in the Tools
pane. It is initially hidden.
to do with JavaScript and would be appalled at the prospect.) Before we can proceed further in this book,
we need to make the panel visible, thusly: The tiny icon in the upper-
right corner, just above
To make the JavaScript panel visible: the panels displays a

x Note
drop-down menu when
1 Make the Tools pane visible by clicking its name in the
clicked (Figure 2.3).
Acrobat X toolbar. Acrobat 9 doesn’t have a Tools pane. All of
the JavaScript commands in this chapter reside in
2 Click the tiny icon at the top of the Tools pane and select the Advanced>Document Processing submenu.
JavaScript in the resulting pop-up menu (­Figure 2.3).

The JavaScript panel will become visible in the Tools pane. It will be available to your copy of Acrobat X until
you deselect it again.

Document JavaScripts
Document JavaScripts are executed by Acrobat upon opening the document to which they're attached. This is
a convenient way to present the reader with an initial “splash screen” or to carry out some other start-up ­activity
when the user opens your pdf file. You may attach as many Document JavaScripts to an Acrobat file as you wish.

As an example, we’ll add a Document JavaScript to our ­catalog that displays a greeting when the reader
opens the document (Figure 2.4).
Figure 2.3 Make the JavaScript panel visible by selecting it from the
To attach a Document JavaScript to an Acrobat document: Tools pane’s pop-up menu.

Start with the document open in Acrobat.

1 In the JavaScript panel, click the Document JavaScripts tool (back in Figure 2.2). Figure 2.4 We’ll start
by adding a Document
Acrobat will display the Document JavaScript dialog box (Figure 2.5 , next page). JavaScript that displays an
admittedly unattractive
2 Type a name for your script into the Script Name field. “welcome” message when
the pdf document opens.

–17–
QED 2. Page and Document JavaScripts
This can be any name you wish, although descriptive is
better than cryptic; we’ll name our script “­Welcome,”
since that’s what it does.

3 Click the Add button.

Acrobat will present you with the JavaScript Editor


window (Figure 2.6). Note that this window appears with
some JavaScript code already entered into the text field.
This code is the starting point for a J­avaScript function
definition; since we’re not going to be defining a function,
Figure 2.6 The JavaScript Editor window provides you with a simple text
you can delete this initial code. ­editor into which you may type your JavaScript.
4 Type your JavaScript into the text field (Figure 2.7, next page). Figure 2.5 The Document JavaScripts dialog box lets you
attach JavaScripts to your document.
In our case, the script will be a single line, as follows:
app.alert("Welcome to the 1-Off Pets catalog!", 3)

This JavaScript displays the alert shown back in Figure 2.4. The app object’s alert method displays an
alert window with the specified text. The 3 indicates the kind of icon that should appear in the alert. We’ll
look at this method in more detail in Chapter 4. (You may recall we discussed the app object in C ­ hapter 1.) Figure 2.7 Type your JavaScript into the text field of the JavaScript Editor.

Remember that JavaScript is case sensitive; your upper- and lower-case letters should match the line above.

5 Click ok to back out of the JavaScript Editor and return to the Document JavaScripts dialog box.

The dialog box will now show our Window script in its list of scripts (Figure 2.8). If you click on the
script in the list, the dialog box displays the code in the lower text field, as in the figure.

6 Click the Close button to exit the Document Scripts dialog box; you will now be back at your Acrobat
page. That’s it! We’ve created our Document JavaScript. Figure 2.8 Our
Welcome script is now
7 Try it out by saving the Acrobat file, closing it, and then reopening it. Acrobat should display the alert we listed in the D
­ ocument
saw in Figure 2.4. JavaScripts dialog
box. Click on the script
name and its text will
appear in the lower
text field.

–18–
Random documents with unrelated
content Scribd suggests to you:
The Project Gutenberg eBook of Ripeness is All
This ebook is for the use of anyone anywhere in the United States
and most other parts of the world at no cost and with almost no
restrictions whatsoever. You may copy it, give it away or re-use it
under the terms of the Project Gutenberg License included with this
ebook or online at www.gutenberg.org. If you are not located in the
United States, you will have to check the laws of the country where
you are located before using this eBook.

Title: Ripeness is All

Author: Jesse Roarke

Release date: June 26, 2013 [eBook #43038]


Most recently updated: October 23, 2024

Language: English

Credits: Produced by Greg Weeks, Mary Meehan and the Online


Distributed Proofreading Team at http://www.pgdp.net

*** START OF THE PROJECT GUTENBERG EBOOK RIPENESS IS ALL


***
Ripeness Is All
By JESSE ROARKE
Illustrator SUMMERS

[Transcriber's Note: This etext was produced from Fantastic Stories of Imagination May
1962. Extensive research did not uncover any evidence that the U.S. copyright on this
publication was renewed.]

Shakespeare wrote it, in the tragedy of King Lear—a phrase to


live by:

Men must endure


Their going hence, even as their coming hither;

He was disturbed, but he did not know it. Murky, agitated waters
crept up in his vast subconscious world, and sought the threshold,
the mouth of the pit, the slope of the clean shore; little rainbows of
light now and then flashed over the waters. They heaved, and
against the sluice-gates they beat, sullenly. There was a yielding, but
the great force was contained.
He left his Pad, curiously mopping his brow a little, and furrowing it
between the eyes. It came to him that he was hungry. He stepped to
the curb, pushed the button, and leaned against the post, as if
waiting, or in thought. Almost immediately a Car appeared, in a
cheery orange and green. He almost shuddered, and he almost
knew that he did so. Then he brightened, stepped into the car, and
voiced his desire.
He was carried at a moderate pace through clean, broad streets and
past bright, shiny buildings and smiling parks and gardens. He came
to the top of a high hill, saw the sparkling blue bay in the distance,
and thought vaguely of sailing upon it. On his face he felt a brisk
spray, and the air was tanged with salt. Then a warmed, faintly
perfumed glow dried and composed him, and the Car shut off all its
machinery and glided to a stop. He got out, ever so comfortable,
and entered a luxurious Kitchen, in which he had not dined for
several days.
The doors opened automatically, and a smiling android, gaily
featured and clothed, conducted him to a table. She was a soothing
sight: yes, that's what it was. He ordered a sumptuous meal,
rubbing his ample waistline in anticipation.
"Dig dig!" crooned the waitress.
He patted good-naturedly her well-moulded behind as she turned;
she glowed sweetly back over her soft and delicate shoulder. He
wondered if Meg was enough, and decided that, well, for the time
being, he guessed she was. No use hurrying things. The waitress
returned and served the meal. As always, it was excellent. He
finished with a leisurely bottle of wine and a cigar, pinched the
waitress's firm yet ever so yielding thigh, and departed.
Then a deep stirring almost took hold upon him. Yes, that was what
he needed. It had been several months now. He pushed another
button, and a rosy pink Car appeared to his service. "Take me to a
House, you know what I mean?" he said, as he arranged himself
upon the pearl grey cushions. The Car glided away.

On and on along the shore of the ocean they pleasantly careened. At


length they turned into a rich garden bower, and stopped in front of
a great mansion overlooking the waves. He alighted; the Car
departed. Profusely bloomed scarlet and golden and azure flowers,
everywhere; succulent and bright was the lavish green. The doors
opened, and a Woman received him. She was past child-bearing,
motherly, and smiling.
He smiled back, and said, "You got one, huh?"
"Of course," she answered.
He sat down to wait.
And while he waited, he almost thought. Meg was good, all right,
but why wasn't she enough, sometimes? He tapped his thumb-nail
against his teeth in a few moments of near perplexity, and then
desisted. Soon a bevy of charming Girls entered the room and
paraded for him, laughing and smiling. He settled upon a petite
brunette with cherry lips. She stripped him of his clothes, and they
went walking in a private garden.
In an inner bower they sat down to a rustic table, and were served
by robot with a heady aphrodisiac wine. On the grasses and the
petals of flowers, overlooking the sea, they entwined their limbs and
their bodies, and he nearly enjoyed her. He thought that once he
had enjoyed this activity indeed, and wondered whether it were so.
He sat looking over the waters, trying to muse. The androids were
physically perfect, flesh meeting flesh, clinging to it, thrilling with it.
They were warm, they whispered, they strained and cried. They
were freely available, for every man and woman. None need be
unsatisfied.
But he did not know all of this, history and psychology were lost to
him and he could never keep a connected train of thought; his being
unsatisfied could not penetrate to his consciousness. He did not
quite know that flesh cried out for something more than flesh, and
had always done so. He did know, more or less, that there was the
matter of population, and that real men and real women had, at
mysterious intervals, to copulate. That was the way it was. He had
once spent some time in a House himself, meeting the requirements
of an endless variety of Girls. He supposed that some of them had
borne the issue of his seed, though he did not suppose it in these
terms. But it was better not to know these things for certain, and
not to have anything to do with the rearing of children, after the
early mother-feeling was over. The Schools could take care of that
better than people could.
She snuggled against him.
"What say, Man?" she said: "What's eatin yuh?"
He did not know how to answer. He tried to talk, tried to break
through, to clarify.
"What's it, huh?" he nearly pleaded. "All this, I mean. Like what's it
for?"
She stretched out on the grass and looked at him a moment.
"Search me," she ventured. "I guess maybe what you need's a Bed."
He guessed she was right.

They went back to the mansion through the twilight, and established
themselves in one of the rooms. The soft curtains were drawn, the
Bed was large, the sheets were silky and creamy. She reclined on
her back, and the mattress moulded itself perfectly to her form.
He lay down beside her, and caressed her. She clasped him tight to
her breast. And he was clasped also by an invisible but very palpable
field of energy, that directed his movements and charged him with
an inexhaustible and ceaseless power. He held her tight, and the
force entwined them. They were one throbbing ecstasy, and only at
the very last endurable moment were they given release.
Then the Bed slowly soothed them, massaged them, and invigorated
them once again. Throughout the night it continued, activity and
repose, until toward the dawn he fell into a dead sleep, which lasted
until the following morning.
He did not know that he dreamed. He did not consciously remember
any of it. He only knew, as he ate his ample breakfast, that he was
not so thoroughly at peace as he should have been. And he knew
that it was useless to ask the Woman, or one of the Girls.
But the Woman's androids did well by her, it seemed. Maybe he had
better go home to Meg.
"What the square, anyhow?" he said to himself. A little more rest in
his familiar surroundings, and he would be all right. A Bed always
took a lot out of a man. He arose to go.
"Goodbye, dear," the Woman said, as he came to the head of the
main path. She was serene and smiling.
He adjusted his tunic, and smiled in reply. Yes sir, the old world was
in good shape, just like always. He signaled for a Car. The bright
ocean again passed by him, and the broad sands, and he dozed.

The dreams were more importunate, this time. When he awoke, with
a blank start, the Car was cruising aimlessly. He looked around, and
broke into a sweat. There was a button he had to push, somewhere,
there was a handle he had to take hold of. He stammered out "Stop
—now!" and stepped onto the curb. The car sped away, to another
summons. He was before an Emporium, but he did not enter.
Instead, he did an unprecedented thing: he went for a walk, through
the streets of the City. This was not done, and none of the
occupants of the passing cars observed him.
He was really wondering, now. Could something be wrong? This
possibility, with all its full horror, had never entered his mind before;
indeed, he did not even have the conceptions of rightness and
wrongness, and yet there was the inescapable word, "wrong". His
agitation increased. He found himself with the hardly formulated
idea that a school was a place where one learned something, and he
did not know what this could mean.
He thought of the School that he had attended. All the young people
of the District of Fransco attended it: they had been told that there
were other Schools, in other districts, and that they were all the
same. He had believed it, and forgotten about it. What did it matter?
One district was as good as another. He had never travelled. He
knew a Man who had gone to the District of Shasta, but he had not
been interested in hearing about it. He remembered that the Man
had said it was all the same thing, not worth the bother. One had
everything he needed, in his own place. But now it seemed that he
needed something more, something nobody had ever heard of. He
walked on, thinking about the School.
Everybody was born in a House, and kept there till he was weaned,
and could walk. Then he was taken to the School. There he grew up
in an atmosphere of Group Living, and was gradually showed
everything that he needed—everything that there was. The hes and
shes played together; they were instructed in the Ways of Life.
As they grew older, they were taken around the City. They were
showed the places that the Cars could take them; they were showed
how to push the buttons. Of course the robots did a perfect job of
instruction. There were Kitchens, in which one could eat. There were
parks and gardens, in which one could stroll and lounge. There were
Emporiums, in which one could get clothes and things. It was all—as
it was.
When one reached puberty, he was taken from the School, and
given a Pad. There he lived, listening to the soft music that came
from the walls, eating and sleeping. And doing. He selected his
android from an Emporium, and did her as he pleased. She was his
company, the Warmth of his Pad. She shopped in the Emporium for
him, she fixed him cozy little meals, and brought him his pipe or his
cigar. She spread the depilatory cream upon his face in the morning,
and wiped, with so soft a touch, his beard away; and she bathed
him, in the scented waters.

He remembered that after a year or two, he had felt almost restless.


From his touch, Meg had understood. She had whispered "House" to
him, and he had gone out and instructed a Car. That had been his
first experience of a Girl. He supposed that it had been the same
with the others. He had never inquired. In the garden bower the
idea of children had come to him, and his mind had been at rest. He
had not tried a Bed until the fifth or sixth time. He had, he
supposed, taken for granted that the Girls lived in the same way that
he did. They had their own androids, their own Pads. They never
associated with the Men, except in a House. Men got together
sometimes, and ate and drank, and had android orgies; no doubt
the Girls did likewise.
With a great effort, aided by hints from what he could remember of
Life, he pieced an idea together, not knowing what he had done. Of
course human copulation was too dangerous: it might make one
unhappy. He had learned, in the bowers, that Man and Girl were not
of the same temper, and that their union was not always perfect.
Somehow it was better, even so, but it was too difficult. It tended to
be—painful.
He did not know the word. He did not know any of the words for
these strange thoughts of his, but they were now very palpable to
him, and very urgent. His android was his, and was never
dissatisfied; and so, neither was he. It was a perfect and complete
system. And what was happening to him? The word "happiness"
came upon him, and he shuddered, almost in terror. What did it
mean? Too many things were happening, all at once.
He turned into a street, and stopped. He had never seen it before.
But why should this disturb him? The District was a big place. But he
thought he had better get out of this street. Maybe pick up another
android, maybe even take her home: have a redhead for awhile,
maybe. Meg wouldn't mind. How could she? What was the matter
with him? Other Men changed readily, or kept a whole Padful. The
waitresses were much in demand. One did not even have to take
them home: there were convenient rooms in every Kitchen.
Then suddenly all this was shaken from him. He was standing before
a large building, and he did not know what it was.
He stood for a long time, looking at it. Now and then a Man seemed
to pass, but he could not be sure. It was like a shadow, like the
flickering of a breeze. He wondered what the building could be.
At length he seemed to hear a murmur as of the waters, and at last
a voice broke upon him.
"This is a library," it said. "There are books here, and teachers, from
whom you can learn."
It was too much. He screamed, and ran down the street.
After a few blocks he became calmer; forgetfulness rescued him. He
pushed a button, and a Car conveyed him to his Pad.
Meg met him, all warmth and smiles. He sat down, and she brought
him his slippers and a cold bottle of beer. He drank deeply. She sat
on the arm of his chair, caressed him, and asked if he would like
some dinner. She had—
He cut her short.
"Meg, honey," he said, "I'm a little tired, that's how. You go to bed
now, huh, put on some of that jasmine perfume? You dig?"
"Sure, honey! Dig dig!" she replied.
The dark waters rose, and beat against him.
He finished his beer, and got himself another.
Meg whispered, "Say, honey!" The bed rustled softly.
He fought down his mind, and rapidly drank his beer. Almost as ever,
he embraced the Warmth, and slid into a comfortable oblivion. Meg
lay beside him in the darkness.

He awoke early, and she laid her hand upon him.


Abruptly, he squirmed away.
"Don't do that!" His voice was loud. "It's no good, all that stuff!
Something's—wrong!"
He jumped out of bed, and began rapidly to put on his clothes.
Meg lay still for a moment. Her circuits were not built for such
things. There was nothing wrong, and nothing registered. Then the
cheery morning music started out of the wall, soothing and bright,
and she began to hum with it. She arose, went lightly to her
dressing, freshly and sweetly tripped into the kitchen.
"Scrambled eggs, honey?" she asked, in the most caressive of tones.
He had all but forgotten his outburst.
"Yeh, sure honey", he answered.
He ate copiously, and drank several cups of black coffee.
"Fine day!" he said, belching his appreciation.
He patted his companion good morning, exceptionally affectionately,
and went out into the street.
There he met an old friend and drinking companion. He lived next
door, it seemed. They were neighbors! He had seldom been so glad
to see anyone, as this old friend.
"Hi there, Charlie!" he boomed. "How's it all? Like Man, I'm glad to
see you! What's it, huh?"
Then he waited, with an expectant grin. He waited a considerable
time after Charlie had sauntered past him and ridden off in a Car.
Then it came to him.
"He didn't see me! Like as if I wasn't here! Yeah!"
He hurried down the street, and did not think of a Car at all.
He slowed his pace, and walked for a long time. Nobody saw him.
He tried to think. The effort was too much, and his mind was a
strained blank, and almost pained him. This street: it seemed
familiar. Yes, he had gone cruising here, several times. He began
very nearly to regret his deficiency of memory. Wasn't there a nice
park, up here a little way? He quickened his pace, perspiring freely.
It was right here—no, it couldn't be! Not that again! He couldn't be
invisible to other people! There couldn't be things all around him
that he couldn't see! It wasn't right! What did that word mean? He
fainted.
When he came to, the library was still there. He staggered to his
feet, and stood still a moment, gazing. There was something cut in
the stone over the large front doors. Why would anybody cut
something like that in the stone? It didn't make sense. It wasn't
comfy at all.
Then, in the back of his brain, a little light burst, and he heard the
words, "All men by nature desire to know."
There it was again. Hadn't he dreamed it? What was this "know"? It
wasn't eating or drinking or doing or anything.
Then there floated into his pulsating areas this "Aristotle".
No dig at all. But he knew that it was the inscription in the stone,
and he walked up the broad front walk and entered the doors, which
opened automatically for him.
He walked over the marble floor. Out of the corner of his eye he
seemed almost to discern an occasional dim figure hurrying past. He
walked up two flights of stairs, seemingly alone, and yet seemingly
surrounded. It was strange, and it was perfectly natural. He had
never felt so alive before. Not even in a Bed had he felt himself so
much of a Man. And he did not think about doing. He had not the
slightest interest in it. He wanted to know, whatever this might
mean. He paused in front of a door. It opened, and he entered and
eased himself into a chair.
"You must begin with the alphabet," the voice began. "This is the
letter A."
It flashed upon the screen. He copied it on the plate before him.
Over and over again he copied the letter, and heard its name
repeated. He was on the way.

He remained for weeks, for months, in the library. His room was
comfortable, his meals were tasty and well balanced. He lost weight,
he gained continually an alert, aware sense of well-being and
purpose. He was developing a mind, and beginning to know.
Throughout the day he studied consciously, or received hypnotic
instruction; during the night, while his sleep was more keen and
more restful than ever before, the instruction continued. He learned
many things. He became aware of who Aristotle was, and what he
had done. He developed an acquaintance with all the great men and
cultures of the lost lands of Europa. He learned that he lived on the
west coast of Ameru, and that this coast was one large City; he
learned that the once large continent had dwindled greatly in the
disasters, that the ocean waves now poured over the great plains,
and all to the eastward. He felt occasionally a longing to see the
mountains, and the further waters.
He learned and throve. He began to see other figures more
distinctly: once in the corridor he met a Man face to face, and they
smiled and bowed to each other. It had been a small Man, with a
funny beard, and very bright eyes. It had not been like anybody he
had ever seen in the City. But suddenly he knew that he was not like
anybody in the City, and that it could no longer be his home. The
shock of the fact that the City was not everything, that there was
existence, and desirable existence, outside of it, came to him
strongly; but now he was ready for it. When the tumult was over, his
mind was at last born, and he was a human being, ready to aim for
high goals, and to co-operate with destiny.
That night much of a strange nature, called "Sunrise", came to him,
and strange names, faces, and disciplines were vaguely lodged
within him. He awoke with a most definite feeling of readiness, and
with his breakfast he knew, beyond doubt, that "When the disciple is
ready, the Master appears."
When he had finished eating, he left the library, and walked in
thought. How dismal everything was! Nobody knowing, or caring
about anything really important; nobody seeing anything. And
certainly they did not see him: but he saw them very clearly. And
how much was there, still to be seen, all around him? And what was
it, what did it mean? He had to get out, he had to find an answer.
He pushed the nearest button, and slid into the suave black Car that
noiselessly approached. He had never seen a black Car before. He
wondered if his eyes were still playing tricks upon him, if he would
ever see anything aright. Then he dismissed it from his mind.
"Take me out of the City", he said.
There was a slight hesitation; then they were moving, slowly and
quietly, in a northeasterly direction.

It was a long ride, past all the familiar features of the City, multiplied
many fold. At length the Car shuddered slightly, and the virtue
seemed to go out of it in a gentle rush: it stopped, utterly still, and
the silent door slid open with an eloquent finality. He got out, and
the Car seemed to hasten away as from an undesired doom.
But his weird was upon him; he thought so, in the transfixing old
terms; and he turned and beheld an open field, with mountains in
the distance. And it came to him that he had ridden this way before,
and seen nothing but City all around him. He thought then of
enigmatic things that he had heard and read in the library: of how
certain Tibetans rendered themselves invisible, or at least passed
unseen, by shielding their thought waves—by giving out no handle
for perception to grasp. So had this landscape hidden itself, it
seemed: shielded itself from desecration.
Or perhaps there were beings, perhaps there was existence, that
gave continual indication, bristled with handles, as it were: but
handles that could not be grasped or made use of by an organism
insufficiently developed. It seemed more of a truism, the more he
thought of it.
But it did not seem to matter, on this bright new day. He dismissed
the question and stepped forward, into the yielding grass.
What a great thing it was to have a mind, to feel alive on such a
day! He tried to remember how dim, how crippled he had been; it
seemed impossible. Could he have been only one poor, flickering
candle, he who now blazed with the light of a hundred, or a
thousand? Could he have rattled on one cylinder, he who now moved
smoothly and noiselessly on sixteen or twenty? It was too marvelous
for words, or for thoughts.
For a long time he walked, perspiring freely, then puffing, limping
and laboring. It was hot, with no breezes from the sea. An
occasional rill was refreshing, and a glade was cooling: the leaves
rustled gently in the now and then quickened air, and the birds were
sweet with song. But there was no sign of human life. At length he
sat down on a fallen log, and rested.
He sat long, thinking and dozing. The sun was low in the sky when
he arose, and followed some prompting to a ridge not too greatly in
the distance. He had come without provision of any kind, and with
no fear for his welfare: he would see. The ground seemed soft
enough, if he had to sleep there; he took off his shoes and socks,
and enjoyed the cool grass.
He walked on toward the ridge, slowly and confidently, his shoes and
socks in his hand. He had not eaten for many hours, but he did not
seem hungry. Food was not the tremendously important thing that it
used to be. He thought of his old esurience, and smiled. Whatever
his god was, it was not his belly, it was not his body at all. He still
had enough flab to live on for some time without inconvenience, and
it would be better to live on it, than to keep stuffing himself. There
were no women either, and no androids. They were tiresome, and
tiring, things. He sighed almost with contentment.

Soon he crossed the ridge, and saw the smiling farmland in the
valley not far below. This was where the old food supplies had come
from: this had been the life of all but a few, for many centuries.
There was a great peace over it all. With a sense as of treading on
hallowed ground, he descended steadily, and soon came upon a
large and rambling wooden house, unpainted, and comfortable.
Really comfortable, in a human way, not in the sham way of the City.
There was an elderly woman on the porch, serenely rocking. As he
approached, she smiled.
"Welcome, stranger!" she said. "Come on up and rest awhile."
He was glad of the invitation, and he mounted the generous and
solid steps with his shoes and socks still in his hand. He sat down
and redonned them, under her friendly smile.
"It feels good, doesn't it?" she asserted. "The real earth, under real
feet. Maybe you read the poet Hopkins before you got out. I did,
right at the last. One poem has always stuck with me, and especially
this one line of it:

Neither can feet feel, being shod.


I wanted to feel things; I was tired of being shod, and insulated, and
deadened. I was just a young girl, then. I felt charged with the
grandeur of God, as Hopkins put it, and I had to get out. I've seen a
lot of God's grandeur, and a lot of His blessing, through a long life.
It's been good, here in the real world.
"But it's no use chattering," she continued. "That doesn't really
express or communicate anything. Nature has got a bigger and
better voice than any of us, and the best thing to do is just to listen
for it. I hope you'll stay with us awhile. The longer the better. We
like to help people who've just escaped. But I still talk too much.
Supper'll be ready pretty soon, and I have to go tend to it for a few
minutes. Just you sit there and be calm: listen for the still voices."
He was glad to do so, and gladder still to see the men of the family
returning from the fields. There were three of them, tall and strong,
real human beings, healthy and alive, and little marked by
unprofitable care. They had a faith, it seemed, a communion, a
divine assurance, more or less fulfilled.

The older man, the father, welcomed him again, and they were soon
seated at the supper table. He noticed that the men ate heartily, and
had yet not an ounce of excess flesh. He rued his own bulk, and ate
but sparingly, only out of politeness. But food had never tasted so
good before.
The two sons were already approaching middle age, and were still
unmarried. This occasioned their mother some concern. But, as she
said, they didn't seem to care, and God or nature could take care of
these things better than people could. There was no use straining.
"And there aren't so many young women around," she mused.
"There aren't many people. Whatever love-making there may be,
there's very little breeding. It's like the City, in that respect. It seems
this just isn't a very good world these days, comparatively speaking,
and people are being held back till it gets better. There seems to be
a sort of a cloud over everything. I don't know. Anyway, we're
contented. At least we have our minds and hearts, and our
patience."
He stayed a week, a month: into the natural influences he vigorously
and gratefully plunged. He helped with the farm work, and grew
lean and hard, and mentally as well as physically strong. He stayed
on, through the winter.
Then, with the spring, his own fertile ground began to burst and
ache, and he was no longer satisfied. He was not nature itself, to
endure unmoved the countless cycles of diversified sameness; he
was rather a flower that faded with a season, a leaf that would soon
fall. He was like a single wave of the vast ocean, and like that wave
he must forever be moving on, questioning.

And so he left the farm very early one morning, and walked north,
as he could tell by the stars. They would not be surprised, and it was
better this way, without farewells. They would know that, for him,
they had served their purpose, and would be glad. And so he walked
north, before sunrise. For this direction he was conscious of no
particular reason; but he felt it to be as good as any other.
He passed a farm or two, skirting them carefully, and breakfasted on
the sunrise alone. It was so beautiful, thus breaking, rose and
golden, over the hills. He remembered the last poet that he had
read, before his deliverance: the great Sidney Lanier. "The Georgia
gold mine," he thought facetiously; and was at once sorry, for his
shallowness. No more would successive suns blaze upon the soft
southern beauty. The warm blue Atlantic waves rolled over the home
of this poet-prophet; whose promise, he fervently hoped, was not
yet drowned. He also would be Lit with the Sun. He stretched out his
arms to the streaming gold, and then walked on vigorously, with a
new purpose not yet defined.
He was getting into ruggeder country, and the going was more
difficult. But yet he felt no inclination to break his fast, or to slacken
his pace. The air was fresh, and good. He climbed around the spur
of a hill, and found himself entering a wild valley with no sign of
human habitation. There was a small stream close by, rippling down
from the solitudes. He went to it, and knelt to drink.
As he arose, two ropes descended upon him, from opposite sides,
and his arms were firmly pinioned. He looked around, and saw two
bearded young men, of not unprepossessing aspect. Each wore
tight-fitting clothing and a peaked hat with a long feather, and was
armed with knife and sword. One of them motioned into the valley.
"Come on, thou varlet!" he said.
They proceeded, and were soon immersed in the rippling and jutting
hills.
Near the head of the valley, and up a hollow to the side, they came
to an expansive and well populated clearing. Many men, bearded
and heavily armed, were lounging about, dressed fancifully, but for
action. There were women also, sturdy and for the most part quite
attractive. He found himself speculating briefly on the fierce joy of
their dalliance in these invigorating wilds. Then his attention was
abruptly drawn ahead, and he was forced to his knees before one
who was obviously the leader.
He was in his middle years, and bore a long flaxen beard and
leonine mane of hair; his eyes were large, and of a piercing but
softly reassuring green. He sat, still and lordly, and surveyed his
captive.
At length: "Arise!"
He obeyed, and stood calmly.
The leader continued, "Thou art doubtless but lately from the City, of
abhorred name. Thou art but little acquainted with the usages of
life. Do not speak! I know 'tis true."

He paused for a while, then went on with ruminative authority.


"Know that thou hast come into the hands of the Knights of Eld," he
said. "As our name implies, and indeed our visible delimitations
proclaim, we are no cut-throats, or vulgar brawlers. Thou art safe
here.
"But thou art not one of us. Though thou art healthy and strong,
and might well prove a formidable adversary, thou takest no delight
in combat. Do I speak sooth? Proclaim!"
He proclaimed that it was sooth indeed; with the silent reservation
that, if the combat were sufficiently noble, and profound, and really,
fundamentally necessary—but his thoughts were cut short.
"Then thou hast no place here, unless perchance thou comest for
succour, or for sanctuary."
His answer being negative, the leader continued:
"Know that our life is combat. There be many bands, against whom
we strive. We have made good escape from the emasculate life of
yon City, and we have vowed not to let the spirit of gentle manhood
perish. The elements strive together, and yet the strife is co-
operative: and so should it be with men.
"I like thee," he continued, with a smile. "Say if thou wilt stay with
us, and learn our ways. There is much that we can rede thee, and
the benefit will be mutual, and I trust great."
He was briefly tempted, but still, clearly and promptly, he declined.
The leader frowned slightly, and was silent. Then the imperious
tones rang out:
"Thou art strong! And thou shalt be stronger, if ought of ours can aid
to the achievement of this result, so much to be desired.
"Then hearken well. Thy food shall be taken from thee."
His knapsack was ripped rudely from his back.
"Thou shalt wander without guide, and no one of us shall take, in
any case, further heed of thee. Go with our respect. And may it be
that thou fallest not into the hands of those ruder and less
magnanimous, like as the Snakes, perdie, or the Mountain Lions.
Thou hast been honorably received, and thou art warned. Begone!"

He left with as much alacrity as he thought became him, and


continued on his way. For the remainder of the day he wandered,
without attempting to fix a course, or to avoid anything that might
come to him. He was lost in thought, with a great sense of well-
being that he felt that nothing could overcome.
As the shadows of evening began to lengthen, and the first stars to
shine, he found himself ascending the side of a small but respectably
rugged mountain. By the time of total darkness, he had reached the
top, and seated himself beneath a redwood tree. He began to feel
hungry, but not faint, and with a slight effort of his will the hunger
passed away. He sank into a revery, he sat still and thought and
contemplated through the long night hours. The cool dews came
upon him, and the light winds were whispering in the pale first light,
and he was undisturbed.
He remained on the mountain for three days, eating nothing, and
not thinking of food. He felt the opposing forces of life within,
through and around him. The harmonious, continually pulsing
tension of existence became in a manner clear to him, its great
necessity indubitable. He knew that the battle of opposites, the co-
operative strife of elements, abilities, tendencies, must be fought
within himself; he foresaw no gain from the struggle's
objectification, or its transferral to his associations with others. He
would have peaceful, profoundly and highly aspiring, adequate
companions, or he would remain alone.
During the fourth night, just before the dawn, he saw a shimmering
light over a higher crest in the distance. For an instant it seemed to
become a finger, pointing; and then it faded. He arose, light but
unfaint from fasting, and set out for the indicated mountain. He
encountered no other person along the way.

It was in the late afternoon that he arrived. It was a large and


beautiful valley, into which he slowly descended. It was thickly
populated, and filled with a seething, a tremendous activity. Waves
of immense, ardent energy enveloped him, compound of great joy
and great despair; heart-ravishing music, barely audible, came to
him, spasmodically, on the faint breezes. And the weariness and the
weakness came to him also, strongly, the exhaustion of his great
efforts of the past several days. He lost consciousness, and sank in a
seemingly almost boneless heap to the side of the mountain.
He awoke the following morning in a small hut, secluded, in the
shade of a large tree and beside a stream. A spare old man, with a
slight beard and twinkling eyes, nodded to him.
"Smells good, does it?" he asked.
It smelled very good, and it looked better when the old man brought
him an ample breakfast, well prepared. He ate slowly, savoring each
mouthful.
"If you don't know where you are," said the old man, "this is a
community of artists. We don't always get along very well together,"
he smiled, "but usually we're minding our own business anyway; and
it's good to exchange ideas and insights now and then, and see each
other's work. And we co-operate too, especially on the stage
productions, like Noh plays, or Wagner, or something contemporary.
I can introduce you to a young man who has written some very
powerful and apt music for the Aeschylean choruses.
"I'm a poet myself," he continued, "and a dramatist now and then.
I'm pretty modest and easy-going, compared to most of the people
here, but I have my moments, and I've done some pretty good
things in my life. I'll probably show you some later on. It's a good
thing for you I'm in a silent period just now: if the old touch had
been on my lyre, I'd never have noticed you; or if I had, I'd not have
attended to you. But come on, you look healthy enough: let me
show you around."
He arose to dress, and the old man looked him over with frank
admiration.
"You're a fine figure," he said. "And the beard does you justice: or
you do justice to the beard. You're like one of the old Biblical
patriarchs. Or like my idea of them, anyway; which may be far
enough from the truth."
They left the hut, and walked beside the stream into the main valley.

They passed an occasional distracted figure, who paid them no


heed. Painters were numerous: one of them, burly and covered with
paint, had ostentatiously affixed his canvas to a rock wall, and was
facing away from all the beauties of the scenery: with furious strokes
he was nearing the completion of his vivid abstraction. One sat
cross-legged, quite self-contained, and with a few strokes of the
brush, black on white, achieved a bird that seemed almost ready to
fly from the paper. Another was painting a meltingly beautiful
portrait of his mistress, with flowers in her hair.
"When we get back, I'll show you a real picture," the old poet said.
"It's called Vasuki. He's the king of the snakes, according to the
Hindus. I don't know much about the man who did it, except that
he's got the most wonderful eyes I ever saw. I tried to do him
justice in a sonnet once, but I failed. He just appeared one day, and
then disappeared one day, and that's all anyone seems to know. Two
of our best young painters went out to look for him over a year ago,
and they haven't returned."
There were musical concerts, operas and plays. There were potters
at their wheels, and sculptors with their chisels and their clay. Every
art seemed represented.
"In that hut over there," said the poet, "lives one of the greatest
musical geniuses the world has ever known. Better even than
Beethoven, I think. Maybe you'll have a chance to meet him, if he
turns sociable while you're here. I trust you'll be here for a long
time. Maybe you'll stay for good? You seem to have the mark in your
forehead."
He stayed for several months. He luxuriated in the splendor and the
beauty of this dedicated life. Great artistry of sound and word, color
and form, filled him: but never to overflowing, and never, fully, to
satisfaction. He grew weary of the continual reaching out, the
perpetual feeding upon dreams. He shared the raptures and the
torments of the artists, he felt powerfully and saw deeply, more than
ever before: but something was lacking. The occasional flashes of
insight were not enough, and the labor, the aspiration, was heart-
breaking. What he sought was still beyond, beyond art itself, beyond
all possible creation. And yet, it must be attainable.

He aspired to poetry, he tried to give a voice to his aspiration and his


need. But it was not in him. And what if it had been? Why should he
write verses to complain that he was not Lit with the Sun? He
thought briefly of the Twentieth Century poetry that he had read,
the poetry of the Dark Ages, and shuddered at the thought of
adding to that store. He would never attempt expression again, until
he knew something to express. But when the time came, perhaps it
would flow from him in such a golden stream as he remembered
from the great masters. Perhaps the poet had not read too
mistakenly the sign in his forehead.
He noticed that some of the artists, and those he considered the
profoundest and the surest, were not permanent residents here.
They came and went, with a light as of far peaks in their eyes. Like
the painter of Vasuki, which was truly a marvelous picture, instinct
with a spirit that made most other productions seem like mere daubs
of paint. He felt that that man knew something, and that he did not
learn it here, that he did not learn it as a painter at all. There must
be other places, or another place, in which art and the artists were
mature. He had had enough of this unquiet, the greatest ecstasies of
which obviously fell below the peace and the assurance that called
to him. He was weary of this perpetual straining with materials and
methods inadequate to the task.
And so, reluctantly, he left the artists, and continued his pilgrimage.
As he departed, a symphony orchestra was performing Mozart's
Requiem, and this perfect artistry, serene and soaring, dedicated to
the very Source, and, it seemed, instinct with something of its light,
comprised a fitting and a reassuring farewell.
As the dying strains played upon him, he was filled again with the
ravishing verses of Sidney Lanier. Out of the high beauty, these
words mingled clearly with his consciousness:

O long ago the billow-flow of sense


Aroused by passion's windy vehemence
Upbore me out of depths to heights intense,
But not to thee, Nirvana.

It was so true, and so much beyond him! The meaning was never
clear, and yet, against it, all else was a deeper darkness. But it called
him, and that was sufficient. He must continue, patiently, on the
way.
The walk was pleasant, and the evergreens were soughing gently, as
he passed. Midway in the afternoon he sat down by a convenient
spring, and ate quickly a light meal. As he was resting, a man came
through the trees before him: balding and rather stout, and
apparently approaching the end of middle age. He did not know
whether he cared to talk with this man. But he had little choice, for
he hailed him with a sort of good-natured camaraderie, and came
and sat beside him.
"You may consider me a philosopher," the man announced; "that is,
in the fine old sense, a lover of wisdom. I don't think that will
frighten you away," he chuckled. "I think I can see that you agree
with Socrates: that you consider an unexamined life to be a life that
is not worth living. Is this correct?"
He replied that it was, and that he was a seeker of wisdom, and
hoped one day to prove to be a lover of it—after he had found it.
The philosopher smiled, and continued, "Perhaps it is best to be a
lover of the search; perhaps, indeed, the search itself is the greatest
wisdom. This used to be considered a platitude," he laughed, "when
education was more wide-spread in the world. But I have never
found anything bright and brand new that matches it. I do not want
to be one of those who 'give to dust that is a little gilt more laud
than gilt o'erdusted'. How about you?"
He smiled agreement. He was beginning somewhat to like this man:
but still he could not respect him, either as an embodiment of
wisdom or as a seeker of it. His mind seemed only clever, and rather
lazy and complacent with its cleverness: it seemed quite incapable of
any really deep probing, or high flight. This was not his idea of a
philosopher.
The object of this scrutiny seemed somewhat to sense its import,
and to shrug it off.
"I could tell it at a glance," he said. "You're one of the most
intelligent men I've ever seen escape from that monstrosity of a City.
Let me congratulate you! It's a terrible thing to live like that.
"One immense mechanized mass! One big idiot's delight, full of
nothing but idiots, or morons at best. Everybody "happy": food,
shelter and sex all taken care of, and real human contact at a
minimum: a true earthly paradise. A paradise for morons, that is, for
people who really prefer to live worse than hogs. God bless the dear
technologists, who keep it going: they as stupid as the majority, of
course, just morons with a little mechanical know-how, as the
phrase was. And bless whatever powers there are, for the library,
and the chance to escape!
"I don't know how it came about, but there's something behind it.
Just before the poor little fools could blow themselves up, the
Disasters hit them: and while they were still traumatized, this system
began to take care of them. It's a fine thing, I guess, for those that
aren't capable of a life worth living. And for those that are, too: it
seems to take hold of them at just the right time. It seems that it
gives everyone just what he is best fitted for, and then lets him go.

"It never really let go of me—or got rid of me. I alternate, from city
to country: read myself to a standstill, and then travel awhile. It's
always pleasant, up here. It's like the coast: the seasons don't
change anymore. That is, there aren't any seasons—just hints of
them. But maybe you know that by now. Ah—yes. I guessed as
much. You look like a man that has been out long enough to—well,
to look like a man.
"I wonder how it will end? The birth-rate's way down, and seems to
continue decreasing, even in the country. Maybe the race is
gradually dying out: evolution getting rid of an unfit species. But I
wouldn't expect it to be so gentle about it.
"The more I think about it, the better I see what an infinite amount
I've got to learn. Another platitude: Newton picking up pebbles on
the sea-shore. Maybe the craze for sheer novelty is one of the things
that made this mess. I don't know. But I think that there is such a
thing as truth, and that it doesn't adapt itself to conditions:
conditions have to adapt themselves to it. Do you agree? Yes, I
thought so. I think I'll have to be heading back to the library in a few
days. I've seen enough this trek.
"There seems to be a guardian angel, somehow, if you believe in
that. The explanation's probably a purely natural one. But people
come out and live as they like to, with no hindrance, and they
prosper. They do a little simple farming, and always have bumper
crops. The weather and the wild animals never hurt them, and they
never hurt each other. The ones that like to fight do it, but only with
swords and knives, and nobody ever seems to get killed. All the
literature and art of the world is preserved, for those that want it: as
many copies as demanded. Sometimes I bring copies of books with
me. It helps, to read them out here. Nature's a lot vaster and more
wonderful than we know.
"Everything seems to be taken care of. Nobody lives in want or fear
anymore. Except," he smiled ruefully, "want of understanding, and
fear of death. But we can take things philosophically, to use an old
popular expression."
The philosopher paused awhile, thinking, observing his perplexing
companion. He could not make him out. Presently he returned to his
long-standing provisional solution for all problems.
"Well, why don't you come back to the library with me? Tramping
around out here is all right for a while, it relaxes you and keeps you
in touch with things; but meanwhile, time flies. Shall we go?"
"I think not," the bearded patriarch replied. "The usefulness of books
is all but exhausted for me. And even the greatest and fullest truth,
set down in a book, I think must be inadequate. It's not an
intellectual thing I seek."

The philosopher smiled tolerantly.


Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookname.com

You might also like