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;
@@ -31592,6 +31884,12 @@ Object.defineProperty(exports, "buildPdfA4Xmp", {
31592
31884
  return buildPdfA4Xmp;
31593
31885
  }
31594
31886
  });
31887
+ Object.defineProperty(exports, "buildPdfRIdentificationXmp", {
31888
+ enumerable: true,
31889
+ get: function() {
31890
+ return buildPdfRIdentificationXmp;
31891
+ }
31892
+ });
31595
31893
  Object.defineProperty(exports, "buildPdfUa2Xmp", {
31596
31894
  enumerable: true,
31597
31895
  get: function() {
@@ -31700,6 +31998,12 @@ Object.defineProperty(exports, "buildVtDpm", {
31700
31998
  return buildVtDpm;
31701
31999
  }
31702
32000
  });
32001
+ Object.defineProperty(exports, "buildWtpdfIdentificationXmp", {
32002
+ enumerable: true,
32003
+ get: function() {
32004
+ return buildWtpdfIdentificationXmp;
32005
+ }
32006
+ });
31703
32007
  Object.defineProperty(exports, "buildXmpMetadata", {
31704
32008
  enumerable: true,
31705
32009
  get: function() {
@@ -31778,6 +32082,12 @@ Object.defineProperty(exports, "computeTileGrid", {
31778
32082
  return computeTileGrid;
31779
32083
  }
31780
32084
  });
32085
+ Object.defineProperty(exports, "convertPdfAConformanceXmp", {
32086
+ enumerable: true,
32087
+ get: function() {
32088
+ return convertPdfAConformanceXmp;
32089
+ }
32090
+ });
31781
32091
  Object.defineProperty(exports, "convertTiffCmykToRgb", {
31782
32092
  enumerable: true,
31783
32093
  get: function() {
@@ -32534,6 +32844,12 @@ Object.defineProperty(exports, "pdfA4Rules", {
32534
32844
  return pdfA4Rules;
32535
32845
  }
32536
32846
  });
32847
+ Object.defineProperty(exports, "preflightPdfA", {
32848
+ enumerable: true,
32849
+ get: function() {
32850
+ return preflightPdfA;
32851
+ }
32852
+ });
32537
32853
  Object.defineProperty(exports, "processBatch", {
32538
32854
  enumerable: true,
32539
32855
  get: function() {
@@ -33021,4 +33337,4 @@ Object.defineProperty(exports, "wrapText", {
33021
33337
  }
33022
33338
  });
33023
33339
 
33024
- //# sourceMappingURL=src-VeeIdf7B.cjs.map
33340
+ //# sourceMappingURL=src-CeKIKI1W.cjs.map