aspose.barcode 25.3.1 → 25.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/AsposeBarcode.js
CHANGED
|
@@ -4,7 +4,7 @@ const joint_ = require('./Joint');
|
|
|
4
4
|
const complexbarcode_ = require("./ComplexBarcode");
|
|
5
5
|
const generation_ = require("./Generation");
|
|
6
6
|
const recognition_ = require("./Recognition");
|
|
7
|
-
const jar_name_ = "/aspose-barcode-nodejs-25.
|
|
7
|
+
const jar_name_ = "/aspose-barcode-nodejs-25.5.jar";
|
|
8
8
|
const jar_path_ = __dirname + jar_name_;
|
|
9
9
|
const fs = require("fs");
|
|
10
10
|
|
package/lib/Generation.js
CHANGED
|
@@ -5162,6 +5162,7 @@ class ImageParameters extends joint.BaseJavaClass
|
|
|
5162
5162
|
init()
|
|
5163
5163
|
{
|
|
5164
5164
|
this.svg = new SvgParameters(this.getJavaClass().getSvgSync());
|
|
5165
|
+
this.pdf = new PdfParameters(this.getJavaClass().getPdfSync());
|
|
5165
5166
|
}
|
|
5166
5167
|
|
|
5167
5168
|
/**
|
|
@@ -5175,10 +5176,30 @@ class ImageParameters extends joint.BaseJavaClass
|
|
|
5175
5176
|
/**
|
|
5176
5177
|
* SVG parameters
|
|
5177
5178
|
*/
|
|
5178
|
-
setSvg(
|
|
5179
|
+
setSvg(value)
|
|
5179
5180
|
{
|
|
5180
|
-
this.svg =
|
|
5181
|
-
this.getJavaClass().setSvgSync(
|
|
5181
|
+
this.svg = value;
|
|
5182
|
+
this.getJavaClass().setSvgSync(value.getJavaClass());
|
|
5183
|
+
}
|
|
5184
|
+
|
|
5185
|
+
/**
|
|
5186
|
+
* <p>
|
|
5187
|
+
* PDF parameters
|
|
5188
|
+
* </p>
|
|
5189
|
+
*/
|
|
5190
|
+
getPdf()
|
|
5191
|
+
{
|
|
5192
|
+
return this.pdf;
|
|
5193
|
+
}
|
|
5194
|
+
/**
|
|
5195
|
+
* <p>
|
|
5196
|
+
* PDF parameters
|
|
5197
|
+
* </p>
|
|
5198
|
+
*/
|
|
5199
|
+
setPdf(value)
|
|
5200
|
+
{
|
|
5201
|
+
this.pdf = value;
|
|
5202
|
+
this.getJavaClass().setPdf(value.getJavaClassSync());
|
|
5182
5203
|
}
|
|
5183
5204
|
}
|
|
5184
5205
|
|
|
@@ -5382,6 +5403,157 @@ class HslaColor
|
|
|
5382
5403
|
}
|
|
5383
5404
|
}
|
|
5384
5405
|
|
|
5406
|
+
/**
|
|
5407
|
+
* PDF parameters wrapper.
|
|
5408
|
+
* Expects an underlying `javaClass` instance that provides
|
|
5409
|
+
* the corresponding getter/setter methods returning/accepting
|
|
5410
|
+
* CMYK strings like "30_100_0_30" or `null`.
|
|
5411
|
+
*/
|
|
5412
|
+
class PdfParameters extends joint.BaseJavaClass
|
|
5413
|
+
{
|
|
5414
|
+
/**
|
|
5415
|
+
* @param {object} javaClass – instance of the Java PdfParameters class
|
|
5416
|
+
*/
|
|
5417
|
+
constructor(javaClass)
|
|
5418
|
+
{
|
|
5419
|
+
super(javaClass);
|
|
5420
|
+
this.javaClass = javaClass;
|
|
5421
|
+
}
|
|
5422
|
+
|
|
5423
|
+
/** no-op initializer */
|
|
5424
|
+
init() {}
|
|
5425
|
+
|
|
5426
|
+
/** @returns {CMYKColor|null} */
|
|
5427
|
+
getCMYKBarColor()
|
|
5428
|
+
{
|
|
5429
|
+
return raw == null ? null : CMYKColor.parseCMYK(this.getJavaClass().getCMYKBarColorSync());
|
|
5430
|
+
}
|
|
5431
|
+
|
|
5432
|
+
/** @param {CMYKColor|null} value */
|
|
5433
|
+
setCMYKBarColor(value)
|
|
5434
|
+
{
|
|
5435
|
+
this.getJavaClass().setCMYKBarColorSync(value != null ? value.formatCMYK() : null);
|
|
5436
|
+
}
|
|
5437
|
+
|
|
5438
|
+
/** @returns {CMYKColor|null} */
|
|
5439
|
+
getCMYKBackColor()
|
|
5440
|
+
{
|
|
5441
|
+
return raw == null ? null : CMYKColor.parseCMYK(this.getJavaClass().getCMYKBackColorSync());
|
|
5442
|
+
}
|
|
5443
|
+
|
|
5444
|
+
/** @param {CMYKColor|null} value */
|
|
5445
|
+
setCMYKBackColor(value)
|
|
5446
|
+
{
|
|
5447
|
+
this.getJavaClass().setCMYKBackColorSync(value != null ? value.formatCMYK() : null);
|
|
5448
|
+
}
|
|
5449
|
+
|
|
5450
|
+
/** @returns {CMYKColor|null} */
|
|
5451
|
+
getCMYKCodetextColor()
|
|
5452
|
+
{
|
|
5453
|
+
return raw == null ? null : CMYKColor.parseCMYK(this.getJavaClass().getCMYKCodetextColorSync());
|
|
5454
|
+
}
|
|
5455
|
+
|
|
5456
|
+
/** @param {CMYKColor|null} value */
|
|
5457
|
+
setCMYKCodetextColor(value)
|
|
5458
|
+
{
|
|
5459
|
+
this.getJavaClass().setCMYKCodetextColorSync(value != null ? value.formatCMYK() : null);
|
|
5460
|
+
}
|
|
5461
|
+
|
|
5462
|
+
/** @returns {CMYKColor|null} */
|
|
5463
|
+
getCMYKCaptionAboveColor() {
|
|
5464
|
+
return CMYKColor.parseCMYK(this.getJavaClass().getCMYKCaptionAboveColorSync());
|
|
5465
|
+
}
|
|
5466
|
+
|
|
5467
|
+
/** @param {CMYKColor|null} value */
|
|
5468
|
+
setCMYKCaptionAboveColor(value) {
|
|
5469
|
+
this.getJavaClass().setCMYKCaptionAboveColorSync(value != null ? value.formatCMYK() : null);
|
|
5470
|
+
}
|
|
5471
|
+
|
|
5472
|
+
/** @returns {CMYKColor|null} */
|
|
5473
|
+
getCMYKCaptionBelowColor()
|
|
5474
|
+
{
|
|
5475
|
+
return CMYKColor.parseCMYK(this.getJavaClass().getCMYKCaptionBelowColorSync());
|
|
5476
|
+
}
|
|
5477
|
+
|
|
5478
|
+
/** @param {CMYKColor|null} value */
|
|
5479
|
+
setCMYKCaptionBelowColor(value)
|
|
5480
|
+
{
|
|
5481
|
+
this.getJavaClass().setCMYKCaptionBelowColorSync(value.formatCMYK());
|
|
5482
|
+
}
|
|
5483
|
+
}
|
|
5484
|
+
|
|
5485
|
+
/**
|
|
5486
|
+
* Class for CMYK color. A null instance means CMYK is not used, and
|
|
5487
|
+
* default RGB color is in use.
|
|
5488
|
+
*/
|
|
5489
|
+
class CMYKColor {
|
|
5490
|
+
/**
|
|
5491
|
+
* Initializes a new instance of the CMYKColor class from CMYK values.
|
|
5492
|
+
* CMYK values are expected in the range 0–100.
|
|
5493
|
+
*
|
|
5494
|
+
* @param {number} c – Cyan value [0, 100]
|
|
5495
|
+
* @param {number} m – Magenta value [0, 100]
|
|
5496
|
+
* @param {number} y – Yellow value [0, 100]
|
|
5497
|
+
* @param {number} k – Black value [0, 100]
|
|
5498
|
+
*/
|
|
5499
|
+
constructor(c, m, y, k) {
|
|
5500
|
+
// Clamp to [0, 100]
|
|
5501
|
+
this.C = Math.min(100, Math.max(0, c)) / 100.0;
|
|
5502
|
+
this.M = Math.min(100, Math.max(0, m)) / 100.0;
|
|
5503
|
+
this.Y = Math.min(100, Math.max(0, y)) / 100.0;
|
|
5504
|
+
this.K = Math.min(100, Math.max(0, k)) / 100.0;
|
|
5505
|
+
}
|
|
5506
|
+
|
|
5507
|
+
/**
|
|
5508
|
+
* Parse a CMYK string of the form "C_M_Y_K" into a CMYKColor instance.
|
|
5509
|
+
*
|
|
5510
|
+
* @param {string} str – a string like "30_100_0_30"
|
|
5511
|
+
* @returns {CMYKColor}
|
|
5512
|
+
* @throws {Error} if the format is invalid or values are not numeric
|
|
5513
|
+
*/
|
|
5514
|
+
static parseCMYK(str) {
|
|
5515
|
+
const parts = str.split('_');
|
|
5516
|
+
if (parts.length !== 4) {
|
|
5517
|
+
throw new Error(`Invalid CMYK string: expected 4 parts but got ${parts.length}`);
|
|
5518
|
+
}
|
|
5519
|
+
|
|
5520
|
+
const nums = parts.map((s, i) => {
|
|
5521
|
+
const v = parseFloat(s);
|
|
5522
|
+
if (Number.isNaN(v)) {
|
|
5523
|
+
throw new Error(`Invalid number in CMYK string at index ${i}: "${s}"`);
|
|
5524
|
+
}
|
|
5525
|
+
return v;
|
|
5526
|
+
});
|
|
5527
|
+
|
|
5528
|
+
return new CMYKColor(nums[0], nums[1], nums[2], nums[3]);
|
|
5529
|
+
}
|
|
5530
|
+
|
|
5531
|
+
/**
|
|
5532
|
+
* Format this CMYKColor into a string "C_M_Y_K",
|
|
5533
|
+
* multiplying each internal component (0–1) by 100 and rounding.
|
|
5534
|
+
*
|
|
5535
|
+
* @returns {string} e.g. "30_100_0_30"
|
|
5536
|
+
*/
|
|
5537
|
+
formatCMYK() {
|
|
5538
|
+
const c = Math.round(this.C * 100);
|
|
5539
|
+
const m = Math.round(this.M * 100);
|
|
5540
|
+
const y = Math.round(this.Y * 100);
|
|
5541
|
+
const k = Math.round(this.K * 100);
|
|
5542
|
+
return `${c}_${m}_${y}_${k}`;
|
|
5543
|
+
}
|
|
5544
|
+
|
|
5545
|
+
/**
|
|
5546
|
+
* Optional: a human-readable representation.
|
|
5547
|
+
*/
|
|
5548
|
+
toString() {
|
|
5549
|
+
const c = Math.round(this.C * 100);
|
|
5550
|
+
const m = Math.round(this.M * 100);
|
|
5551
|
+
const y = Math.round(this.Y * 100);
|
|
5552
|
+
const k = Math.round(this.K * 100);
|
|
5553
|
+
return `CMYKColor(C=${c}%, M=${m}%, Y=${y}%, K=${k}%)`;
|
|
5554
|
+
}
|
|
5555
|
+
}
|
|
5556
|
+
|
|
5385
5557
|
/**
|
|
5386
5558
|
* BarcodeClassifications EncodeTypes classification
|
|
5387
5559
|
* @enum
|
|
@@ -9541,5 +9713,7 @@ module.exports = {
|
|
|
9541
9713
|
HslaColor,
|
|
9542
9714
|
SvgColorMode,
|
|
9543
9715
|
MaxiCodeMode,
|
|
9544
|
-
MaxiCodeEncodeMode
|
|
9716
|
+
MaxiCodeEncodeMode,
|
|
9717
|
+
PdfParameters,
|
|
9718
|
+
CMYKColor
|
|
9545
9719
|
};
|
|
Binary file
|