Skip to main content
Participant
Nov 23, 2018 1:35 PM UTC
Answered

Problem adding a barcode with Javascript.

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 is closed to new replies. Start a new post to keep the conversation going.
adcocko87332857Correct answer
Participant
Nov 23, 2018 3:01 PM UTC

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​

6 replies

try67
Community Expert
Community Expert
Nov 23, 2018 2:35 PM UTC

Did you select the entire code before running it?

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

Translate
Participant
Nov 23, 2018 2:41 PM UTC

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 ?

Translate
try67
Community Expert
Community Expert
Nov 23, 2018 2:44 PM UTC

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.

Translate