Problem adding a barcode with Javascript.

Community Beginner ,
Nov 23, 2018

Copy link to clipboard

Copied

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?

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

TOPICS
Acrobat SDK and JavaScript, Windows

Views

108

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Problem adding a barcode with Javascript.

Community Beginner ,
Nov 23, 2018

Copy link to clipboard

Copied

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?

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

TOPICS
Acrobat SDK and JavaScript, Windows

Views

109

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Nov 23, 2018 0
Most Valuable Participant ,
Nov 23, 2018

Copy link to clipboard

Copied

Did you select the entire code before running it?

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Nov 23, 2018 0
Community Beginner ,
Nov 23, 2018

Copy link to clipboard

Copied

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 ?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Nov 23, 2018 0
Most Valuable Participant ,
Nov 23, 2018

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Nov 23, 2018 0
Most Valuable Participant ,
Nov 23, 2018

Copy link to clipboard

Copied

Maybe instead of running it from the console attach it to the mouse up event of a button field and then click it...

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Nov 23, 2018 0
Community Beginner ,
Nov 23, 2018

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Nov 23, 2018 0
try67 LATEST
Most Valuable Participant ,
Nov 23, 2018

Copy link to clipboard

Copied

Weird, but glad to hear it's working!

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Nov 23, 2018 0