Skip to main content
Participant
November 23, 2018
Answered

Problem adding a barcode with Javascript.

  • November 23, 2018
  • 1 reply
  • 693 views

Hi,

I'm trying to use the code below to add a barcode to a document.

The variable cRtn is set to '1234' by an earlier script.

this.addWatermarkFromText({

cText: cRtn,

nTextAlign:app.constants.align.center,

cFont: "Free3of9",

nFontSize:36,

aColor: color.black,

nStart: this.pageNum,

nOpacity: 1.0

});

SyntaxError: syntax error

1:Console:Exec

undefined

I can add the barcode if I use the UI to add the barcode, but seem to have a problem if I call this from JavaScript.

The console gives an error and nothing appears on the document.

Any idea what's going wrong?

This topic has been closed for replies.
Correct answer adcocko87332857

Thanks

I changed the font to a different version of the same barcode and it now works..

Cant really understand it.

Thanks for your help. try67

1 reply

try67
Community Expert
Community Expert
November 23, 2018

Did you select the entire code before running it?

On Fri, 23 Nov 2018 at 14:35, adcocko87332857 <forums_noreply@adobe.com>

Participant
November 23, 2018

Hi Try 67,

Yes I select the whole script.

The problem seems to be with the font.  I am trying to use a truetype font for the barcode.

I am using the postscript font name, but it seems not able to use it.

Any ideas what i could try ?

try67
Community Expert
Community Expert
November 23, 2018

That's not the issue, at least not the one causing this error message... This message means there's something wrong with the syntax of your code. I ran it on my machine, without having this font installed, and it worked just fine. It just used Courier as the font, by default.