• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Problem adding a barcode with Javascript.

Community Beginner ,
Nov 23, 2018 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?

TOPICS
Acrobat SDK and JavaScript , Windows

Views

335

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
community guidelines

correct answers 1 Correct answer

Community Beginner , Nov 23, 2018 Nov 23, 2018

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​

Votes

Translate

Translate
Community Expert ,
Nov 23, 2018 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>

Votes

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
community guidelines
Community Beginner ,
Nov 23, 2018 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 ?

Votes

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
community guidelines
Community Expert ,
Nov 23, 2018 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.

Votes

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
community guidelines
Community Expert ,
Nov 23, 2018 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...

Votes

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
community guidelines
Community Beginner ,
Nov 23, 2018 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​

Votes

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
community guidelines
Community Expert ,
Nov 23, 2018 Nov 23, 2018

Copy link to clipboard

Copied

LATEST

Weird, but glad to hear it's working!

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

Votes

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
community guidelines