Skip to main content
annemariep67945361
Participating Frequently
October 14, 2018
Question

syntaxerror:illegal XML character 1:

  • October 14, 2018
  • 2 replies
  • 1043 views

Could someone please assist. I am getting a syntaxerror:illegal XML character 1: at line two on the following script:

var oMyDoc = <... PDF being operated on ...>

app.execMenuItem("Save", oMyDoc) ;

Thankyou in advance

This topic has been closed for replies.

2 replies

try67
Community Expert
Community Expert
October 14, 2018

Change the first line to:

var oMyDoc = this;

On Sun, Oct 14, 2018, 07:47 annemariep67945361 <forums_noreply@adobe.com>

annemariep67945361
Participating Frequently
October 14, 2018

Thankyou for your response, unfortunately it hasn't worked. Thank you anyway, it's appreciated

try67
Community Expert
Community Expert
October 14, 2018

I should have looked better at what you're trying to do... First of all, the "Save" command will not work like that. You can use "SaveAs", but to silently save the file you will have to install a script on the computer itself.

In addition, the execMenuItem command only takes one parameter, so the second one should be removed either way.

Inspiring
October 14, 2018

Well, it could actually have something to do with the first line, and without seeing it all, it's hard to say.

annemariep67945361
Participating Frequently
October 14, 2018

Hi George,

Thankyou for your response. The script in total (line one and two) is:

var oMyDoc = <... PDF being operated on ...>

app.execMenuItem("Save", oMyDoc) ;

Inspiring
October 14, 2018

In that case, the problem is what comes after the equals sign on the first line. Do you have reason to believe it or the second line is correct? It would help if you provide more details about what you're trying to accomplish, apart from "I want to save the current document".

Note that the "Save" menu item cannot be invoked with app.execMenuItem. More info is available in the documentation for app.execMenuItem: Acrobat DC SDK Documentation

so you might want to look into using the doc.saveAs method: https://acrobatusers.com/tutorials/how-save-pdf-acrobat-javascript