modern-pdf-lib 0.31.0 → 0.32.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.
@@ -546,7 +546,7 @@ const NS_PDFAID = "http://www.aiim.org/pdfa/ns/id/";
546
546
  * Escape special characters for XML text content.
547
547
  * @internal
548
548
  */
549
- function escapeXml$4(str) {
549
+ function escapeXml$5(str) {
550
550
  const parts = [];
551
551
  for (let i = 0; i < str.length; i++) {
552
552
  const c = str.charCodeAt(i);
@@ -594,14 +594,14 @@ function buildXmpMetadata(meta) {
594
594
  if (meta.title !== void 0) {
595
595
  lines.push(" <dc:title>");
596
596
  lines.push(" <rdf:Alt>");
597
- lines.push(` <rdf:li xml:lang="x-default">${escapeXml$4(meta.title)}</rdf:li>`);
597
+ lines.push(` <rdf:li xml:lang="x-default">${escapeXml$5(meta.title)}</rdf:li>`);
598
598
  lines.push(" </rdf:Alt>");
599
599
  lines.push(" </dc:title>");
600
600
  }
601
601
  if (meta.author !== void 0) {
602
602
  lines.push(" <dc:creator>");
603
603
  lines.push(" <rdf:Seq>");
604
- lines.push(` <rdf:li>${escapeXml$4(meta.author)}</rdf:li>`);
604
+ lines.push(` <rdf:li>${escapeXml$5(meta.author)}</rdf:li>`);
605
605
  lines.push(" </rdf:Seq>");
606
606
  lines.push(" </dc:creator>");
607
607
  }
@@ -611,7 +611,7 @@ function buildXmpMetadata(meta) {
611
611
  lines.push(" <rdf:Bag>");
612
612
  for (const kw of keywords) {
613
613
  const trimmed = kw.trim();
614
- if (trimmed.length > 0) lines.push(` <rdf:li>${escapeXml$4(trimmed)}</rdf:li>`);
614
+ if (trimmed.length > 0) lines.push(` <rdf:li>${escapeXml$5(trimmed)}</rdf:li>`);
615
615
  }
616
616
  lines.push(" </rdf:Bag>");
617
617
  lines.push(" </dc:subject>");
@@ -619,15 +619,15 @@ function buildXmpMetadata(meta) {
619
619
  if (meta.subject !== void 0) {
620
620
  lines.push(" <dc:description>");
621
621
  lines.push(" <rdf:Alt>");
622
- lines.push(` <rdf:li xml:lang="x-default">${escapeXml$4(meta.subject)}</rdf:li>`);
622
+ lines.push(` <rdf:li xml:lang="x-default">${escapeXml$5(meta.subject)}</rdf:li>`);
623
623
  lines.push(" </rdf:Alt>");
624
624
  lines.push(" </dc:description>");
625
625
  }
626
- if (meta.creator !== void 0) lines.push(` <xmp:CreatorTool>${escapeXml$4(meta.creator)}</xmp:CreatorTool>`);
626
+ if (meta.creator !== void 0) lines.push(` <xmp:CreatorTool>${escapeXml$5(meta.creator)}</xmp:CreatorTool>`);
627
627
  if (meta.creationDate !== void 0) lines.push(` <xmp:CreateDate>${formatXmpDate(meta.creationDate)}</xmp:CreateDate>`);
628
628
  if (meta.modDate !== void 0) lines.push(` <xmp:ModifyDate>${formatXmpDate(meta.modDate)}</xmp:ModifyDate>`);
629
- if (meta.producer !== void 0) lines.push(` <pdf:Producer>${escapeXml$4(meta.producer)}</pdf:Producer>`);
630
- if (meta.keywords !== void 0) lines.push(` <pdf:Keywords>${escapeXml$4(meta.keywords)}</pdf:Keywords>`);
629
+ if (meta.producer !== void 0) lines.push(` <pdf:Producer>${escapeXml$5(meta.producer)}</pdf:Producer>`);
630
+ if (meta.keywords !== void 0) lines.push(` <pdf:Keywords>${escapeXml$5(meta.keywords)}</pdf:Keywords>`);
631
631
  lines.push("</rdf:Description>");
632
632
  lines.push("</rdf:RDF>");
633
633
  lines.push("</x:xmpmeta>");
@@ -7019,7 +7019,7 @@ function countMatches(text, regex) {
7019
7019
  //#region src/compliance/xmpGenerator.ts
7020
7020
  const encoder$2 = new TextEncoder();
7021
7021
  /** Escape XML special characters in a string. */
7022
- function escapeXml$3(str) {
7022
+ function escapeXml$4(str) {
7023
7023
  return str.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll("\"", "&quot;").replaceAll("'", "&apos;");
7024
7024
  }
7025
7025
  /**
@@ -7053,35 +7053,35 @@ function generatePdfAXmp(options) {
7053
7053
  if (options.title) {
7054
7054
  xmp += " <dc:title>\n";
7055
7055
  xmp += " <rdf:Alt>\n";
7056
- xmp += ` <rdf:li xml:lang="${lang}">${escapeXml$3(options.title)}</rdf:li>\n`;
7056
+ xmp += ` <rdf:li xml:lang="${lang}">${escapeXml$4(options.title)}</rdf:li>\n`;
7057
7057
  xmp += " </rdf:Alt>\n";
7058
7058
  xmp += " </dc:title>\n";
7059
7059
  }
7060
7060
  if (options.author) {
7061
7061
  xmp += " <dc:creator>\n";
7062
7062
  xmp += " <rdf:Seq>\n";
7063
- xmp += ` <rdf:li>${escapeXml$3(options.author)}</rdf:li>\n`;
7063
+ xmp += ` <rdf:li>${escapeXml$4(options.author)}</rdf:li>\n`;
7064
7064
  xmp += " </rdf:Seq>\n";
7065
7065
  xmp += " </dc:creator>\n";
7066
7066
  }
7067
7067
  if (options.subject) {
7068
7068
  xmp += " <dc:description>\n";
7069
7069
  xmp += " <rdf:Alt>\n";
7070
- xmp += ` <rdf:li xml:lang="${lang}">${escapeXml$3(options.subject)}</rdf:li>\n`;
7070
+ xmp += ` <rdf:li xml:lang="${lang}">${escapeXml$4(options.subject)}</rdf:li>\n`;
7071
7071
  xmp += " </rdf:Alt>\n";
7072
7072
  xmp += " </dc:description>\n";
7073
7073
  }
7074
7074
  xmp += " </rdf:Description>\n";
7075
7075
  xmp += " <rdf:Description rdf:about=\"\"\n";
7076
7076
  xmp += " xmlns:xmp=\"http://ns.adobe.com/xap/1.0/\">\n";
7077
- xmp += ` <xmp:CreatorTool>${escapeXml$3(creatorTool)}</xmp:CreatorTool>\n`;
7077
+ xmp += ` <xmp:CreatorTool>${escapeXml$4(creatorTool)}</xmp:CreatorTool>\n`;
7078
7078
  xmp += ` <xmp:CreateDate>${createDate}</xmp:CreateDate>\n`;
7079
7079
  xmp += ` <xmp:ModifyDate>${modifyDate}</xmp:ModifyDate>\n`;
7080
7080
  xmp += " </rdf:Description>\n";
7081
7081
  xmp += " <rdf:Description rdf:about=\"\"\n";
7082
7082
  xmp += " xmlns:pdf=\"http://ns.adobe.com/pdf/1.3/\">\n";
7083
- xmp += ` <pdf:Producer>${escapeXml$3(producer)}</pdf:Producer>\n`;
7084
- if (options.keywords) xmp += ` <pdf:Keywords>${escapeXml$3(options.keywords)}</pdf:Keywords>\n`;
7083
+ xmp += ` <pdf:Producer>${escapeXml$4(producer)}</pdf:Producer>\n`;
7084
+ if (options.keywords) xmp += ` <pdf:Keywords>${escapeXml$4(options.keywords)}</pdf:Keywords>\n`;
7085
7085
  xmp += " </rdf:Description>\n";
7086
7086
  xmp += " </rdf:RDF>\n";
7087
7087
  xmp += "</x:xmpmeta>\n";
@@ -20875,7 +20875,7 @@ const VAT_CATEGORY_STANDARD$1 = "S";
20875
20875
  /** Unit code C62 = "one" (unitless piece, UN/ECE Rec 20). */
20876
20876
  const UNIT_CODE_ONE$1 = "C62";
20877
20877
  /** Escape XML special characters in a text value. */
20878
- function escapeXml$2(str) {
20878
+ function escapeXml$3(str) {
20879
20879
  return str.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll("\"", "&quot;").replaceAll("'", "&apos;");
20880
20880
  }
20881
20881
  /** Format a numeric monetary/quantity value with two decimal places. */
@@ -20933,13 +20933,13 @@ function computeTotals$1(lines) {
20933
20933
  /** Render a single trade party block (Seller or Buyer). */
20934
20934
  function renderParty$1(party, indent) {
20935
20935
  const lines = [];
20936
- lines.push(`${indent}<ram:Name>${escapeXml$2(party.name)}</ram:Name>`);
20936
+ lines.push(`${indent}<ram:Name>${escapeXml$3(party.name)}</ram:Name>`);
20937
20937
  lines.push(`${indent}<ram:PostalTradeAddress>`);
20938
- lines.push(`${indent} <ram:CountryID>${escapeXml$2(party.countryCode)}</ram:CountryID>`);
20938
+ lines.push(`${indent} <ram:CountryID>${escapeXml$3(party.countryCode)}</ram:CountryID>`);
20939
20939
  lines.push(`${indent}</ram:PostalTradeAddress>`);
20940
20940
  if (party.vatId !== void 0 && party.vatId !== "") {
20941
20941
  lines.push(`${indent}<ram:SpecifiedTaxRegistration>`);
20942
- lines.push(`${indent} <ram:ID schemeID="VA">${escapeXml$2(party.vatId)}</ram:ID>`);
20942
+ lines.push(`${indent} <ram:ID schemeID="VA">${escapeXml$3(party.vatId)}</ram:ID>`);
20943
20943
  lines.push(`${indent}</ram:SpecifiedTaxRegistration>`);
20944
20944
  }
20945
20945
  return lines.join("\n");
@@ -20953,7 +20953,7 @@ function renderLine$2(line, index, currency) {
20953
20953
  out.push(` <ram:LineID>${index}</ram:LineID>`);
20954
20954
  out.push(" </ram:AssociatedDocumentLineDocument>");
20955
20955
  out.push(" <ram:SpecifiedTradeProduct>");
20956
- out.push(` <ram:Name>${escapeXml$2(line.description)}</ram:Name>`);
20956
+ out.push(` <ram:Name>${escapeXml$3(line.description)}</ram:Name>`);
20957
20957
  out.push(" </ram:SpecifiedTradeProduct>");
20958
20958
  out.push(" <ram:SpecifiedLineTradeAgreement>");
20959
20959
  out.push(" <ram:NetPriceProductTradePrice>");
@@ -20970,7 +20970,7 @@ function renderLine$2(line, index, currency) {
20970
20970
  out.push(` <ram:RateApplicablePercent>${formatPercent$1(line.taxPercent)}</ram:RateApplicablePercent>`);
20971
20971
  out.push(" </ram:ApplicableTradeTax>");
20972
20972
  out.push(" <ram:SpecifiedTradeSettlementLineMonetarySummation>");
20973
- out.push(` <ram:LineTotalAmount currencyID="${escapeXml$2(currency)}">${formatAmount$1(net)}</ram:LineTotalAmount>`);
20973
+ out.push(` <ram:LineTotalAmount currencyID="${escapeXml$3(currency)}">${formatAmount$1(net)}</ram:LineTotalAmount>`);
20974
20974
  out.push(" </ram:SpecifiedTradeSettlementLineMonetarySummation>");
20975
20975
  out.push(" </ram:SpecifiedLineTradeSettlement>");
20976
20976
  out.push(" </ram:IncludedSupplyChainTradeLineItem>");
@@ -20980,9 +20980,9 @@ function renderLine$2(line, index, currency) {
20980
20980
  function renderTaxGroup$1(group, currency) {
20981
20981
  const out = [];
20982
20982
  out.push(" <ram:ApplicableTradeTax>");
20983
- out.push(` <ram:CalculatedAmount currencyID="${escapeXml$2(currency)}">${formatAmount$1(group.taxAmount)}</ram:CalculatedAmount>`);
20983
+ out.push(` <ram:CalculatedAmount currencyID="${escapeXml$3(currency)}">${formatAmount$1(group.taxAmount)}</ram:CalculatedAmount>`);
20984
20984
  out.push(" <ram:TypeCode>VAT</ram:TypeCode>");
20985
- out.push(` <ram:BasisAmount currencyID="${escapeXml$2(currency)}">${formatAmount$1(group.basisAmount)}</ram:BasisAmount>`);
20985
+ out.push(` <ram:BasisAmount currencyID="${escapeXml$3(currency)}">${formatAmount$1(group.basisAmount)}</ram:BasisAmount>`);
20986
20986
  out.push(` <ram:CategoryCode>${VAT_CATEGORY_STANDARD$1}</ram:CategoryCode>`);
20987
20987
  out.push(` <ram:RateApplicablePercent>${formatPercent$1(group.taxPercent)}</ram:RateApplicablePercent>`);
20988
20988
  out.push(" </ram:ApplicableTradeTax>");
@@ -21010,11 +21010,11 @@ function generateCiiXml(invoice, profile = "EN16931") {
21010
21010
  out.push("<rsm:CrossIndustryInvoice xmlns:rsm=\"urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100\" xmlns:ram=\"urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100\" xmlns:udt=\"urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100\">");
21011
21011
  out.push(" <rsm:ExchangedDocumentContext>");
21012
21012
  out.push(" <ram:GuidelineSpecifiedDocumentContextParameter>");
21013
- out.push(` <ram:ID>${escapeXml$2(guidelineUrn)}</ram:ID>`);
21013
+ out.push(` <ram:ID>${escapeXml$3(guidelineUrn)}</ram:ID>`);
21014
21014
  out.push(" </ram:GuidelineSpecifiedDocumentContextParameter>");
21015
21015
  out.push(" </rsm:ExchangedDocumentContext>");
21016
21016
  out.push(" <rsm:ExchangedDocument>");
21017
- out.push(` <ram:ID>${escapeXml$2(invoice.invoiceNumber)}</ram:ID>`);
21017
+ out.push(` <ram:ID>${escapeXml$3(invoice.invoiceNumber)}</ram:ID>`);
21018
21018
  out.push(` <ram:TypeCode>${COMMERCIAL_INVOICE_TYPE_CODE$1}</ram:TypeCode>`);
21019
21019
  out.push(" <ram:IssueDateTime>");
21020
21020
  out.push(` <udt:DateTimeString format="102">${toDateString102$1(invoice.issueDate)}</udt:DateTimeString>`);
@@ -21032,14 +21032,14 @@ function generateCiiXml(invoice, profile = "EN16931") {
21032
21032
  out.push(" </ram:ApplicableHeaderTradeAgreement>");
21033
21033
  out.push(" <ram:ApplicableHeaderTradeDelivery/>");
21034
21034
  out.push(" <ram:ApplicableHeaderTradeSettlement>");
21035
- out.push(` <ram:InvoiceCurrencyCode>${escapeXml$2(currency)}</ram:InvoiceCurrencyCode>`);
21035
+ out.push(` <ram:InvoiceCurrencyCode>${escapeXml$3(currency)}</ram:InvoiceCurrencyCode>`);
21036
21036
  for (const group of totals.taxGroups) out.push(renderTaxGroup$1(group, currency));
21037
21037
  out.push(" <ram:SpecifiedTradeSettlementHeaderMonetarySummation>");
21038
- out.push(` <ram:LineTotalAmount currencyID="${escapeXml$2(currency)}">${formatAmount$1(totals.lineTotal)}</ram:LineTotalAmount>`);
21039
- out.push(` <ram:TaxBasisTotalAmount currencyID="${escapeXml$2(currency)}">${formatAmount$1(totals.lineTotal)}</ram:TaxBasisTotalAmount>`);
21040
- out.push(` <ram:TaxTotalAmount currencyID="${escapeXml$2(currency)}">${formatAmount$1(totals.taxTotal)}</ram:TaxTotalAmount>`);
21041
- out.push(` <ram:GrandTotalAmount currencyID="${escapeXml$2(currency)}">${formatAmount$1(totals.grandTotal)}</ram:GrandTotalAmount>`);
21042
- out.push(` <ram:DuePayableAmount currencyID="${escapeXml$2(currency)}">${formatAmount$1(totals.duePayable)}</ram:DuePayableAmount>`);
21038
+ out.push(` <ram:LineTotalAmount currencyID="${escapeXml$3(currency)}">${formatAmount$1(totals.lineTotal)}</ram:LineTotalAmount>`);
21039
+ out.push(` <ram:TaxBasisTotalAmount currencyID="${escapeXml$3(currency)}">${formatAmount$1(totals.lineTotal)}</ram:TaxBasisTotalAmount>`);
21040
+ out.push(` <ram:TaxTotalAmount currencyID="${escapeXml$3(currency)}">${formatAmount$1(totals.taxTotal)}</ram:TaxTotalAmount>`);
21041
+ out.push(` <ram:GrandTotalAmount currencyID="${escapeXml$3(currency)}">${formatAmount$1(totals.grandTotal)}</ram:GrandTotalAmount>`);
21042
+ out.push(` <ram:DuePayableAmount currencyID="${escapeXml$3(currency)}">${formatAmount$1(totals.duePayable)}</ram:DuePayableAmount>`);
21043
21043
  out.push(" </ram:SpecifiedTradeSettlementHeaderMonetarySummation>");
21044
21044
  out.push(" </ram:ApplicableHeaderTradeSettlement>");
21045
21045
  out.push(" </rsm:SupplyChainTradeTransaction>");
@@ -21261,7 +21261,7 @@ const PDFA4_PART = 4;
21261
21261
  /** PDF/A-4 revision year (`pdfaid:rev`). */
21262
21262
  const PDFA4_REV = "2020";
21263
21263
  /** Escape XML special characters in a string. */
21264
- function escapeXml$1(str) {
21264
+ function escapeXml$2(str) {
21265
21265
  return str.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll("\"", "&quot;").replaceAll("'", "&apos;");
21266
21266
  }
21267
21267
  /**
@@ -21279,17 +21279,17 @@ function conformanceFor(level) {
21279
21279
  function renderExtensionSchema(s) {
21280
21280
  let out = "";
21281
21281
  out += " <rdf:li rdf:parseType=\"Resource\">\n";
21282
- out += ` <pdfaSchema:schema>${escapeXml$1(s.schema)}</pdfaSchema:schema>\n`;
21283
- out += ` <pdfaSchema:namespaceURI>${escapeXml$1(s.namespaceUri)}</pdfaSchema:namespaceURI>\n`;
21284
- out += ` <pdfaSchema:prefix>${escapeXml$1(s.prefix)}</pdfaSchema:prefix>\n`;
21282
+ out += ` <pdfaSchema:schema>${escapeXml$2(s.schema)}</pdfaSchema:schema>\n`;
21283
+ out += ` <pdfaSchema:namespaceURI>${escapeXml$2(s.namespaceUri)}</pdfaSchema:namespaceURI>\n`;
21284
+ out += ` <pdfaSchema:prefix>${escapeXml$2(s.prefix)}</pdfaSchema:prefix>\n`;
21285
21285
  out += " <pdfaSchema:property>\n";
21286
21286
  out += " <rdf:Seq>\n";
21287
21287
  for (const p of s.properties) {
21288
21288
  out += " <rdf:li rdf:parseType=\"Resource\">\n";
21289
- out += ` <pdfaProperty:name>${escapeXml$1(p.name)}</pdfaProperty:name>\n`;
21290
- out += ` <pdfaProperty:valueType>${escapeXml$1(p.valueType)}</pdfaProperty:valueType>\n`;
21289
+ out += ` <pdfaProperty:name>${escapeXml$2(p.name)}</pdfaProperty:name>\n`;
21290
+ out += ` <pdfaProperty:valueType>${escapeXml$2(p.valueType)}</pdfaProperty:valueType>\n`;
21291
21291
  out += ` <pdfaProperty:category>${p.category}</pdfaProperty:category>\n`;
21292
- out += ` <pdfaProperty:description>${escapeXml$1(p.description)}</pdfaProperty:description>\n`;
21292
+ out += ` <pdfaProperty:description>${escapeXml$2(p.description)}</pdfaProperty:description>\n`;
21293
21293
  out += " </rdf:li>\n";
21294
21294
  }
21295
21295
  out += " </rdf:Seq>\n";
@@ -21326,7 +21326,7 @@ function buildPdfA4Xmp(options) {
21326
21326
  xmp += " xmlns:dc=\"http://purl.org/dc/elements/1.1/\">\n";
21327
21327
  xmp += " <dc:title>\n";
21328
21328
  xmp += " <rdf:Alt>\n";
21329
- xmp += ` <rdf:li xml:lang="x-default">${escapeXml$1(title)}</rdf:li>\n`;
21329
+ xmp += ` <rdf:li xml:lang="x-default">${escapeXml$2(title)}</rdf:li>\n`;
21330
21330
  xmp += " </rdf:Alt>\n";
21331
21331
  xmp += " </dc:title>\n";
21332
21332
  xmp += " </rdf:Description>\n";
@@ -21400,7 +21400,7 @@ const ORDER_X_TYPE_CODES = {
21400
21400
  OrderResponse: ORDER_RESPONSE_TYPE_CODE
21401
21401
  };
21402
21402
  /** Escape XML special characters in a text value. */
21403
- function escapeXml(str) {
21403
+ function escapeXml$1(str) {
21404
21404
  return str.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll("\"", "&quot;").replaceAll("'", "&apos;");
21405
21405
  }
21406
21406
  /** Format a numeric monetary/quantity value with two decimal places. */
@@ -21457,13 +21457,13 @@ function computeTotals(lines) {
21457
21457
  /** Render a single trade party block (Seller or Buyer). */
21458
21458
  function renderParty(party, indent) {
21459
21459
  const out = [];
21460
- out.push(`${indent}<ram:Name>${escapeXml(party.name)}</ram:Name>`);
21460
+ out.push(`${indent}<ram:Name>${escapeXml$1(party.name)}</ram:Name>`);
21461
21461
  out.push(`${indent}<ram:PostalTradeAddress>`);
21462
- out.push(`${indent} <ram:CountryID>${escapeXml(party.countryCode)}</ram:CountryID>`);
21462
+ out.push(`${indent} <ram:CountryID>${escapeXml$1(party.countryCode)}</ram:CountryID>`);
21463
21463
  out.push(`${indent}</ram:PostalTradeAddress>`);
21464
21464
  if (party.vatId !== void 0 && party.vatId !== "") {
21465
21465
  out.push(`${indent}<ram:SpecifiedTaxRegistration>`);
21466
- out.push(`${indent} <ram:ID schemeID="VA">${escapeXml(party.vatId)}</ram:ID>`);
21466
+ out.push(`${indent} <ram:ID schemeID="VA">${escapeXml$1(party.vatId)}</ram:ID>`);
21467
21467
  out.push(`${indent}</ram:SpecifiedTaxRegistration>`);
21468
21468
  }
21469
21469
  return out.join("\n");
@@ -21477,7 +21477,7 @@ function renderLine$1(line, index, currency) {
21477
21477
  out.push(` <ram:LineID>${index}</ram:LineID>`);
21478
21478
  out.push(" </ram:AssociatedDocumentLineDocument>");
21479
21479
  out.push(" <ram:SpecifiedTradeProduct>");
21480
- out.push(` <ram:Name>${escapeXml(line.description)}</ram:Name>`);
21480
+ out.push(` <ram:Name>${escapeXml$1(line.description)}</ram:Name>`);
21481
21481
  out.push(" </ram:SpecifiedTradeProduct>");
21482
21482
  out.push(" <ram:SpecifiedLineTradeAgreement>");
21483
21483
  out.push(" <ram:NetPriceProductTradePrice>");
@@ -21494,7 +21494,7 @@ function renderLine$1(line, index, currency) {
21494
21494
  out.push(` <ram:RateApplicablePercent>${formatPercent(line.taxPercent)}</ram:RateApplicablePercent>`);
21495
21495
  out.push(" </ram:ApplicableTradeTax>");
21496
21496
  out.push(" <ram:SpecifiedTradeSettlementLineMonetarySummation>");
21497
- out.push(` <ram:LineTotalAmount currencyID="${escapeXml(currency)}">${formatAmount(net)}</ram:LineTotalAmount>`);
21497
+ out.push(` <ram:LineTotalAmount currencyID="${escapeXml$1(currency)}">${formatAmount(net)}</ram:LineTotalAmount>`);
21498
21498
  out.push(" </ram:SpecifiedTradeSettlementLineMonetarySummation>");
21499
21499
  out.push(" </ram:SpecifiedLineTradeSettlement>");
21500
21500
  out.push(" </ram:IncludedSupplyChainTradeLineItem>");
@@ -21504,9 +21504,9 @@ function renderLine$1(line, index, currency) {
21504
21504
  function renderTaxGroup(group, currency) {
21505
21505
  const out = [];
21506
21506
  out.push(" <ram:ApplicableTradeTax>");
21507
- out.push(` <ram:CalculatedAmount currencyID="${escapeXml(currency)}">${formatAmount(group.taxAmount)}</ram:CalculatedAmount>`);
21507
+ out.push(` <ram:CalculatedAmount currencyID="${escapeXml$1(currency)}">${formatAmount(group.taxAmount)}</ram:CalculatedAmount>`);
21508
21508
  out.push(" <ram:TypeCode>VAT</ram:TypeCode>");
21509
- out.push(` <ram:BasisAmount currencyID="${escapeXml(currency)}">${formatAmount(group.basisAmount)}</ram:BasisAmount>`);
21509
+ out.push(` <ram:BasisAmount currencyID="${escapeXml$1(currency)}">${formatAmount(group.basisAmount)}</ram:BasisAmount>`);
21510
21510
  out.push(` <ram:CategoryCode>${VAT_CATEGORY_STANDARD}</ram:CategoryCode>`);
21511
21511
  out.push(` <ram:RateApplicablePercent>${formatPercent(group.taxPercent)}</ram:RateApplicablePercent>`);
21512
21512
  out.push(" </ram:ApplicableTradeTax>");
@@ -21516,11 +21516,11 @@ function renderTaxGroup(group, currency) {
21516
21516
  function renderMonetarySummation(totals, currency) {
21517
21517
  const out = [];
21518
21518
  out.push(" <ram:SpecifiedTradeSettlementHeaderMonetarySummation>");
21519
- out.push(` <ram:LineTotalAmount currencyID="${escapeXml(currency)}">${formatAmount(totals.lineTotal)}</ram:LineTotalAmount>`);
21520
- out.push(` <ram:TaxBasisTotalAmount currencyID="${escapeXml(currency)}">${formatAmount(totals.lineTotal)}</ram:TaxBasisTotalAmount>`);
21521
- out.push(` <ram:TaxTotalAmount currencyID="${escapeXml(currency)}">${formatAmount(totals.taxTotal)}</ram:TaxTotalAmount>`);
21522
- out.push(` <ram:GrandTotalAmount currencyID="${escapeXml(currency)}">${formatAmount(totals.grandTotal)}</ram:GrandTotalAmount>`);
21523
- out.push(` <ram:DuePayableAmount currencyID="${escapeXml(currency)}">${formatAmount(totals.duePayable)}</ram:DuePayableAmount>`);
21519
+ out.push(` <ram:LineTotalAmount currencyID="${escapeXml$1(currency)}">${formatAmount(totals.lineTotal)}</ram:LineTotalAmount>`);
21520
+ out.push(` <ram:TaxBasisTotalAmount currencyID="${escapeXml$1(currency)}">${formatAmount(totals.lineTotal)}</ram:TaxBasisTotalAmount>`);
21521
+ out.push(` <ram:TaxTotalAmount currencyID="${escapeXml$1(currency)}">${formatAmount(totals.taxTotal)}</ram:TaxTotalAmount>`);
21522
+ out.push(` <ram:GrandTotalAmount currencyID="${escapeXml$1(currency)}">${formatAmount(totals.grandTotal)}</ram:GrandTotalAmount>`);
21523
+ out.push(` <ram:DuePayableAmount currencyID="${escapeXml$1(currency)}">${formatAmount(totals.duePayable)}</ram:DuePayableAmount>`);
21524
21524
  out.push(" </ram:SpecifiedTradeSettlementHeaderMonetarySummation>");
21525
21525
  return out.join("\n");
21526
21526
  }
@@ -21544,11 +21544,11 @@ function generateXRechnungCii(invoice, options = {}) {
21544
21544
  out.push("<rsm:CrossIndustryInvoice xmlns:rsm=\"urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100\" xmlns:ram=\"urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100\" xmlns:udt=\"urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100\">");
21545
21545
  out.push(" <rsm:ExchangedDocumentContext>");
21546
21546
  out.push(" <ram:GuidelineSpecifiedDocumentContextParameter>");
21547
- out.push(` <ram:ID>${escapeXml(XRECHNUNG_GUIDELINE_URN)}</ram:ID>`);
21547
+ out.push(` <ram:ID>${escapeXml$1(XRECHNUNG_GUIDELINE_URN)}</ram:ID>`);
21548
21548
  out.push(" </ram:GuidelineSpecifiedDocumentContextParameter>");
21549
21549
  out.push(" </rsm:ExchangedDocumentContext>");
21550
21550
  out.push(" <rsm:ExchangedDocument>");
21551
- out.push(` <ram:ID>${escapeXml(invoice.invoiceNumber)}</ram:ID>`);
21551
+ out.push(` <ram:ID>${escapeXml$1(invoice.invoiceNumber)}</ram:ID>`);
21552
21552
  out.push(` <ram:TypeCode>${COMMERCIAL_INVOICE_TYPE_CODE}</ram:TypeCode>`);
21553
21553
  out.push(" <ram:IssueDateTime>");
21554
21554
  out.push(` <udt:DateTimeString format="102">${toDateString102(invoice.issueDate)}</udt:DateTimeString>`);
@@ -21557,7 +21557,7 @@ function generateXRechnungCii(invoice, options = {}) {
21557
21557
  out.push(" <rsm:SupplyChainTradeTransaction>");
21558
21558
  for (const [i, line] of invoice.lines.entries()) out.push(renderLine$1(line, i + 1, currency));
21559
21559
  out.push(" <ram:ApplicableHeaderTradeAgreement>");
21560
- if (buyerReference !== void 0 && buyerReference !== "") out.push(` <ram:BuyerReference>${escapeXml(buyerReference)}</ram:BuyerReference>`);
21560
+ if (buyerReference !== void 0 && buyerReference !== "") out.push(` <ram:BuyerReference>${escapeXml$1(buyerReference)}</ram:BuyerReference>`);
21561
21561
  out.push(" <ram:SellerTradeParty>");
21562
21562
  out.push(renderParty(invoice.seller, " "));
21563
21563
  out.push(" </ram:SellerTradeParty>");
@@ -21567,7 +21567,7 @@ function generateXRechnungCii(invoice, options = {}) {
21567
21567
  out.push(" </ram:ApplicableHeaderTradeAgreement>");
21568
21568
  out.push(" <ram:ApplicableHeaderTradeDelivery/>");
21569
21569
  out.push(" <ram:ApplicableHeaderTradeSettlement>");
21570
- out.push(` <ram:InvoiceCurrencyCode>${escapeXml(currency)}</ram:InvoiceCurrencyCode>`);
21570
+ out.push(` <ram:InvoiceCurrencyCode>${escapeXml$1(currency)}</ram:InvoiceCurrencyCode>`);
21571
21571
  for (const group of totals.taxGroups) out.push(renderTaxGroup(group, currency));
21572
21572
  out.push(renderMonetarySummation(totals, currency));
21573
21573
  out.push(" </ram:ApplicableHeaderTradeSettlement>");
@@ -21598,11 +21598,11 @@ function generateOrderX(invoice, orderType) {
21598
21598
  out.push("<rsm:SCRDMCCBDACIOMessageStructure xmlns:rsm=\"urn:un:unece:uncefact:data:standard:SCRDMCCBDACIOMessageStructure:100\" xmlns:ram=\"urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:128\" xmlns:udt=\"urn:un:unece:uncefact:data:standard:UnqualifiedDataType:128\">");
21599
21599
  out.push(" <rsm:ExchangedDocumentContext>");
21600
21600
  out.push(" <ram:GuidelineSpecifiedDocumentContextParameter>");
21601
- out.push(` <ram:ID>${escapeXml(ORDER_X_GUIDELINE_URN)}</ram:ID>`);
21601
+ out.push(` <ram:ID>${escapeXml$1(ORDER_X_GUIDELINE_URN)}</ram:ID>`);
21602
21602
  out.push(" </ram:GuidelineSpecifiedDocumentContextParameter>");
21603
21603
  out.push(" </rsm:ExchangedDocumentContext>");
21604
21604
  out.push(" <rsm:ExchangedDocument>");
21605
- out.push(` <ram:ID>${escapeXml(invoice.invoiceNumber)}</ram:ID>`);
21605
+ out.push(` <ram:ID>${escapeXml$1(invoice.invoiceNumber)}</ram:ID>`);
21606
21606
  out.push(` <ram:TypeCode>${typeCode}</ram:TypeCode>`);
21607
21607
  out.push(" <ram:IssueDateTime>");
21608
21608
  out.push(` <udt:DateTimeString format="102">${toDateString102(invoice.issueDate)}</udt:DateTimeString>`);
@@ -21620,7 +21620,7 @@ function generateOrderX(invoice, orderType) {
21620
21620
  out.push(" </ram:ApplicableHeaderTradeAgreement>");
21621
21621
  out.push(" <ram:ApplicableHeaderTradeDelivery/>");
21622
21622
  out.push(" <ram:ApplicableHeaderTradeSettlement>");
21623
- out.push(` <ram:OrderCurrencyCode>${escapeXml(currency)}</ram:OrderCurrencyCode>`);
21623
+ out.push(` <ram:OrderCurrencyCode>${escapeXml$1(currency)}</ram:OrderCurrencyCode>`);
21624
21624
  for (const group of totals.taxGroups) out.push(renderTaxGroup(group, currency));
21625
21625
  out.push(renderMonetarySummation(totals, currency));
21626
21626
  out.push(" </ram:ApplicableHeaderTradeSettlement>");
@@ -30941,6 +30941,298 @@ function buildHeadingLevelMap(lines, headingThreshold) {
30941
30941
  return map;
30942
30942
  }
30943
30943
  //#endregion
30944
+ //#region src/compliance/profileConvert.ts
30945
+ /** Canonical PDF/A identification namespace URI (`pdfaid`). */
30946
+ const PDFAID_NS = "http://www.aiim.org/pdfa/ns/id/";
30947
+ /**
30948
+ * Run a synchronous, pre-save PDF/A preflight over an in-memory document.
30949
+ *
30950
+ * See the module documentation for the (intentional) scope and limitations of
30951
+ * this check relative to the byte-level `validatePdfA` validator.
30952
+ *
30953
+ * @param doc - The in-memory document to inspect. Never mutated.
30954
+ * @param level - Optional target level (e.g. `'2b'`, `'3u'`, `'PDF/A-4'`).
30955
+ * Only used to refine messages; all checks here are
30956
+ * level-agnostic prerequisites common to every PDF/A part.
30957
+ * @returns A (possibly empty) list of preflight issues. Never throws.
30958
+ */
30959
+ function preflightPdfA(doc, level) {
30960
+ const issues = [];
30961
+ const target = level !== void 0 && level.length > 0 ? ` (${level})` : "";
30962
+ let xmp;
30963
+ try {
30964
+ xmp = doc.getXmpMetadata();
30965
+ } catch {
30966
+ xmp = void 0;
30967
+ }
30968
+ if (xmp === void 0 || xmp.length === 0) issues.push({
30969
+ code: "PDFA-001",
30970
+ message: `XMP metadata stream is required but not set on the document${target}.`,
30971
+ severity: "error",
30972
+ fixable: true,
30973
+ clause: "ISO 19005 (XMP metadata)"
30974
+ });
30975
+ else if (!xmp.includes("pdfaid:part")) issues.push({
30976
+ code: "PDFA-002",
30977
+ message: "XMP metadata does not declare PDF/A identification (pdfaid:part).",
30978
+ severity: "error",
30979
+ fixable: true,
30980
+ clause: "ISO 19005 (PDF/A identification schema)"
30981
+ });
30982
+ if (!documentHasOutputIntent(doc)) issues.push({
30983
+ code: "PDFA-012",
30984
+ message: "A PDF/A output intent (/OutputIntents) with an ICC destination profile is required (none detected on the in-memory document).",
30985
+ severity: "error",
30986
+ fixable: true,
30987
+ clause: "ISO 19005 (OutputIntents)"
30988
+ });
30989
+ let lang;
30990
+ try {
30991
+ lang = doc.getLanguage();
30992
+ } catch {
30993
+ lang = void 0;
30994
+ }
30995
+ if (lang === void 0 || lang.length === 0) issues.push({
30996
+ code: "PDFA-011",
30997
+ message: "The document language (/Lang) is not set; PDF/A recommends a BCP 47 language tag.",
30998
+ severity: "warning",
30999
+ fixable: true,
31000
+ clause: "ISO 19005 (document language)"
31001
+ });
31002
+ let title;
31003
+ try {
31004
+ title = doc.getTitle();
31005
+ } catch {
31006
+ title = void 0;
31007
+ }
31008
+ if (title === void 0 || title.length === 0) issues.push({
31009
+ code: "PDFA-014",
31010
+ message: "The document title is not set; PDF/A requires a dc:title.",
31011
+ severity: "warning",
31012
+ fixable: true,
31013
+ clause: "ISO 19005 (descriptive metadata)"
31014
+ });
31015
+ let pageCount = 0;
31016
+ try {
31017
+ pageCount = doc.getPageCount();
31018
+ } catch {
31019
+ pageCount = 0;
31020
+ }
31021
+ if (pageCount === 0) issues.push({
31022
+ code: "PDFA-015",
31023
+ message: "The document has no pages; a PDF/A file must contain at least one page.",
31024
+ severity: "error",
31025
+ fixable: false,
31026
+ clause: "ISO 32000 (page tree)"
31027
+ });
31028
+ return issues;
31029
+ }
31030
+ /**
31031
+ * Best-effort, pre-save detection of an output intent on a document.
31032
+ *
31033
+ * The public {@link PdfDocument} surface exposes no output-intent accessor, so
31034
+ * this currently always returns `false` for an in-memory document. It is
31035
+ * factored out so a future output-intent API can be wired in without touching
31036
+ * the issue-mapping logic.
31037
+ */
31038
+ function documentHasOutputIntent(_doc) {
31039
+ return false;
31040
+ }
31041
+ /** Map a numeric part to its decimal string. */
31042
+ function partString(part) {
31043
+ return String(part);
31044
+ }
31045
+ /** Map a conformance letter to the upper-case form stored in XMP. */
31046
+ function conformanceString(conformance) {
31047
+ return conformance.toUpperCase();
31048
+ }
31049
+ /**
31050
+ * Remap the PDF/A identification (`pdfaid:part`, and optionally
31051
+ * `pdfaid:conformance`) inside an existing XMP packet.
31052
+ *
31053
+ * Both the **attribute** form (`pdfaid:part="3"`) and the **element** form
31054
+ * (`<pdfaid:part>3</pdfaid:part>`) are handled. When no `pdfaid:part` is
31055
+ * present, identification is injected into the first `rdf:Description` element
31056
+ * (declaring the `pdfaid` namespace on it if necessary). All other content of
31057
+ * the packet is preserved verbatim.
31058
+ *
31059
+ * This is a pure string transform; it does not parse or re-serialize the XML.
31060
+ *
31061
+ * @param xmp - The source XMP packet string.
31062
+ * @param toPart - Target PDF/A part (1, 2, 3 or 4).
31063
+ * @param toConformance - Optional target conformance level (`a`/`b`/`u`). When
31064
+ * omitted, any existing conformance is left untouched.
31065
+ * @returns The transformed XMP packet string.
31066
+ */
31067
+ function convertPdfAConformanceXmp(xmp, toPart, toConformance) {
31068
+ const partVal = partString(toPart);
31069
+ let result = xmp;
31070
+ const partAttr = /pdfaid:part\s*=\s*"[^"]*"/;
31071
+ const partElem = /<pdfaid:part>[^<]*<\/pdfaid:part>/;
31072
+ if (partAttr.test(result)) result = result.replace(partAttr, `pdfaid:part="${partVal}"`);
31073
+ else if (partElem.test(result)) result = result.replace(partElem, `<pdfaid:part>${partVal}</pdfaid:part>`);
31074
+ else {
31075
+ result = injectIdentification(result, partVal, toConformance);
31076
+ return result;
31077
+ }
31078
+ if (toConformance !== void 0) {
31079
+ const confVal = conformanceString(toConformance);
31080
+ const confAttr = /pdfaid:conformance\s*=\s*"[^"]*"/;
31081
+ const confElem = /<pdfaid:conformance>[^<]*<\/pdfaid:conformance>/;
31082
+ if (confAttr.test(result)) result = result.replace(confAttr, `pdfaid:conformance="${confVal}"`);
31083
+ else if (confElem.test(result)) result = result.replace(confElem, `<pdfaid:conformance>${confVal}</pdfaid:conformance>`);
31084
+ else result = addConformanceBesidePart(result, confVal);
31085
+ }
31086
+ return result;
31087
+ }
31088
+ /**
31089
+ * Inject a fresh `pdfaid` identification block into the first `rdf:Description`
31090
+ * element. Used when the source packet has no `pdfaid:part` at all.
31091
+ */
31092
+ function injectIdentification(xmp, partVal, toConformance) {
31093
+ const nsDecl = `xmlns:pdfaid="${PDFAID_NS}"`;
31094
+ const hasNs = xmp.includes(PDFAID_NS);
31095
+ let frag = `<pdfaid:part>${partVal}</pdfaid:part>`;
31096
+ if (toConformance !== void 0) frag += `<pdfaid:conformance>${conformanceString(toConformance)}</pdfaid:conformance>`;
31097
+ const selfClosing = /<rdf:Description\b([^>]*?)\/>/;
31098
+ const scMatch = selfClosing.exec(xmp);
31099
+ if (scMatch) {
31100
+ const replacement = `<rdf:Description${scMatch[1] ?? ""}${hasNs ? "" : ` ${nsDecl}`}>${frag}</rdf:Description>`;
31101
+ return xmp.replace(selfClosing, replacement);
31102
+ }
31103
+ const open = /<rdf:Description\b([^>]*)>/;
31104
+ const openMatch = open.exec(xmp);
31105
+ if (openMatch) {
31106
+ const replacement = `<rdf:Description${openMatch[1] ?? ""}${hasNs ? "" : ` ${nsDecl}`}>${frag}`;
31107
+ return xmp.replace(open, replacement);
31108
+ }
31109
+ return xmp;
31110
+ }
31111
+ /**
31112
+ * Add a `pdfaid:conformance` next to an already-present `pdfaid:part`,
31113
+ * mirroring the part's representation (attribute vs element form).
31114
+ */
31115
+ function addConformanceBesidePart(xmp, confVal) {
31116
+ const partElem = /(<pdfaid:part>[^<]*<\/pdfaid:part>)/;
31117
+ if (partElem.test(xmp)) return xmp.replace(partElem, `$1<pdfaid:conformance>${confVal}</pdfaid:conformance>`);
31118
+ const partAttr = /(pdfaid:part\s*=\s*"[^"]*")/;
31119
+ if (partAttr.test(xmp)) return xmp.replace(partAttr, `$1 pdfaid:conformance="${confVal}"`);
31120
+ return xmp;
31121
+ }
31122
+ //#endregion
31123
+ //#region src/compliance/rasterProfile.ts
31124
+ /**
31125
+ * VERIFIED: PDF Association "PDF Declarations" namespace URI / prefix.
31126
+ * (Some published examples use the `https://` scheme; the `http://` form
31127
+ * is the one most commonly cited and is used here for stability.)
31128
+ */
31129
+ const PDFD_NS = "http://pdfa.org/declarations/";
31130
+ /**
31131
+ * PROVISIONAL: WTPDF declaration target URIs, keyed by conformance level.
31132
+ * The fragment form follows the PDF Association's corrected pattern
31133
+ * (`…/declarations/wtpdf#<level>1.0`) but is acknowledged as unsettled
31134
+ * (pdf-issues #395). Treat as identification hint, not normative match.
31135
+ */
31136
+ const WTPDF_CONFORMS_TO_BASE = "http://pdfa.org/declarations/wtpdf#";
31137
+ /**
31138
+ * PROVISIONAL: PDF/R declaration target URI. ISO 23504 / PDF/Raster has
31139
+ * no published PDF Declarations URI; this follows the same pattern and is
31140
+ * non-normative.
31141
+ */
31142
+ const PDFR_CONFORMS_TO = "http://pdfa.org/declarations/pdfr#1.0";
31143
+ /** Escape XML special characters in a string. */
31144
+ function escapeXml(str) {
31145
+ return str.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll("\"", "&quot;").replaceAll("'", "&apos;");
31146
+ }
31147
+ /**
31148
+ * Build an XMP packet carrying a single PDF Declaration plus a plain
31149
+ * `part`/`conformance` identification block.
31150
+ *
31151
+ * The packet is intentionally minimal: it declares the verified `pdfd`
31152
+ * PDF Declarations namespace and structure, embeds the (provisional)
31153
+ * `conformsTo` target, and additionally renders the supplied `part` and
31154
+ * `conformance` values under a clearly-named, profile-local namespace so
31155
+ * that the identification facts are machine-readable even though no ISO
31156
+ * identification namespace exists for these profiles.
31157
+ */
31158
+ function buildIdentificationXmp(identity) {
31159
+ const { profileName, conformsTo, part, conformance } = identity;
31160
+ let xmp = "<?xpacket begin=\"\" id=\"W5M0MpCehiHzreSzNTczkc9d\"?>\n";
31161
+ xmp += "<x:xmpmeta xmlns:x=\"adobe:ns:meta/\">\n";
31162
+ xmp += ` <!-- ${escapeXml(profileName)} identification marker (non-normative). -->\n`;
31163
+ xmp += " <rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n";
31164
+ xmp += " <rdf:Description rdf:about=\"\"\n";
31165
+ xmp += ` xmlns:pdfd="${PDFD_NS}">\n`;
31166
+ xmp += " <pdfd:declarations>\n";
31167
+ xmp += " <rdf:Bag>\n";
31168
+ xmp += " <rdf:li rdf:parseType=\"Resource\">\n";
31169
+ xmp += ` <pdfd:conformsTo>${escapeXml(conformsTo)}</pdfd:conformsTo>\n`;
31170
+ xmp += " </rdf:li>\n";
31171
+ xmp += " </rdf:Bag>\n";
31172
+ xmp += " </pdfd:declarations>\n";
31173
+ xmp += " </rdf:Description>\n";
31174
+ xmp += " <rdf:Description rdf:about=\"\"\n";
31175
+ xmp += " xmlns:pid=\"http://modern-pdf-lib/ns/profile-id/\">\n";
31176
+ xmp += ` <pid:part>${part}</pid:part>\n`;
31177
+ if (conformance !== void 0) xmp += ` <pid:conformance>${escapeXml(conformance)}</pid:conformance>\n`;
31178
+ xmp += " </rdf:Description>\n";
31179
+ xmp += " </rdf:RDF>\n";
31180
+ xmp += "</x:xmpmeta>\n";
31181
+ xmp += "<?xpacket end=\"w\"?>";
31182
+ return xmp;
31183
+ }
31184
+ /**
31185
+ * Build a WTPDF ("Well-Tagged PDF") identification XMP packet.
31186
+ *
31187
+ * WTPDF conformance is asserted through the PDF Association's PDF
31188
+ * Declarations mechanism (VERIFIED). The `conformsTo` target URI is
31189
+ * PROVISIONAL — see the module doc comment and pdf-issues #395 for the
31190
+ * acknowledged inconsistency in its exact form. This builder produces an
31191
+ * identification marker only and does not assert or validate WTPDF
31192
+ * conformance.
31193
+ *
31194
+ * @param options - Optional part (default `1`, i.e. WTPDF 1.0) and a
31195
+ * conformance level (WTPDF defines `'reuse'` and `'accessibility'`).
31196
+ * @returns A serialized XMP/RDF identification packet.
31197
+ */
31198
+ function buildWtpdfIdentificationXmp(options) {
31199
+ const part = options?.part ?? 1;
31200
+ const conformance = options?.conformance;
31201
+ let conformsTo = `${WTPDF_CONFORMS_TO_BASE}1.0`;
31202
+ if (conformance === "reuse" || conformance === "accessibility") conformsTo = `${WTPDF_CONFORMS_TO_BASE}${conformance}1.0`;
31203
+ return buildIdentificationXmp({
31204
+ profileName: "WTPDF (Well-Tagged PDF) 1.0",
31205
+ conformsTo,
31206
+ part,
31207
+ conformance
31208
+ });
31209
+ }
31210
+ /**
31211
+ * Build a PDF/R (ISO 23504 / PDF/Raster) identification XMP packet.
31212
+ *
31213
+ * IMPORTANT: PDF/R is normatively identified by a comment marker before
31214
+ * the final `startxref` in the file trailer, NOT by XMP. There is no
31215
+ * ISO-defined XMP identification namespace for PDF/R, so this XMP marker
31216
+ * is non-normative: the `pdfd:conformsTo` target is PROVISIONAL. Use this
31217
+ * only as a supplementary, machine-readable hint alongside the required
31218
+ * trailer comment marker; it does not assert or validate PDF/R
31219
+ * conformance.
31220
+ *
31221
+ * @param options - Optional part (default `1`, i.e. ISO 23504-1 / PDF/R-1)
31222
+ * and a conformance token.
31223
+ * @returns A serialized XMP/RDF identification packet.
31224
+ */
31225
+ function buildPdfRIdentificationXmp(options) {
31226
+ const part = options?.part ?? 1;
31227
+ const conformance = options?.conformance;
31228
+ return buildIdentificationXmp({
31229
+ profileName: "PDF/R (ISO 23504, raster image transport and storage)",
31230
+ conformsTo: PDFR_CONFORMS_TO,
31231
+ part,
31232
+ conformance
31233
+ });
31234
+ }
31235
+ //#endregion
30944
31236
  //#region src/index.ts
30945
31237
  /** Whether initWasm has already completed successfully. */
30946
31238
  let wasmInitialized = false;
@@ -30986,6 +31278,6 @@ async function initWasm(options) {
30986
31278
  wasmInitialized = true;
30987
31279
  }
30988
31280
  //#endregion
30989
- export { layoutColumns as $, generateInkAppearance as $a, detectTransparency as $i, getBookmarks as $n, encodeUpcA as $r, buildFunctionShading as $t, renderPageTile as A, buildTimestampRequest as Aa, optimizeImage as Ai, toSarif as An, ellipsisText as Ar, AFDate_FormatEx as At, rasterize as B, PdfCircleAnnotation as Ba, extractXmpMetadata as Bi, tableToCsv as Bn, stripedPreset as Br, createWorkerPool as Bt, buildUnencryptedWrapper as C, setCertificationLevel as Ca, embedTiffCmyk as Ci, buildCalGray as Cn, applyHeaderFooter as Cr, getFieldValue as Ct, registerEmbeddedFile as D, parseExistingTrailer as Da, analyzeJpegMarkers as Di, DEFAULT_SARIF_TOOL_NAME as Dn, toAlpha as Dr, setFieldVisibility as Dt, attachAssociatedFiles as E, findExistingSignatures as Ea, injectJpegMetadata as Ei, labToRgb as En, replaceTemplateVariables as Er, addVisibilityAction as Et, extractFonts as F, PdfCaretAnnotation as Fa, generatePdfAXmpBytes as Fi, buildPieceInfo as Fn, applyPreset as Fr, decodeWoff as Ft, verifyOfflineRevocation as G, PdfHighlightAnnotation as Ga, isValidLevel as Gi, StreamingPdfParser as Gn, readEan8 as Gr, renderToPdf as Gt, interpretContentStream as H, PdfPolyLineAnnotation as Ha, validateXmpMetadata as Hi, accessibilityPlugin as Hn, readCode128 as Hr, buildVtDpm as Ht, extractImages as I, PdfPopupAnnotation as Ia, countOccurrences as Ii, buildRequirement as In, applyTablePreset as Ir, isWoff as It, validateExtendedKeyUsage as J, PdfUnderlineAnnotation as Ja, generateZapfDingbatsToUnicodeCmap as Ji, validatePdfUa as Jn, encodePdf417 as Jr, splitByScript as Jt, EKU_OIDS as K, PdfSquigglyAnnotation as Ka, generateSymbolToUnicodeCmap as Ki, PdfDocumentBuilder as Kn, calculateBarcodeDimensions as Kr, createRangeFetcher as Kt, generateThumbnail as L, PdfRedactAnnotation as La, stripProhibitedFeatures as Li, buildRequirements as Ln, borderedPreset as Lr, isWoff2 as Lt, applyOcr as M, requestTimestamp as Ma, applyRedaction as Mi, PDF2_NAMESPACE as Mn, shrinkFontSize as Mr, parseAcrobatDate as Mt, compareImages as N, searchTextItems as Na, enforcePdfAFull as Ni, buildNamespace as Nn, truncateText as Nr, AFNumber_Format as Nt, RenderCache as O, saveIncrementalWithSignaturePreservation as Oa, downscaleImage as Oi, SARIF_SCHEMA_URI as On, toRoman as Or, validateFieldValue as Ot, comparePages as P, PdfFileAttachmentAnnotation as Pa, generatePdfAXmp as Pi, buildNamespacesArray as Pn, wrapText$2 as Pr, formatNumber$1 as Pt, findHyphenationPoints as Q, generateHighlightAppearance as Qa, generateSrgbIccProfile as Qi, addBookmark as Qn, calculateUpcCheckDigit as Qr, pdfA4Rules as Qt, renderDisplayListToCanvas as R, PdfInkAnnotation as Ra, buildAfArray as Ri, buildDPartRoot as Rn, minimalPreset as Rr, readWoffHeader as Rt, buildEncryptedPayload as S, getCertificationLevel as Sa, convertTiffCmykToRgb as Si, buildDocTimeStampDict as Sn, UnexpectedFieldTypeError as Sr, createSandbox as St, buildPageOutputIntent as T, appendIncrementalUpdate as Ta, extractJpegMetadata as Ti, buildLab as Tn, formatDate$1 as Tr, setFieldValue as Tt, interpretPage as U, PdfPolygonAnnotation as Ua, getProfile as Ui, metadataPlugin as Un, readCode39 as Ur, gtsPdfVtVersion as Ut, renderPageToImage as V, PdfLineAnnotation as Va, parseXmpMetadata as Vi, tableToJson as Vn, readBarcode as Vr, buildPdfVtDParts as Vt, extractEmbeddedRevocationData as W, PdfSquareAnnotation as Wa, getSupportedLevels as Wi, timestampPlugin as Wn, readEan13 as Wr, h as Wt, buildCertificateChain as X, generateCircleAppearance as Xa, buildOutputIntent as Xi, batchMerge as Xn, dataMatrixToOperators as Xr, generateXRechnungCii as Xt, validateKeyUsage as Y, PdfFreeTextAnnotation as Ya, getToUnicodeCmap as Yi, batchFlatten as Yn, pdf417ToOperators as Yr, generateOrderX as Yt, validateCertificateChain as Z, generateFreeTextAppearance as Za, SRGB_ICC_PROFILE as Zi, processBatch as Zn, encodeDataMatrix as Zr, buildPdfA4Xmp as Zt, buildColorKeyMask as _, buildFieldLockDict as _a, embedTiffDirect as _i, markdownToPdf as _n, NoSuchFieldError as _r, downloadCrl as _t, LIST_NUMBERING_KEY as a, isLinearized as aa, encodeEan8 as ai, buildBoxDict as an, PdfLinkAnnotation as ao, BatchProcessingError as ar, downscale16To8 as at, buildSoftMaskGroupExtGState as b, MdpPermission as ba, webpToJpeg as bi, reconstructParagraphs as bn, RichTextFieldReadError as br, checkCertificateStatus as bt, tagLink as c, findChangedObjects as ca, code39ToOperators as ci, validateBoxGeometry as cn, createXmpStream as co, ExceededMaxLengthError as cr, offsetSignedToUnsigned as ct, tagParagraph as d, embedLtvData as da, code128ToOperators as di, buildThresholdHalftone as dn, buildDeviceNColorSpace as do, FontNotEmbeddedError as dr, assembleTiles as dt, flattenTransparency as ea, upcAToOperators as ei, sampleShadingColor as en, generateLineAppearance as eo, removeAllBookmarks as er, layoutParagraph as et, tagTable as f, hasLtvData as fa, encodeCode128 as fi, buildType1Halftone as fn, buildSeparationColorSpace as fo, ForeignPageError as fr, decodeTile as ft, buildBlackPointCompensationExtGState as g, addFieldLock as ga, canDirectEmbed as gi, evaluateFunction as gn, MissingOnValueCheckError as gr, TrustStore as gt, tagTableRow as h, diffSignedContent as ha, PdfWorker as hi, nameHalftone as hn, saveIncremental as ho, InvalidPageSizeError as hr, verifySignatureDetailed as ht, validatePdfUa2 as i, getLinearizationInfo as ia, encodeEan13 as ii, generateCiiXml as in, generateUnderlineAppearance as io, flattenForm as ir, validatePdfX as it, redactRegions as j, parseTimestampResponse as ja, recompressImage as ji, MATHML_NAMESPACE as jn, estimateTextWidth as jr, formatDate as jt, computeTileGrid as k, validateByteRangeIntegrity as ka, estimateJpegQuality as ki, toJsonReport as kn, applyOverflow as kr, AFSpecial_Format as kt, tagList as l, optimizeIncrementalSave as la, computeCode39CheckDigit as li, STANDARD_SPOT_FUNCTIONS as ln, parseXmpMetadata$1 as lo, FieldAlreadyExistsError as lr, summarizeBitDepth as lt, tagTableHeaderCell as m, getCounterSignatures as ma, valuesToModules as mi, identityTransferFunction as mn, saveDocumentIncremental as mo, InvalidFieldNamePartError as mr, parseTileInfo as mt, autoTagPage as n, validatePdfA as na, ean13ToOperators as ni, levenshtein as nn, generateSquigglyAppearance as no, flattenField as nr, buildPdfXOutputIntent as nt, tagFigure as o, linearizePdf as oa, encodeItf as oi, buildGtsPdfxVersion as on, PdfTextAnnotation as oo, CombedTextLayoutError as or, getComponentDepths as ot, tagTableDataCell as p, addCounterSignature as pa, encodeCode128Values as pi, buildType5Halftone as pn, ChangeTracker as po, InvalidColorError as pr, decodeTileRegion as pt, validateCertificatePolicy as q, PdfStrikeOutAnnotation as qa, generateWinAnsiToUnicodeCmap as qi, enforcePdfUa as qn, renderStyledBarcode as qr, resolveFallback as qt, buildPdfUa2Xmp as r, delinearizePdf as ra, ean8ToOperators as ri, renderCodeFrame as rn, generateStrikeOutAppearance as ro, flattenFields as rr, enforcePdfX as rt, tagHeading as s, computeObjectHash as sa, itfToOperators as si, buildPdfX6OutputIntent as sn, buildXmpMetadata as so, EncryptedPdfError as sr, normalizeComponentDepth as st, initWasm as t, enforcePdfA as ta, calculateEanCheckDigit as ti, didYouMean as tn, generateSquareAppearance as to, removeBookmark as tr, layoutTextFlow as tt, tagListItem as u, buildDssDictionary as ua, encodeCode39 as ui, buildSampledTransferFunction as un, PDFOperator as uo, FieldExistsAsNonTerminalError as ur, upscale8To16 as ut, buildImageSoftMask as v, getFieldLocks as va, encodePngFromPixels as vi, buildCollection as vn, PluginError as vr, extractCrlUrls as vt, attachOutputIntents as w, validateSignatureChain as wa, isCmykTiff as wi, buildCalRGB as wn, applyHeaderFooterToPage as wr, resolveFieldReference as wt, buildSoftMaskNone as x, buildDocMdpReference as xa, webpToPng as xi, DEFAULT_DOC_TIMESTAMP_CONTENTS_SIZE as xn, StreamingParseError as xr, extractOcspUrl as xt, buildStencilMask as y, detectModifications as ya, recompressWebP as yi, reconstructLines as yn, RemovePageFromEmptyDocumentError as yr, isCertificateRevoked as yt, renderPageToCanvas as z, PdfStampAnnotation as za, createAssociatedFile as zi, extractTables as zn, professionalPreset as zr, signDeferred as zt };
31281
+ export { validateKeyUsage as $, PdfFreeTextAnnotation as $a, getToUnicodeCmap as $i, batchFlatten as $n, pdf417ToOperators as $r, generateOrderX as $t, attachAssociatedFiles as A, findExistingSignatures as Aa, injectJpegMetadata as Ai, labToRgb as An, replaceTemplateVariables as Ar, addVisibilityAction as At, extractImages as B, PdfPopupAnnotation as Ba, countOccurrences as Bi, buildRequirement as Bn, applyTablePreset as Br, isWoff as Bt, buildStencilMask as C, detectModifications as Ca, recompressWebP as Ci, reconstructLines as Cn, RemovePageFromEmptyDocumentError as Cr, isCertificateRevoked as Ct, buildUnencryptedWrapper as D, setCertificationLevel as Da, embedTiffCmyk as Di, buildCalGray as Dn, applyHeaderFooter as Dr, getFieldValue as Dt, buildEncryptedPayload as E, getCertificationLevel as Ea, convertTiffCmykToRgb as Ei, buildDocTimeStampDict as En, UnexpectedFieldTypeError as Er, createSandbox as Et, redactRegions as F, parseTimestampResponse as Fa, recompressImage as Fi, MATHML_NAMESPACE as Fn, estimateTextWidth as Fr, formatDate as Ft, renderPageToImage as G, PdfLineAnnotation as Ga, parseXmpMetadata as Gi, tableToJson as Gn, readBarcode as Gr, buildPdfVtDParts as Gt, renderDisplayListToCanvas as H, PdfInkAnnotation as Ha, buildAfArray as Hi, buildDPartRoot as Hn, minimalPreset as Hr, readWoffHeader as Ht, applyOcr as I, requestTimestamp as Ia, applyRedaction as Ii, PDF2_NAMESPACE as In, shrinkFontSize as Ir, parseAcrobatDate as It, extractEmbeddedRevocationData as J, PdfSquareAnnotation as Ja, getSupportedLevels as Ji, timestampPlugin as Jn, readEan13 as Jr, h as Jt, interpretContentStream as K, PdfPolyLineAnnotation as Ka, validateXmpMetadata as Ki, accessibilityPlugin as Kn, readCode128 as Kr, buildVtDpm as Kt, compareImages as L, searchTextItems as La, enforcePdfAFull as Li, buildNamespace as Ln, truncateText as Lr, AFNumber_Format as Lt, RenderCache as M, saveIncrementalWithSignaturePreservation as Ma, downscaleImage as Mi, SARIF_SCHEMA_URI as Mn, toRoman as Mr, validateFieldValue as Mt, computeTileGrid as N, validateByteRangeIntegrity as Na, estimateJpegQuality as Ni, toJsonReport as Nn, applyOverflow as Nr, AFSpecial_Format as Nt, attachOutputIntents as O, validateSignatureChain as Oa, isCmykTiff as Oi, buildCalRGB as On, applyHeaderFooterToPage as Or, resolveFieldReference as Ot, renderPageTile as P, buildTimestampRequest as Pa, optimizeImage as Pi, toSarif as Pn, ellipsisText as Pr, AFDate_FormatEx as Pt, validateExtendedKeyUsage as Q, PdfUnderlineAnnotation as Qa, generateZapfDingbatsToUnicodeCmap as Qi, validatePdfUa as Qn, encodePdf417 as Qr, splitByScript as Qt, comparePages as R, PdfFileAttachmentAnnotation as Ra, generatePdfAXmp as Ri, buildNamespacesArray as Rn, wrapText$2 as Rr, formatNumber$1 as Rt, buildImageSoftMask as S, getFieldLocks as Sa, encodePngFromPixels as Si, buildCollection as Sn, PluginError as Sr, extractCrlUrls as St, buildSoftMaskNone as T, buildDocMdpReference as Ta, webpToPng as Ti, DEFAULT_DOC_TIMESTAMP_CONTENTS_SIZE as Tn, StreamingParseError as Tr, extractOcspUrl as Tt, renderPageToCanvas as U, PdfStampAnnotation as Ua, createAssociatedFile as Ui, extractTables as Un, professionalPreset as Ur, signDeferred as Ut, generateThumbnail as V, PdfRedactAnnotation as Va, stripProhibitedFeatures as Vi, buildRequirements as Vn, borderedPreset as Vr, isWoff2 as Vt, rasterize as W, PdfCircleAnnotation as Wa, extractXmpMetadata as Wi, tableToCsv as Wn, stripedPreset as Wr, createWorkerPool as Wt, EKU_OIDS as X, PdfSquigglyAnnotation as Xa, generateSymbolToUnicodeCmap as Xi, PdfDocumentBuilder as Xn, calculateBarcodeDimensions as Xr, createRangeFetcher as Xt, verifyOfflineRevocation as Y, PdfHighlightAnnotation as Ya, isValidLevel as Yi, StreamingPdfParser as Yn, readEan8 as Yr, renderToPdf as Yt, validateCertificatePolicy as Z, PdfStrikeOutAnnotation as Za, generateWinAnsiToUnicodeCmap as Zi, enforcePdfUa as Zn, renderStyledBarcode as Zr, resolveFallback as Zt, tagTableDataCell as _, addCounterSignature as _a, encodeCode128Values as _i, buildType5Halftone as _n, ChangeTracker as _o, InvalidColorError as _r, decodeTileRegion as _t, preflightPdfA as a, enforcePdfA as aa, calculateEanCheckDigit as ai, didYouMean as an, generateSquareAppearance as ao, removeBookmark as ar, layoutTextFlow as at, buildBlackPointCompensationExtGState as b, addFieldLock as ba, canDirectEmbed as bi, evaluateFunction as bn, MissingOnValueCheckError as br, TrustStore as bt, validatePdfUa2 as c, getLinearizationInfo as ca, encodeEan13 as ci, generateCiiXml as cn, generateUnderlineAppearance as co, flattenForm as cr, validatePdfX as ct, tagHeading as d, computeObjectHash as da, itfToOperators as di, buildPdfX6OutputIntent as dn, buildXmpMetadata as do, EncryptedPdfError as dr, normalizeComponentDepth as dt, buildOutputIntent as ea, dataMatrixToOperators as ei, generateXRechnungCii as en, generateCircleAppearance as eo, batchMerge as er, buildCertificateChain as et, tagLink as f, findChangedObjects as fa, code39ToOperators as fi, validateBoxGeometry as fn, createXmpStream as fo, ExceededMaxLengthError as fr, offsetSignedToUnsigned as ft, tagTable as g, hasLtvData as ga, encodeCode128 as gi, buildType1Halftone as gn, buildSeparationColorSpace as go, ForeignPageError as gr, decodeTile as gt, tagParagraph as h, embedLtvData as ha, code128ToOperators as hi, buildThresholdHalftone as hn, buildDeviceNColorSpace as ho, FontNotEmbeddedError as hr, assembleTiles as ht, convertPdfAConformanceXmp as i, flattenTransparency as ia, upcAToOperators as ii, sampleShadingColor as in, generateLineAppearance as io, removeAllBookmarks as ir, layoutParagraph as it, registerEmbeddedFile as j, parseExistingTrailer as ja, analyzeJpegMarkers as ji, DEFAULT_SARIF_TOOL_NAME as jn, toAlpha as jr, setFieldVisibility as jt, buildPageOutputIntent as k, appendIncrementalUpdate as ka, extractJpegMetadata as ki, buildLab as kn, formatDate$1 as kr, setFieldValue as kt, LIST_NUMBERING_KEY as l, isLinearized as la, encodeEan8 as li, buildBoxDict as ln, PdfLinkAnnotation as lo, BatchProcessingError as lr, downscale16To8 as lt, tagListItem as m, buildDssDictionary as ma, encodeCode39 as mi, buildSampledTransferFunction as mn, PDFOperator as mo, FieldExistsAsNonTerminalError as mr, upscale8To16 as mt, buildPdfRIdentificationXmp as n, generateSrgbIccProfile as na, calculateUpcCheckDigit as ni, pdfA4Rules as nn, generateHighlightAppearance as no, addBookmark as nr, findHyphenationPoints as nt, autoTagPage as o, validatePdfA as oa, ean13ToOperators as oi, levenshtein as on, generateSquigglyAppearance as oo, flattenField as or, buildPdfXOutputIntent as ot, tagList as p, optimizeIncrementalSave as pa, computeCode39CheckDigit as pi, STANDARD_SPOT_FUNCTIONS as pn, parseXmpMetadata$1 as po, FieldAlreadyExistsError as pr, summarizeBitDepth as pt, interpretPage as q, PdfPolygonAnnotation as qa, getProfile as qi, metadataPlugin as qn, readCode39 as qr, gtsPdfVtVersion as qt, buildWtpdfIdentificationXmp as r, detectTransparency as ra, encodeUpcA as ri, buildFunctionShading as rn, generateInkAppearance as ro, getBookmarks as rr, layoutColumns as rt, buildPdfUa2Xmp as s, delinearizePdf as sa, ean8ToOperators as si, renderCodeFrame as sn, generateStrikeOutAppearance as so, flattenFields as sr, enforcePdfX as st, initWasm as t, SRGB_ICC_PROFILE as ta, encodeDataMatrix as ti, buildPdfA4Xmp as tn, generateFreeTextAppearance as to, processBatch as tr, validateCertificateChain as tt, tagFigure as u, linearizePdf as ua, encodeItf as ui, buildGtsPdfxVersion as un, PdfTextAnnotation as uo, CombedTextLayoutError as ur, getComponentDepths as ut, tagTableHeaderCell as v, getCounterSignatures as va, valuesToModules as vi, identityTransferFunction as vn, saveDocumentIncremental as vo, InvalidFieldNamePartError as vr, parseTileInfo as vt, buildSoftMaskGroupExtGState as w, MdpPermission as wa, webpToJpeg as wi, reconstructParagraphs as wn, RichTextFieldReadError as wr, checkCertificateStatus as wt, buildColorKeyMask as x, buildFieldLockDict as xa, embedTiffDirect as xi, markdownToPdf as xn, NoSuchFieldError as xr, downloadCrl as xt, tagTableRow as y, diffSignedContent as ya, PdfWorker as yi, nameHalftone as yn, saveIncremental as yo, InvalidPageSizeError as yr, verifySignatureDetailed as yt, extractFonts as z, PdfCaretAnnotation as za, generatePdfAXmpBytes as zi, buildPieceInfo as zn, applyPreset as zr, decodeWoff as zt };
30990
31282
 
30991
- //# sourceMappingURL=src-B7SQNDvy.mjs.map
31283
+ //# sourceMappingURL=src-DNe0XZhx.mjs.map