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

Why does the dialog box show the page number with additional 6 zeros?

Community Beginner ,
Mar 31, 2021 Mar 31, 2021

Copy link to clipboard

Copied

I would like to display the page number of the current document in a dialog box. However, in the dialog box the page number always appears with a decimal point and six zeros. For a 64-page document I get the indication: 64.000000. Why is that? Since I want to continue calculating with this specification, I need the number without the decimal point and without the zeros.

// Dialog Definition
var oDlg = {
	strName1: "",
	initialize: function (dialog) {
		dialog.load({
			"page": this.strName1,
		});
	},
	commit: function (dialog) {
		var data = dialog.store();
		this.strName1 = data["page"];
	},
	description: {
		name: "Window titel",
		elements:
		[{
				type: "view",
				elements:
				[{
						type: "cluster",
						name: "Page count",
						align_children: "align_left",
						elements:
						[{
								type: "view",
								elements: [{
										type: "static_text",
										name: "Pages in this document:         ",
									}, {
										item_id: "page",
										type: "edit_text",
										readonly: "true",
										char_width: 25,
									}
								]
							},
						]
					}, {
						type: "ok_cancel",
					},
				]
			},
		]
	}
};

// Dialog Activation
oDlg.strName1 = this.numPages;
if ("ok" == app.execDialog(oDlg)) {
	console.println("Lin1: " + oDlg.strName1);
}

 

Does anyone have a hint for me why the dialog box does not display the page number correctly?

 

Regards

yosimo

TOPICS
Acrobat SDK and JavaScript , Windows

Views

352

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 Expert , Mar 31, 2021 Mar 31, 2021

That's how numbers are displayed in the dialog object.

To change it you need to convert the value to a string. You can do so by changing this line:

"page": this.strName1,

To this:

"page": ""+this.strName1,

Votes

Translate

Translate
Community Expert ,
Mar 31, 2021 Mar 31, 2021

Copy link to clipboard

Copied

That's how numbers are displayed in the dialog object.

To change it you need to convert the value to a string. You can do so by changing this line:

"page": this.strName1,

To this:

"page": ""+this.strName1,

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 ,
Mar 31, 2021 Mar 31, 2021

Copy link to clipboard

Copied

LATEST

Ohh yes, that works.

Thank you very much.

 

Regards

Yosimo

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