These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

error: unterminated string literal

itsmikem
Registered: Jul 14 2009
Posts: 44
Answered

Hi list...

[Acrobat Pro 8.1.3, WinXP Pro]

Adding bookmarks to a pdf document, I noticed that some of the text of my bookmarks gets appended a mysterious space character. I am attaching javascript to these bookmarks.

I then notice in the Scripts section of the debugger, if I drill into the Bookmarks, if there was that space character appended (not of my doing), there are some squares -- like missing characters -- appended to the bookmark name.

Then, hitting the breakpoint on these links throws "unterminated string literal" errors. I can't seem to avoid this happening, and it does it at random but often times. What's going on?

- Michael M.

My Product Information:
Acrobat Standard 8.1.2, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Actually, you did add those mysterious space characters to the end of the bookmark names. This is a common issue, and in fact it's so common that I've written a tool to [url=http://www.pdfscripting.com/public/programs/downloadsearch.cfm?searchtype=simple&searchmode=cat&keywords=recent&sortby=name&cat=Automation%20Tools]clean up bookmarks[/url]. The characters that are being appended are a LineFeed/Carriage Return combination because you hit the return key after entering the bookmark. I know, it seems like a pretty dumb way to make a user interface, but that's Acrobat for you. The right way to enter a bookmark is to click off it.It's possible that the line feed is also causing an unterminated string literal error, since convering the bookmark into code would cause a line break in the middle of a string.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

itsmikem
Registered: Jul 14 2009
Posts: 44
Thanks Thom!