> For the complete documentation index, see [llms.txt](https://docs.swingsoftware.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.swingsoftware.com/seascape-for-notes/troubleshooting/error-messages/referenceerror.md).

# ReferenceError

The JavaScript error occurs in the Adobe Reader when a document link is clicked in a PDF file (Disk Archive)

When a doclink is clicked in a PDF file, the following JavaScript error message appears:

`ReferenceError: openLinkPriv is not defined`

![](https://1039028294-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MkmLDl5OXrWVfn2nv57%2Fuploads%2FCvPcIJxva42TnsELx5MY%2Fimage.png?alt=media\&token=34b8b6f5-d080-48c8-9d74-447270bbc147)

The error is caused due to a missing **swpdfc.js** file which is normally installed in the Adobe Reader installation folder automatically.

To resolve the issue, create the `swpdfc.js` file (see the code below) and copy it manually to the Adobe Reader installation folder. The default path to the folder is normally "C:\Program Files (x86)\Adobe\Reader 11.0\Reader\Javascripts", however the actual path on your system may be different.

```javascript
var openLinkPriv = app.trustedFunction( function(dbId, docUnid) {
	app.beginPriv();
	try {
		var depth = 50;
		try {
			depth = this.path.split("/").length;
		}
		catch(e) {
		}
		
		var dirUp = "../";
		var xmlRoot = "";
		var xmlFile = "doclinks.xml";
		var xmlStream = null;
		var count = 0;
		do {
			try {
				xmlStream = util.readFileIntoStream(xmlFile);
			} catch(e) {
				xmlStream = null;
			}
			
			if(xmlStream == null) {
				xmlRoot = dirUp.concat(xmlRoot);
				xmlFile = dirUp.concat(xmlFile);
			}
			
			count++;
		} while(xmlStream == null && count < depth);
		
		if (xmlStream == null) {
			app.alert("XML not found");
			return;
		}
		
		var xml = XMLData.parse(util.stringFromStream(xmlStream), false);
		var xPath = "string(//data/element[@id = '";
		xPath = xPath.concat(dbId);
		xPath = xPath.concat("-");
		xPath = xPath.concat(docUnid);
		xPath = xPath.concat("']/location)");
		var location = XMLData.applyXPath(xml, xPath);
		location = xmlRoot.concat(location);
		app.openDoc(location);
	} catch(e) {
		app.alert("Linked document could not be found: " + location);
	}
	app.endPriv();
});
```

To find the Adobe installation folder on your machine easily, right-click on the Adobe icon that you use to start the program and open click Properties.

The Properties popup then appears as shown in the below example, and you can click Open File Location to open the installation folder:

![](https://1039028294-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MkmLDl5OXrWVfn2nv57%2Fuploads%2FIaFmTwlcMqJS7SXeVdz7%2Fimage.png?alt=media\&token=89b03dbb-23d1-4c90-a783-48863d37ff21)

Once you are in the folder, locate the Javascripts folder and save the `swpdfc.js` file in it.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.swingsoftware.com/seascape-for-notes/troubleshooting/error-messages/referenceerror.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
