documents.js 4.3.0 → 4.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/dist/convert/composition.cjs +4 -1
- package/dist/convert/composition.js +4 -1
- package/dist/convert/pdf-package-tables.cjs +76 -0
- package/dist/convert/pdf-package-tables.d.cts +6 -0
- package/dist/convert/pdf-package-tables.d.ts +6 -0
- package/dist/convert/pdf-package-tables.js +75 -0
- package/dist/edit/pdf/item.cjs +42 -1
- package/dist/edit/pdf/item.d.cts +2 -2
- package/dist/edit/pdf/item.d.ts +2 -2
- package/dist/edit/pdf/item.js +42 -2
- package/dist/edit/pdf/page.d.cts +1 -1
- package/dist/edit/pdf/page.d.ts +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/{item-D9vQKT0T.d.cts → item-DhXpJNAQ.d.cts} +17 -3
- package/dist/{item-D9vQKT0T.d.ts → item-DhXpJNAQ.d.ts} +17 -3
- package/dist/layout/reconstruct.cjs +135 -6
- package/dist/layout/reconstruct.js +135 -6
- package/dist/markdown/math.cjs +5 -7
- package/dist/markdown/math.js +5 -7
- package/dist/markdown/write.cjs +0 -10
- package/dist/markdown/write.d.cts +2 -6
- package/dist/markdown/write.d.ts +2 -6
- package/dist/markdown/write.js +1 -10
- package/package.json +6 -6
package/dist/index.d.ts
CHANGED
|
@@ -53,7 +53,7 @@ import { CreateEmptyOdsPackageOptions } from "./edit/ods/scaffold.js";
|
|
|
53
53
|
import { BuildOdtPackageOptions, buildOdtPackage } from "./edit/odt/content.js";
|
|
54
54
|
import { CreateOdtOptions, OdtBody, OdtEditor, createOdt, openOdt } from "./edit/odt/editor.js";
|
|
55
55
|
import { CreateEmptyOdtPackageOptions } from "./edit/odt/scaffold.js";
|
|
56
|
-
import { a as
|
|
56
|
+
import { a as PdfInternalLinkItem, c as PdfLineItem, d as PdfPathInit, f as PdfPathItem, g as PdfTextItem, h as PdfTextInit, i as PdfImageItem, l as PdfLinkInit, m as PdfRectItem, n as PdfEllipseItem, o as PdfItem, p as PdfRectInit, r as PdfImageInit, s as PdfLineInit, t as PdfEllipseInit, u as PdfLinkItem } from "./item-DhXpJNAQ.js";
|
|
57
57
|
import { PageInit, PdfPage } from "./edit/pdf/page.js";
|
|
58
58
|
import { CreatePdfOptions, PdfEditor, createPdf, openPdf } from "./edit/pdf/editor.js";
|
|
59
59
|
import { BuildPptxPackageOptions, buildPptxPackage } from "./edit/pptx/content.js";
|
|
@@ -93,7 +93,7 @@ import { readOdgContent } from "./odf/odg/read.js";
|
|
|
93
93
|
import { readOdfEmbeddedFormula, readOdfFormulaContent } from "./odf/formula/read.js";
|
|
94
94
|
import { decodeMarkdownText, encodeMarkdownText } from "./markdown/text.js";
|
|
95
95
|
import { readMarkdownContent } from "./markdown/read.js";
|
|
96
|
-
import {
|
|
96
|
+
import { buildMarkdownText } from "./markdown/write.js";
|
|
97
97
|
import { SvgInvalidUtf8Error, decodeSvgText, encodeSvgText } from "./svg/text.js";
|
|
98
98
|
import { ReadSvgContentOptions, SvgMissingRootElementError, readSvgContent } from "./svg/read.js";
|
|
99
99
|
import { BuildSvgTextOptions, SvgMultiPageNotSpecifiedError, SvgPageNotFoundError, SvgUnsupportedDocumentKindError, buildSvgText } from "./svg/write.js";
|
|
@@ -130,4 +130,4 @@ import { Attribute, AttributeSchema, BinaryPart, BinaryPartSchema, Comment, Comm
|
|
|
130
130
|
import { Alignment, Box, COLOR_BLACK, CellPosition, CellRange, Color as LayoutColor, ContentBlock, ContentBlockSchema, ContentCellValue, ContentCellValueSchema, ContentDocument, ContentDocumentJson, ContentDocumentSchema, ContentDrawPage, ContentDrawPageSchema, ContentImageBlock, ContentImageBlockSchema, ContentListMembership, ContentPageBreak, ContentPageBreakSchema, ContentParagraph, ContentParagraphSchema, ContentPathPoint, ContentPathPointSchema, ContentPathSegment, ContentPathSegmentSchema, ContentRun, ContentRunSchema, ContentSection, ContentSectionSchema, ContentShape, ContentShapeSchema, ContentSheet, ContentSheetCell, ContentSheetCellSchema, ContentSheetColumn, ContentSheetColumnSchema, ContentSheetImage, ContentSheetPrintRange, ContentSheetPrintRangeSchema, ContentSheetPrintSettings, ContentSheetPrintSettingsSchema, ContentSheetRepeatRange, ContentSheetRepeatRangeSchema, ContentSheetRow, ContentSheetRowSchema, ContentSheetSchema, ContentSlide, ContentSlideSchema, ContentStroke, ContentStrokeSchema, ContentSubpath, ContentSubpathSchema, ContentTable, ContentTableCell, ContentTableCellSchema, ContentTableRow, ContentTableRowSchema, ContentTableSchema, ContentVector, ContentVectorSchema, DEFAULT_LAYOUT_FONT, DocumentJsonResult, DocumentPackage, DocumentPackageJson, DocumentPackageSchema, DocumentSchemaKind, FontFace, LayoutFont, LayoutMetadata, Margins, MathAssembledGlyphs, MathBox, MathColor, MathFontMetrics, MathGlyphMetrics, MathGlyphPlacement, MathGlyphRun, MathLayoutItem, MathRule, MathStretchAxis, MathStretchGlyph, MathStretchResult, MathStroke, PAGE_SIZE_A4, PAGE_SIZE_LETTER, PageSize, PositionedFormula, SLIDE_SIZE_STANDARD, SLIDE_SIZE_WIDESCREEN, UnrecognizedDocumentSchemaError, cellReference, columnIndexToLetters, columnLettersToIndex, contentDocumentWithSchema, documentFromJson, documentPackageWithSchema, documentSchemaKindOf, isContentBlock, parseCellReference, parseRangeReference, rangeReference, rgbHexToColor, schemaUriFor } from "document-schema.js";
|
|
131
131
|
import { FontFaceParseError, FontRegistry, FontRegistryOptions, FontSubstitution, LAYOUT_FORMAT_VERSION, LayoutDocument, LayoutDocumentSchema, LayoutEllipse, LayoutImage, LayoutImageAsset, LayoutItem, LayoutLine, LayoutLink, LayoutPage, LayoutPath, LayoutPathSegment, LayoutRect, LayoutSubpath, LayoutText, LoadedMathFont, MathFont, MathFontDescriptorMetrics, NOOP_DIAGNOSTIC_SINK, PdfDiagnostic, PdfDiagnosticSeverity, PdfDiagnosticSink, PdfEncryptedError, PdfParseError, ProvidedFont, ReadPdfOptions, ResolvedFace, WinAnsiSubstitution, WritePdfOptions, createFontMeasurer, createFontRegistry, createStandardFontMeasurer, loadMathFont, pdfCodec, readFontFace as describeFontFace, readPdf, writePdf } from "pdf-codec";
|
|
132
132
|
import { OdbComponentInfo, OdbConnectionInfo, OdbForm, OdbFormControl, OdbFormDefinition, OdbInventory, OdbQueryInfo, OdbReport, OdbReportBand, OdbReportElement, OdbReportFunction, OdbReportGroup, readOdbForm, readOdbInventory, readOdbReport, resolveOdbComponent } from "odf.js";
|
|
133
|
-
export { type Alignment, type Attribute, AttributeSchema, type BinaryPart, BinaryPartSchema, type Box, type BuildCsvTextOptions, type BuildDocxPackageOptions, type BuildOdgPackageOptions, type BuildOdpPackageOptions, type BuildOdsPackageOptions, type BuildOdtPackageOptions, type BuildPptxPackageOptions, type BuildSvgTextOptions, COLOR_BLACK, type CellPosition, type CellRange, type CellTypeDeclineReason, type CellTypeInference, type CellTypeInferenceResult, type CellTypeInferenceSink, type CellTypeRule, type ClockPort, type Comment, CommentSchema, type CompactAttrPairs, type CompactPackage, CompactPackageSchema, type CompactPart, CompactPartSchema, type CompactXmlNode, CompactXmlNodeSchema, type CompositionHop, type ContentBlock, ContentBlockSchema, type ContentCellValue, ContentCellValueSchema, type ContentDocument, type ContentDocumentJson, ContentDocumentSchema, type ContentDrawPage, ContentDrawPageSchema, type ContentImageBlock, ContentImageBlockSchema, type ContentListMembership, type ContentPageBreak, ContentPageBreakSchema, type ContentParagraph, ContentParagraphSchema, type ContentPathPoint, ContentPathPointSchema, type ContentPathSegment, ContentPathSegmentSchema, type ContentRun, ContentRunSchema, type ContentSection, ContentSectionSchema, type ContentShape, ContentShapeSchema, type ContentSheet, type ContentSheetCell, ContentSheetCellSchema, type ContentSheetColumn, ContentSheetColumnSchema, type ContentSheetImage, type ContentSheetPrintRange, ContentSheetPrintRangeSchema, type ContentSheetPrintSettings, ContentSheetPrintSettingsSchema, type ContentSheetRepeatRange, ContentSheetRepeatRangeSchema, type ContentSheetRow, ContentSheetRowSchema, ContentSheetSchema, type ContentSlide, ContentSlideSchema, type ContentStroke, ContentStrokeSchema, type ContentSubpath, ContentSubpathSchema, type ContentTable, type ContentTableCell, ContentTableCellSchema, type ContentTableRow, ContentTableRowSchema, ContentTableSchema, type ContentVector, ContentVectorSchema, type ConversionOptions, type ConversionPlan, type ConversionRequest, type ConversionResult, type CreateDocxOptions, type CreateEmptyDocxPackageOptions, type CreateEmptyOdgPackageOptions, type CreateEmptyOdpPackageOptions, type CreateEmptyOdsPackageOptions, type CreateEmptyOdtPackageOptions, type CreateEmptyPptxPackageOptions, type CreateMarkdownEditorOptions, type CreateOdgOptions, type CreateOdpOptions, type CreateOdsOptions, type CreateOdtOptions, type CreatePdfOptions, type CreatePptxOptions, CsvBytesSchema, CsvInvalidUtf8Error, CsvParseError, type CsvReadOptions, CsvSheetNotFoundError, CsvSheetNotSpecifiedError, CsvUnsupportedDocumentKindError, type CsvWriteOptions, DEFAULT_LAYOUT_FONT, DOCUMENT_FORMATS, type DefinedName, DefinedNameSchema, type Diagnostic, type DocumentBridgeOptions, type DocumentConverter, type DocumentFontRegistryOptions, type DocumentFormat, DocumentFormatSchema, type DocumentJsonResult, type DocumentPackage, type DocumentPackageJson, DocumentPackageSchema, type DocumentPayload, type DocumentSchemaKind, type DocumentToPdfOptions, type DocxBody, DocxBytesSchema, DocxEditor, type DocxExtras, DocxParagraph, DocxRun, DocxTable, DocxTableCell, DocxTableRow, type DocxVerticalMerge, type DrawingLayoutOptions, type DrawingLayoutResult, type DrawingParagraphInit, type DrawingRunInit, type EngineLayoutOptions, SUPPORTED_BACKUP_FORMAT_VERSION as FIREBIRD_SUPPORTED_BACKUP_FORMAT_VERSION, FirebirdBackupFormatError, FirebirdBackupParseError, type FirebirdBackupSummary, FirebirdCompositeRecordUnsupportedError, FirebirdDataParseError, FirebirdSchemaParseError, FirebirdUnsupportedFieldTypeError, FontDeobfuscationError, type FontFace, FontFaceParseError, type FontRegistry, type FontRegistryOptions, type FontSourcePackage, type FontSubstitution, type Footnote, FootnoteSchema, type GridLattice, type HsqldbBinaryScript, HsqldbBinaryScriptParseError, type HsqldbColumn, type HsqldbDecodeOptions, HsqldbRowFormatError, HsqldbScriptParseError, HsqldbSqlEvaluationError, HsqldbSqlParseError, HsqldbSqlUnsupportedError, type HsqldbTable, LATEX_DIAGNOSTIC_CODES, LAYOUT_FORMAT_VERSION, type LatexDiagnostic, type LatexDiagnosticCode, type LatexDiagnosticSink, type LatexFormulaOptions, type LatexFormulaResult, type LatexLoweringResult, type LayoutColor, type LayoutDocument, LayoutDocumentSchema, type LayoutEllipse, type LayoutFont, type LayoutFormulaOptions, type LayoutImage, type LayoutImageAsset, type LayoutItem, type LayoutLine, type LayoutLink, type LayoutMetadata, type LayoutPage, type LayoutPath, type LayoutPathSegment, type LayoutRect, type LayoutSubpath, type LayoutText, type LoadedMathFont, type LowerLatexOptions, MATH_LINT_CODES, type Margins, type MarkdownBody, MarkdownBytesSchema, MarkdownConstructUnsupportedError, MarkdownEditor, MarkdownList, type MarkdownListInit, type MarkdownMathLoweringOptions, MarkdownParagraph, type ParagraphInit as MarkdownParagraphInit, type MarkdownRenderDiagnostic, type MarkdownRenderDiagnosticCode, MarkdownRenderDiagnosticCodes, type MarkdownRenderDiagnosticSeverity, type MarkdownRenderDiagnosticSink, MarkdownRun, type RunInit as MarkdownRunInit, MarkdownTable, MarkdownTableCell, type TableInit as MarkdownTableInit, MarkdownTableRow, type MathAssembledGlyphs, type MathBox, type MathColor, type MathDiagnostic, type MathDiagnosticKind, type MathFont, type MathFontDescriptorMetrics, type MathFontMetrics, type MathGlyphMetrics, type MathGlyphPlacement, type MathGlyphRun, type MathLayoutItem, type MathLayoutResult, type MathLintCode, type MathLintDiagnostic, type MathMlAttribute, type MathMlElement, type MathMlNode, type MathMlText, type MathRule, type MathStretchAxis, type MathStretchGlyph, type MathStretchResult, type MathStroke, type MathVariant, type MetadataOverrides, NOOP_DIAGNOSTIC_SINK, type NumberingDefinition, NumberingDefinitionSchema, type NumberingDefinitions, type NumberingLevel, NumberingLevelSchema, type OdbComponentInfo, type OdbConnectionInfo, type OdbConversionOptions, type OdbForm, type OdbFormControl, type OdbFormDefinition, type OdbInventory, OdbNoEmbeddedDataSourceError, type OdbQueryInfo, type OdbReport, type OdbReportBand, type OdbReportContentOptions, OdbReportDataSourceError, type OdbReportElement, type OdbReportFunction, type OdbReportGroup, OdbReportNotSpecifiedError, type OdbReportToDocxOptions, type OdbReportToOdtOptions, OdbTableNotFoundError, OdbTableNotSpecifiedError, type OdbToCsvOptions, type OdbUnsupportedFormat, OdbUnsupportedFormatError, OdfEmbeddedFontError, OdgBoxVector, type BoxVectorInit as OdgBoxVectorInit, OdgBytesSchema, OdgEditor, OdgLineVector, type LineVectorInit as OdgLineVectorInit, OdgPage, type PageImageInit as OdgPageImageInit, OdgPathVector, type PathVectorInit as OdgPathVectorInit, type TextBoxInit as OdgTextBoxInit, type OdgVector, type OdgVectorKind, type OdmToPdfOptions, OdmUnresolvedSectionError, OdpBytesSchema, OdpEditor, OdpShape, OdpSlide, type SlideImageInit as OdpSlideImageInit, type SlideTableInit as OdpSlideTableInit, type TextBoxInit$1 as OdpTextBoxInit, OdsBytesSchema, OdsCell, OdsEditor, OdsSheet, type OdtBody, OdtBytesSchema, OdtEditor, OdtList, OdtListItem, OdtParagraph, type ParagraphInit$1 as OdtParagraphInit, OdtRun, type RunInit$1 as OdtRunInit, OdtTable, OdtTableCell, type TableInit$1 as OdtTableInit, OdtTableRow, type OmmlDiagnostic, type OmmlDiagnosticKind, type OmmlReadResult, type OmmlWriteResult, OoxmlEmbeddedFontError, type OperatorProperties, PAGE_SIZE_A4, PAGE_SIZE_LETTER, type Package, PackageSchema, type PageInit, type PageSize, type Part, PartSchema, PdfBytesSchema, type PdfDiagnostic, type PdfDiagnosticSeverity, type PdfDiagnosticSink, PdfEditor, type PdfEllipseInit, PdfEllipseItem, PdfEncryptedError, type PdfImageInit, PdfImageItem, type PdfItem, type PdfLineInit, PdfLineItem, type PdfLinkInit, PdfLinkItem, PdfPage, PdfParseError, type PdfPathInit, PdfPathItem, type PdfRectInit, PdfRectItem, type PdfTextInit, PdfTextItem, type PdfToDocumentOptions, type PositionedFormula, PptxBytesSchema, PptxEditor, PptxShape, PptxSlide, PptxTable, PptxTableCell, type PptxTableInit, PptxTableRow, type PresentationLayoutResult, type ProvidedFont, type ReadCsvContentOptions, type ReadDocumentMetadataOptions, type ReadDocxContentOptions, type ReadFirebirdBackupResult, type ReadPdfOptions, type ReadSvgContentOptions, type ReconstructOptions, type Relationship, type RenderMarkdownOptions, type ResolvedFace, type RptAggregateFunction, type RptBandDefinition, type RptBandInstance, type RptBandKind, type RptFormula, RptFormulaEvaluationError, RptFormulaParseError, RptFormulaUnsupportedError, type RptGroupDefinition, type RptNamedFunctionDefinition, type RptReference, type RptReportDefinition, type RptReportRun, RptReportStructureError, type RptScope, SLIDE_SIZE_STANDARD, SLIDE_SIZE_WIDESCREEN, SVG_DIAGNOSTIC_CODES, type SetDocumentMetadataOptions, type SheetsLayoutOptions, type SlideImageInit$1 as SlideImageInit, type SlideTableInit$1 as SlideTableInit, type SlidesLayoutOptions, type SpreadsheetLayoutResult, type SqlAggregateArgument, type SqlAggregateFunction, type SqlColumnRef, type SqlComparisonOperator, type SqlLiteral, type SqlNameRef, type SqlOperand, type SqlOrderByTerm, type SqlPredicate, type SqlPunctuation, type SqlResultSet, type SqlSelectItem, type SqlSelectStatement, type SqlSortDirection, type SqlToken, SvgBytesSchema, type SvgDiagnostic, type SvgDiagnosticCode, type SvgDiagnosticSink, SvgInvalidUtf8Error, SvgMissingRootElementError, SvgMultiPageNotSpecifiedError, SvgPageNotFoundError, type SvgReadOptions, SvgUnsupportedDocumentKindError, type SvgWriteOptions, type TextBoxInit$2 as TextBoxInit, type UnifiedConversionOptions, UnrecognizedDocumentSchemaError, UnsupportedFontSourceFormatError, UnsupportedPackageFormatError, type WinAnsiSubstitution, type WordprocessingLayoutResult, type WritePdfOptions, XlsxBytesSchema, type XmlCdata, XmlCdataSchema, type XmlComment, XmlCommentSchema, type XmlDeclaration, XmlDeclarationSchema, type XmlElement, XmlElementSchema, type XmlNode, XmlNodeSchema, type XmlPart, XmlPartSchema, type XmlPi, XmlPiSchema, type XmlText, XmlTextSchema, applyMathVariant, attr, base64ToBytes, buildCsvText, buildDocumentBytes, buildDocxPackage, buildDrawingBlock, buildFormulaBlock, buildMarkdownText, buildOdgPackage, buildOdpPackage, buildOdsPackage, buildOdtPackage, buildOfficeMath, buildOfficeMathParagraph, buildPptxPackage, buildSvgText, buildXlsxPackage, buildXml, bytesToBase64, cellReference, childrenWithTag, collectOfficeMathElements, columnIndexToLetters, columnLettersToIndex, compactCodec, compactPackageCodec, contentDocumentWithSchema, convertDocument, convertDrawingToLayout, convertPresentationToLayout, convertSpreadsheetToLayout, convertWordprocessingToLayout, createDocumentFontRegistry, createDocx, createFontMeasurer, createFontRegistry, createLocalDocumentConverter, createMarkdownEditor, createOdg, createOdp, createOds, createOdt, createPdf, createPptx, createStandardFontMeasurer, csvMarkdownCodec, csvPdfCodec, csvToMarkdown, csvToOds, csvToPdf, csvToXlsx, decodeCompactPackage, decodeCsvText, decodeDocumentPackage, decodeEntities, decodeHsqldbCachedTables, decodeMarkdownText, decodeOdbPackage, decodePackage, decodeSvgText, deobfuscateEmbeddedFont, deriveFontKey, describeFontFace, detectGridLattice, documentFromJson, documentPackageWithSchema, documentSchemaKindOf, docxPdfCodec, docxToMarkdown, docxToOdt, docxToPdf, docxToPptx, drawingOfBlock, elementChildren, elementLocalName, elementsWithTag, encodeCompactPackage, encodeCsvText, encodeDocumentPackage, encodeMarkdownText, encodePackage, encodeSvgText, evaluateRptBandOutsideData, evaluateSelect, extractOdfEmbeddedFonts, extractOoxmlEmbeddedFonts, extractSourceFonts, extractSourceFontsForFormat, firstChildByLocalName, fixedClock, flipY, formulaDocument, formulaOfBlock, formulaPlaceholderText, fromCompact, displayTextFor as hsqldbCellDisplayText, inferCellValue, inflateHsqldbCompressedScript, isCompactXmlNode, isContentBlock, isMathMlElement, isMathVariant, isXmlNode, latexToFormula, layoutDocumentFromPackage, layoutFormula, lintMathCoherence, loadMathFont, localName, looksLikeSfnt, lowerLatex, lowerMarkdownMath, mapMathVariant, markdownDocxCodec, markdownOdtCodec, markdownPdfCodec, markdownToCsv, markdownToDocx, markdownToOdt, markdownToPdf, markdownToXlsx, textContent as mathMlTextContent, odbReportCommandSql, odbReportGroupChain, odbReportToDocx, odbReportToOdt, odbReportToPdf, odbTablesToSpreadsheetDocument, odbToCsv, odbToXlsx, odfToPdf, odgPdfCodec, odgSvgCodec, odgToPdf, odgToSvg, odmToPdf, odpPdfCodec, odpPptxCodec, odpToOdt, odpToPdf, odpToPptx, odsCsvCodec, odsPdfCodec, odsToCsv, odsToPdf, odsToXlsx, odsXlsxCodec, odtDocxCodec, odtPdfCodec, odtToDocx, odtToMarkdown, odtToOdp, odtToPdf, openDocx, openMarkdown, openOdg, openOdp, openOds, openOdt, openPdf, openPptx, operatorProperties, packageCodec, parseCellReference, parseHsqldbBinaryScript, parseHsqldbScript, parsePackage, parseRangeReference, parseRptFormula, parseSelect, parseXml, pdfCodec, pdfToCsv, pdfToDocx, pdfToMarkdown, pdfToOdg, pdfToOdp, pdfToOds, pdfToOdt, pdfToPptx, pdfToSvg, pdfToXlsx, pptxPdfCodec, pptxToDocx, pptxToOdp, pptxToPdf, rangeReference, readCsvContent, readDocumentMetadata, readDocxContent, readDocxExtras, readFirebirdBackup, readMarkdownContent, readOdbForm, readOdbForms, readOdbInventory, readOdbReport, readOdbReportContent, readOdbReports, readOdbTables, readOdfEmbeddedFormula, readOdfFormulaContent, readOdgContent, readOdpContent, readOdsContent, readOdtContent, readOfficeMath, readPdf, readPptxContent, readSvgContent, readXlsxContent, reconstructDrawing, reconstructPresentation, reconstructSpreadsheet, reconstructWordprocessing, renderContentDocumentToMarkdown, renderOdbReportContent, resolveCompositionPlan, resolveMetadataTimestamps, resolveOdbComponent, resolveOdbReportRows, resolveRelationships, rgbHexToColor, rootElement, rptBandDefinition, rptDefinitionFromReport, runRptReport, schemaUriFor, serializePackage, setDocumentMetadata, svgPdfCodec, svgToOdg, svgToPdf, systemClock, textContent$1 as textContent, throwIfAborted, toCompact, tokenizeSql, unzipPackage, walk, writePdf, xlsxCsvCodec, xlsxMarkdownCodec, xlsxPdfCodec, xlsxToCsv, xlsxToMarkdown, xlsxToOds, xlsxToPdf, xmlCodec, zipPackage };
|
|
133
|
+
export { type Alignment, type Attribute, AttributeSchema, type BinaryPart, BinaryPartSchema, type Box, type BuildCsvTextOptions, type BuildDocxPackageOptions, type BuildOdgPackageOptions, type BuildOdpPackageOptions, type BuildOdsPackageOptions, type BuildOdtPackageOptions, type BuildPptxPackageOptions, type BuildSvgTextOptions, COLOR_BLACK, type CellPosition, type CellRange, type CellTypeDeclineReason, type CellTypeInference, type CellTypeInferenceResult, type CellTypeInferenceSink, type CellTypeRule, type ClockPort, type Comment, CommentSchema, type CompactAttrPairs, type CompactPackage, CompactPackageSchema, type CompactPart, CompactPartSchema, type CompactXmlNode, CompactXmlNodeSchema, type CompositionHop, type ContentBlock, ContentBlockSchema, type ContentCellValue, ContentCellValueSchema, type ContentDocument, type ContentDocumentJson, ContentDocumentSchema, type ContentDrawPage, ContentDrawPageSchema, type ContentImageBlock, ContentImageBlockSchema, type ContentListMembership, type ContentPageBreak, ContentPageBreakSchema, type ContentParagraph, ContentParagraphSchema, type ContentPathPoint, ContentPathPointSchema, type ContentPathSegment, ContentPathSegmentSchema, type ContentRun, ContentRunSchema, type ContentSection, ContentSectionSchema, type ContentShape, ContentShapeSchema, type ContentSheet, type ContentSheetCell, ContentSheetCellSchema, type ContentSheetColumn, ContentSheetColumnSchema, type ContentSheetImage, type ContentSheetPrintRange, ContentSheetPrintRangeSchema, type ContentSheetPrintSettings, ContentSheetPrintSettingsSchema, type ContentSheetRepeatRange, ContentSheetRepeatRangeSchema, type ContentSheetRow, ContentSheetRowSchema, ContentSheetSchema, type ContentSlide, ContentSlideSchema, type ContentStroke, ContentStrokeSchema, type ContentSubpath, ContentSubpathSchema, type ContentTable, type ContentTableCell, ContentTableCellSchema, type ContentTableRow, ContentTableRowSchema, ContentTableSchema, type ContentVector, ContentVectorSchema, type ConversionOptions, type ConversionPlan, type ConversionRequest, type ConversionResult, type CreateDocxOptions, type CreateEmptyDocxPackageOptions, type CreateEmptyOdgPackageOptions, type CreateEmptyOdpPackageOptions, type CreateEmptyOdsPackageOptions, type CreateEmptyOdtPackageOptions, type CreateEmptyPptxPackageOptions, type CreateMarkdownEditorOptions, type CreateOdgOptions, type CreateOdpOptions, type CreateOdsOptions, type CreateOdtOptions, type CreatePdfOptions, type CreatePptxOptions, CsvBytesSchema, CsvInvalidUtf8Error, CsvParseError, type CsvReadOptions, CsvSheetNotFoundError, CsvSheetNotSpecifiedError, CsvUnsupportedDocumentKindError, type CsvWriteOptions, DEFAULT_LAYOUT_FONT, DOCUMENT_FORMATS, type DefinedName, DefinedNameSchema, type Diagnostic, type DocumentBridgeOptions, type DocumentConverter, type DocumentFontRegistryOptions, type DocumentFormat, DocumentFormatSchema, type DocumentJsonResult, type DocumentPackage, type DocumentPackageJson, DocumentPackageSchema, type DocumentPayload, type DocumentSchemaKind, type DocumentToPdfOptions, type DocxBody, DocxBytesSchema, DocxEditor, type DocxExtras, DocxParagraph, DocxRun, DocxTable, DocxTableCell, DocxTableRow, type DocxVerticalMerge, type DrawingLayoutOptions, type DrawingLayoutResult, type DrawingParagraphInit, type DrawingRunInit, type EngineLayoutOptions, SUPPORTED_BACKUP_FORMAT_VERSION as FIREBIRD_SUPPORTED_BACKUP_FORMAT_VERSION, FirebirdBackupFormatError, FirebirdBackupParseError, type FirebirdBackupSummary, FirebirdCompositeRecordUnsupportedError, FirebirdDataParseError, FirebirdSchemaParseError, FirebirdUnsupportedFieldTypeError, FontDeobfuscationError, type FontFace, FontFaceParseError, type FontRegistry, type FontRegistryOptions, type FontSourcePackage, type FontSubstitution, type Footnote, FootnoteSchema, type GridLattice, type HsqldbBinaryScript, HsqldbBinaryScriptParseError, type HsqldbColumn, type HsqldbDecodeOptions, HsqldbRowFormatError, HsqldbScriptParseError, HsqldbSqlEvaluationError, HsqldbSqlParseError, HsqldbSqlUnsupportedError, type HsqldbTable, LATEX_DIAGNOSTIC_CODES, LAYOUT_FORMAT_VERSION, type LatexDiagnostic, type LatexDiagnosticCode, type LatexDiagnosticSink, type LatexFormulaOptions, type LatexFormulaResult, type LatexLoweringResult, type LayoutColor, type LayoutDocument, LayoutDocumentSchema, type LayoutEllipse, type LayoutFont, type LayoutFormulaOptions, type LayoutImage, type LayoutImageAsset, type LayoutItem, type LayoutLine, type LayoutLink, type LayoutMetadata, type LayoutPage, type LayoutPath, type LayoutPathSegment, type LayoutRect, type LayoutSubpath, type LayoutText, type LoadedMathFont, type LowerLatexOptions, MATH_LINT_CODES, type Margins, type MarkdownBody, MarkdownBytesSchema, MarkdownEditor, MarkdownList, type MarkdownListInit, type MarkdownMathLoweringOptions, MarkdownParagraph, type ParagraphInit as MarkdownParagraphInit, type MarkdownRenderDiagnostic, type MarkdownRenderDiagnosticCode, MarkdownRenderDiagnosticCodes, type MarkdownRenderDiagnosticSeverity, type MarkdownRenderDiagnosticSink, MarkdownRun, type RunInit as MarkdownRunInit, MarkdownTable, MarkdownTableCell, type TableInit as MarkdownTableInit, MarkdownTableRow, type MathAssembledGlyphs, type MathBox, type MathColor, type MathDiagnostic, type MathDiagnosticKind, type MathFont, type MathFontDescriptorMetrics, type MathFontMetrics, type MathGlyphMetrics, type MathGlyphPlacement, type MathGlyphRun, type MathLayoutItem, type MathLayoutResult, type MathLintCode, type MathLintDiagnostic, type MathMlAttribute, type MathMlElement, type MathMlNode, type MathMlText, type MathRule, type MathStretchAxis, type MathStretchGlyph, type MathStretchResult, type MathStroke, type MathVariant, type MetadataOverrides, NOOP_DIAGNOSTIC_SINK, type NumberingDefinition, NumberingDefinitionSchema, type NumberingDefinitions, type NumberingLevel, NumberingLevelSchema, type OdbComponentInfo, type OdbConnectionInfo, type OdbConversionOptions, type OdbForm, type OdbFormControl, type OdbFormDefinition, type OdbInventory, OdbNoEmbeddedDataSourceError, type OdbQueryInfo, type OdbReport, type OdbReportBand, type OdbReportContentOptions, OdbReportDataSourceError, type OdbReportElement, type OdbReportFunction, type OdbReportGroup, OdbReportNotSpecifiedError, type OdbReportToDocxOptions, type OdbReportToOdtOptions, OdbTableNotFoundError, OdbTableNotSpecifiedError, type OdbToCsvOptions, type OdbUnsupportedFormat, OdbUnsupportedFormatError, OdfEmbeddedFontError, OdgBoxVector, type BoxVectorInit as OdgBoxVectorInit, OdgBytesSchema, OdgEditor, OdgLineVector, type LineVectorInit as OdgLineVectorInit, OdgPage, type PageImageInit as OdgPageImageInit, OdgPathVector, type PathVectorInit as OdgPathVectorInit, type TextBoxInit as OdgTextBoxInit, type OdgVector, type OdgVectorKind, type OdmToPdfOptions, OdmUnresolvedSectionError, OdpBytesSchema, OdpEditor, OdpShape, OdpSlide, type SlideImageInit as OdpSlideImageInit, type SlideTableInit as OdpSlideTableInit, type TextBoxInit$1 as OdpTextBoxInit, OdsBytesSchema, OdsCell, OdsEditor, OdsSheet, type OdtBody, OdtBytesSchema, OdtEditor, OdtList, OdtListItem, OdtParagraph, type ParagraphInit$1 as OdtParagraphInit, OdtRun, type RunInit$1 as OdtRunInit, OdtTable, OdtTableCell, type TableInit$1 as OdtTableInit, OdtTableRow, type OmmlDiagnostic, type OmmlDiagnosticKind, type OmmlReadResult, type OmmlWriteResult, OoxmlEmbeddedFontError, type OperatorProperties, PAGE_SIZE_A4, PAGE_SIZE_LETTER, type Package, PackageSchema, type PageInit, type PageSize, type Part, PartSchema, PdfBytesSchema, type PdfDiagnostic, type PdfDiagnosticSeverity, type PdfDiagnosticSink, PdfEditor, type PdfEllipseInit, PdfEllipseItem, PdfEncryptedError, type PdfImageInit, PdfImageItem, PdfInternalLinkItem, type PdfItem, type PdfLineInit, PdfLineItem, type PdfLinkInit, PdfLinkItem, PdfPage, PdfParseError, type PdfPathInit, PdfPathItem, type PdfRectInit, PdfRectItem, type PdfTextInit, PdfTextItem, type PdfToDocumentOptions, type PositionedFormula, PptxBytesSchema, PptxEditor, PptxShape, PptxSlide, PptxTable, PptxTableCell, type PptxTableInit, PptxTableRow, type PresentationLayoutResult, type ProvidedFont, type ReadCsvContentOptions, type ReadDocumentMetadataOptions, type ReadDocxContentOptions, type ReadFirebirdBackupResult, type ReadPdfOptions, type ReadSvgContentOptions, type ReconstructOptions, type Relationship, type RenderMarkdownOptions, type ResolvedFace, type RptAggregateFunction, type RptBandDefinition, type RptBandInstance, type RptBandKind, type RptFormula, RptFormulaEvaluationError, RptFormulaParseError, RptFormulaUnsupportedError, type RptGroupDefinition, type RptNamedFunctionDefinition, type RptReference, type RptReportDefinition, type RptReportRun, RptReportStructureError, type RptScope, SLIDE_SIZE_STANDARD, SLIDE_SIZE_WIDESCREEN, SVG_DIAGNOSTIC_CODES, type SetDocumentMetadataOptions, type SheetsLayoutOptions, type SlideImageInit$1 as SlideImageInit, type SlideTableInit$1 as SlideTableInit, type SlidesLayoutOptions, type SpreadsheetLayoutResult, type SqlAggregateArgument, type SqlAggregateFunction, type SqlColumnRef, type SqlComparisonOperator, type SqlLiteral, type SqlNameRef, type SqlOperand, type SqlOrderByTerm, type SqlPredicate, type SqlPunctuation, type SqlResultSet, type SqlSelectItem, type SqlSelectStatement, type SqlSortDirection, type SqlToken, SvgBytesSchema, type SvgDiagnostic, type SvgDiagnosticCode, type SvgDiagnosticSink, SvgInvalidUtf8Error, SvgMissingRootElementError, SvgMultiPageNotSpecifiedError, SvgPageNotFoundError, type SvgReadOptions, SvgUnsupportedDocumentKindError, type SvgWriteOptions, type TextBoxInit$2 as TextBoxInit, type UnifiedConversionOptions, UnrecognizedDocumentSchemaError, UnsupportedFontSourceFormatError, UnsupportedPackageFormatError, type WinAnsiSubstitution, type WordprocessingLayoutResult, type WritePdfOptions, XlsxBytesSchema, type XmlCdata, XmlCdataSchema, type XmlComment, XmlCommentSchema, type XmlDeclaration, XmlDeclarationSchema, type XmlElement, XmlElementSchema, type XmlNode, XmlNodeSchema, type XmlPart, XmlPartSchema, type XmlPi, XmlPiSchema, type XmlText, XmlTextSchema, applyMathVariant, attr, base64ToBytes, buildCsvText, buildDocumentBytes, buildDocxPackage, buildDrawingBlock, buildFormulaBlock, buildMarkdownText, buildOdgPackage, buildOdpPackage, buildOdsPackage, buildOdtPackage, buildOfficeMath, buildOfficeMathParagraph, buildPptxPackage, buildSvgText, buildXlsxPackage, buildXml, bytesToBase64, cellReference, childrenWithTag, collectOfficeMathElements, columnIndexToLetters, columnLettersToIndex, compactCodec, compactPackageCodec, contentDocumentWithSchema, convertDocument, convertDrawingToLayout, convertPresentationToLayout, convertSpreadsheetToLayout, convertWordprocessingToLayout, createDocumentFontRegistry, createDocx, createFontMeasurer, createFontRegistry, createLocalDocumentConverter, createMarkdownEditor, createOdg, createOdp, createOds, createOdt, createPdf, createPptx, createStandardFontMeasurer, csvMarkdownCodec, csvPdfCodec, csvToMarkdown, csvToOds, csvToPdf, csvToXlsx, decodeCompactPackage, decodeCsvText, decodeDocumentPackage, decodeEntities, decodeHsqldbCachedTables, decodeMarkdownText, decodeOdbPackage, decodePackage, decodeSvgText, deobfuscateEmbeddedFont, deriveFontKey, describeFontFace, detectGridLattice, documentFromJson, documentPackageWithSchema, documentSchemaKindOf, docxPdfCodec, docxToMarkdown, docxToOdt, docxToPdf, docxToPptx, drawingOfBlock, elementChildren, elementLocalName, elementsWithTag, encodeCompactPackage, encodeCsvText, encodeDocumentPackage, encodeMarkdownText, encodePackage, encodeSvgText, evaluateRptBandOutsideData, evaluateSelect, extractOdfEmbeddedFonts, extractOoxmlEmbeddedFonts, extractSourceFonts, extractSourceFontsForFormat, firstChildByLocalName, fixedClock, flipY, formulaDocument, formulaOfBlock, formulaPlaceholderText, fromCompact, displayTextFor as hsqldbCellDisplayText, inferCellValue, inflateHsqldbCompressedScript, isCompactXmlNode, isContentBlock, isMathMlElement, isMathVariant, isXmlNode, latexToFormula, layoutDocumentFromPackage, layoutFormula, lintMathCoherence, loadMathFont, localName, looksLikeSfnt, lowerLatex, lowerMarkdownMath, mapMathVariant, markdownDocxCodec, markdownOdtCodec, markdownPdfCodec, markdownToCsv, markdownToDocx, markdownToOdt, markdownToPdf, markdownToXlsx, textContent as mathMlTextContent, odbReportCommandSql, odbReportGroupChain, odbReportToDocx, odbReportToOdt, odbReportToPdf, odbTablesToSpreadsheetDocument, odbToCsv, odbToXlsx, odfToPdf, odgPdfCodec, odgSvgCodec, odgToPdf, odgToSvg, odmToPdf, odpPdfCodec, odpPptxCodec, odpToOdt, odpToPdf, odpToPptx, odsCsvCodec, odsPdfCodec, odsToCsv, odsToPdf, odsToXlsx, odsXlsxCodec, odtDocxCodec, odtPdfCodec, odtToDocx, odtToMarkdown, odtToOdp, odtToPdf, openDocx, openMarkdown, openOdg, openOdp, openOds, openOdt, openPdf, openPptx, operatorProperties, packageCodec, parseCellReference, parseHsqldbBinaryScript, parseHsqldbScript, parsePackage, parseRangeReference, parseRptFormula, parseSelect, parseXml, pdfCodec, pdfToCsv, pdfToDocx, pdfToMarkdown, pdfToOdg, pdfToOdp, pdfToOds, pdfToOdt, pdfToPptx, pdfToSvg, pdfToXlsx, pptxPdfCodec, pptxToDocx, pptxToOdp, pptxToPdf, rangeReference, readCsvContent, readDocumentMetadata, readDocxContent, readDocxExtras, readFirebirdBackup, readMarkdownContent, readOdbForm, readOdbForms, readOdbInventory, readOdbReport, readOdbReportContent, readOdbReports, readOdbTables, readOdfEmbeddedFormula, readOdfFormulaContent, readOdgContent, readOdpContent, readOdsContent, readOdtContent, readOfficeMath, readPdf, readPptxContent, readSvgContent, readXlsxContent, reconstructDrawing, reconstructPresentation, reconstructSpreadsheet, reconstructWordprocessing, renderContentDocumentToMarkdown, renderOdbReportContent, resolveCompositionPlan, resolveMetadataTimestamps, resolveOdbComponent, resolveOdbReportRows, resolveRelationships, rgbHexToColor, rootElement, rptBandDefinition, rptDefinitionFromReport, runRptReport, schemaUriFor, serializePackage, setDocumentMetadata, svgPdfCodec, svgToOdg, svgToPdf, systemClock, textContent$1 as textContent, throwIfAborted, toCompact, tokenizeSql, unzipPackage, walk, writePdf, xlsxCsvCodec, xlsxMarkdownCodec, xlsxPdfCodec, xlsxToCsv, xlsxToMarkdown, xlsxToOds, xlsxToPdf, xmlCodec, zipPackage };
|
package/dist/index.js
CHANGED
|
@@ -38,14 +38,14 @@ import { OdgEditor, createOdg, openOdg } from "./edit/odg/editor.js";
|
|
|
38
38
|
import { buildOdgPackage } from "./edit/odg/content.js";
|
|
39
39
|
import { latexToFormula, lowerLatex } from "./latex/lower.js";
|
|
40
40
|
import { lowerMarkdownMath } from "./markdown/math.js";
|
|
41
|
-
import {
|
|
41
|
+
import { buildMarkdownText } from "./markdown/write.js";
|
|
42
42
|
import { readMarkdownContent } from "./markdown/read.js";
|
|
43
43
|
import { MarkdownRun } from "./edit/markdown/run.js";
|
|
44
44
|
import { MarkdownParagraph } from "./edit/markdown/paragraph.js";
|
|
45
45
|
import { MarkdownList } from "./edit/markdown/list.js";
|
|
46
46
|
import { MarkdownTable, MarkdownTableCell, MarkdownTableRow } from "./edit/markdown/table.js";
|
|
47
47
|
import { MarkdownEditor, createMarkdownEditor, openMarkdown } from "./edit/markdown/editor.js";
|
|
48
|
-
import { PdfEllipseItem, PdfImageItem, PdfLineItem, PdfLinkItem, PdfPathItem, PdfRectItem, PdfTextItem } from "./edit/pdf/item.js";
|
|
48
|
+
import { PdfEllipseItem, PdfImageItem, PdfInternalLinkItem, PdfLineItem, PdfLinkItem, PdfPathItem, PdfRectItem, PdfTextItem } from "./edit/pdf/item.js";
|
|
49
49
|
import { PdfPage } from "./edit/pdf/page.js";
|
|
50
50
|
import { PdfEditor, createPdf, openPdf } from "./edit/pdf/editor.js";
|
|
51
51
|
import { FontDeobfuscationError, deobfuscateEmbeddedFont, deriveFontKey, looksLikeSfnt } from "./fonts/obfuscation.js";
|
|
@@ -122,4 +122,4 @@ import { AttributeSchema, BinaryPartSchema, CommentSchema, CompactPackageSchema,
|
|
|
122
122
|
import { COLOR_BLACK, ContentBlockSchema, ContentCellValueSchema, ContentDocumentSchema, ContentDrawPageSchema, ContentImageBlockSchema, ContentPageBreakSchema, ContentParagraphSchema, ContentPathPointSchema, ContentPathSegmentSchema, ContentRunSchema, ContentSectionSchema, ContentShapeSchema, ContentSheetCellSchema, ContentSheetColumnSchema, ContentSheetPrintRangeSchema, ContentSheetPrintSettingsSchema, ContentSheetRepeatRangeSchema, ContentSheetRowSchema, ContentSheetSchema, ContentSlideSchema, ContentStrokeSchema, ContentSubpathSchema, ContentTableCellSchema, ContentTableRowSchema, ContentTableSchema, ContentVectorSchema, DEFAULT_LAYOUT_FONT, DocumentPackageSchema, PAGE_SIZE_A4, PAGE_SIZE_LETTER, SLIDE_SIZE_STANDARD, SLIDE_SIZE_WIDESCREEN, UnrecognizedDocumentSchemaError, cellReference, columnIndexToLetters, columnLettersToIndex, contentDocumentWithSchema, documentFromJson, documentPackageWithSchema, documentSchemaKindOf, isContentBlock, parseCellReference, parseRangeReference, rangeReference, rgbHexToColor, schemaUriFor } from "document-schema.js";
|
|
123
123
|
import { FontFaceParseError, LAYOUT_FORMAT_VERSION, LayoutDocumentSchema, NOOP_DIAGNOSTIC_SINK, PdfEncryptedError, PdfParseError, createFontMeasurer, createFontRegistry, createStandardFontMeasurer, loadMathFont, pdfCodec, readFontFace as describeFontFace, readPdf, writePdf } from "pdf-codec";
|
|
124
124
|
import { readOdbForm, readOdbInventory, readOdbReport, resolveOdbComponent } from "odf.js";
|
|
125
|
-
export { AttributeSchema, BinaryPartSchema, COLOR_BLACK, CommentSchema, CompactPackageSchema, CompactPartSchema, CompactXmlNodeSchema, ContentBlockSchema, ContentCellValueSchema, ContentDocumentSchema, ContentDrawPageSchema, ContentImageBlockSchema, ContentPageBreakSchema, ContentParagraphSchema, ContentPathPointSchema, ContentPathSegmentSchema, ContentRunSchema, ContentSectionSchema, ContentShapeSchema, ContentSheetCellSchema, ContentSheetColumnSchema, ContentSheetPrintRangeSchema, ContentSheetPrintSettingsSchema, ContentSheetRepeatRangeSchema, ContentSheetRowSchema, ContentSheetSchema, ContentSlideSchema, ContentStrokeSchema, ContentSubpathSchema, ContentTableCellSchema, ContentTableRowSchema, ContentTableSchema, ContentVectorSchema, CsvBytesSchema, CsvInvalidUtf8Error, CsvParseError, CsvSheetNotFoundError, CsvSheetNotSpecifiedError, CsvUnsupportedDocumentKindError, DEFAULT_LAYOUT_FONT, DOCUMENT_FORMATS, DefinedNameSchema, DocumentFormatSchema, DocumentPackageSchema, DocxBytesSchema, DocxEditor, DocxParagraph, DocxRun, DocxTable, DocxTableCell, DocxTableRow, SUPPORTED_BACKUP_FORMAT_VERSION as FIREBIRD_SUPPORTED_BACKUP_FORMAT_VERSION, FirebirdBackupFormatError, FirebirdBackupParseError, FirebirdCompositeRecordUnsupportedError, FirebirdDataParseError, FirebirdSchemaParseError, FirebirdUnsupportedFieldTypeError, FontDeobfuscationError, FontFaceParseError, FootnoteSchema, HsqldbBinaryScriptParseError, HsqldbRowFormatError, HsqldbScriptParseError, HsqldbSqlEvaluationError, HsqldbSqlParseError, HsqldbSqlUnsupportedError, LATEX_DIAGNOSTIC_CODES, LAYOUT_FORMAT_VERSION, LayoutDocumentSchema, MATH_LINT_CODES, MarkdownBytesSchema,
|
|
125
|
+
export { AttributeSchema, BinaryPartSchema, COLOR_BLACK, CommentSchema, CompactPackageSchema, CompactPartSchema, CompactXmlNodeSchema, ContentBlockSchema, ContentCellValueSchema, ContentDocumentSchema, ContentDrawPageSchema, ContentImageBlockSchema, ContentPageBreakSchema, ContentParagraphSchema, ContentPathPointSchema, ContentPathSegmentSchema, ContentRunSchema, ContentSectionSchema, ContentShapeSchema, ContentSheetCellSchema, ContentSheetColumnSchema, ContentSheetPrintRangeSchema, ContentSheetPrintSettingsSchema, ContentSheetRepeatRangeSchema, ContentSheetRowSchema, ContentSheetSchema, ContentSlideSchema, ContentStrokeSchema, ContentSubpathSchema, ContentTableCellSchema, ContentTableRowSchema, ContentTableSchema, ContentVectorSchema, CsvBytesSchema, CsvInvalidUtf8Error, CsvParseError, CsvSheetNotFoundError, CsvSheetNotSpecifiedError, CsvUnsupportedDocumentKindError, DEFAULT_LAYOUT_FONT, DOCUMENT_FORMATS, DefinedNameSchema, DocumentFormatSchema, DocumentPackageSchema, DocxBytesSchema, DocxEditor, DocxParagraph, DocxRun, DocxTable, DocxTableCell, DocxTableRow, SUPPORTED_BACKUP_FORMAT_VERSION as FIREBIRD_SUPPORTED_BACKUP_FORMAT_VERSION, FirebirdBackupFormatError, FirebirdBackupParseError, FirebirdCompositeRecordUnsupportedError, FirebirdDataParseError, FirebirdSchemaParseError, FirebirdUnsupportedFieldTypeError, FontDeobfuscationError, FontFaceParseError, FootnoteSchema, HsqldbBinaryScriptParseError, HsqldbRowFormatError, HsqldbScriptParseError, HsqldbSqlEvaluationError, HsqldbSqlParseError, HsqldbSqlUnsupportedError, LATEX_DIAGNOSTIC_CODES, LAYOUT_FORMAT_VERSION, LayoutDocumentSchema, MATH_LINT_CODES, MarkdownBytesSchema, MarkdownEditor, MarkdownList, MarkdownParagraph, MarkdownRenderDiagnosticCodes, MarkdownRun, MarkdownTable, MarkdownTableCell, MarkdownTableRow, NOOP_DIAGNOSTIC_SINK, NumberingDefinitionSchema, NumberingLevelSchema, OdbNoEmbeddedDataSourceError, OdbReportDataSourceError, OdbReportNotSpecifiedError, OdbTableNotFoundError, OdbTableNotSpecifiedError, OdbUnsupportedFormatError, OdfEmbeddedFontError, OdgBoxVector, OdgBytesSchema, OdgEditor, OdgLineVector, OdgPage, OdgPathVector, OdmUnresolvedSectionError, OdpBytesSchema, OdpEditor, OdpShape, OdpSlide, OdsBytesSchema, OdsCell, OdsEditor, OdsSheet, OdtBytesSchema, OdtEditor, OdtList, OdtListItem, OdtParagraph, OdtRun, OdtTable, OdtTableCell, OdtTableRow, OoxmlEmbeddedFontError, PAGE_SIZE_A4, PAGE_SIZE_LETTER, PackageSchema, PartSchema, PdfBytesSchema, PdfEditor, PdfEllipseItem, PdfEncryptedError, PdfImageItem, PdfInternalLinkItem, PdfLineItem, PdfLinkItem, PdfPage, PdfParseError, PdfPathItem, PdfRectItem, PdfTextItem, PptxBytesSchema, PptxEditor, PptxShape, PptxSlide, PptxTable, PptxTableCell, PptxTableRow, RptFormulaEvaluationError, RptFormulaParseError, RptFormulaUnsupportedError, RptReportStructureError, SLIDE_SIZE_STANDARD, SLIDE_SIZE_WIDESCREEN, SVG_DIAGNOSTIC_CODES, SvgBytesSchema, SvgInvalidUtf8Error, SvgMissingRootElementError, SvgMultiPageNotSpecifiedError, SvgPageNotFoundError, SvgUnsupportedDocumentKindError, UnrecognizedDocumentSchemaError, UnsupportedFontSourceFormatError, UnsupportedPackageFormatError, XlsxBytesSchema, XmlCdataSchema, XmlCommentSchema, XmlDeclarationSchema, XmlElementSchema, XmlNodeSchema, XmlPartSchema, XmlPiSchema, XmlTextSchema, applyMathVariant, attr, base64ToBytes, buildCsvText, buildDocumentBytes, buildDocxPackage, buildDrawingBlock, buildFormulaBlock, buildMarkdownText, buildOdgPackage, buildOdpPackage, buildOdsPackage, buildOdtPackage, buildOfficeMath, buildOfficeMathParagraph, buildPptxPackage, buildSvgText, buildXlsxPackage, buildXml, bytesToBase64, cellReference, childrenWithTag, collectOfficeMathElements, columnIndexToLetters, columnLettersToIndex, compactCodec, compactPackageCodec, contentDocumentWithSchema, convertDocument, convertDrawingToLayout, convertPresentationToLayout, convertSpreadsheetToLayout, convertWordprocessingToLayout, createDocumentFontRegistry, createDocx, createFontMeasurer, createFontRegistry, createLocalDocumentConverter, createMarkdownEditor, createOdg, createOdp, createOds, createOdt, createPdf, createPptx, createStandardFontMeasurer, csvMarkdownCodec, csvPdfCodec, csvToMarkdown, csvToOds, csvToPdf, csvToXlsx, decodeCompactPackage, decodeCsvText, decodeDocumentPackage, decodeEntities, decodeHsqldbCachedTables, decodeMarkdownText, decodeOdbPackage, decodePackage, decodeSvgText, deobfuscateEmbeddedFont, deriveFontKey, describeFontFace, detectGridLattice, documentFromJson, documentPackageWithSchema, documentSchemaKindOf, docxPdfCodec, docxToMarkdown, docxToOdt, docxToPdf, docxToPptx, drawingOfBlock, elementChildren, elementLocalName, elementsWithTag, encodeCompactPackage, encodeCsvText, encodeDocumentPackage, encodeMarkdownText, encodePackage, encodeSvgText, evaluateRptBandOutsideData, evaluateSelect, extractOdfEmbeddedFonts, extractOoxmlEmbeddedFonts, extractSourceFonts, extractSourceFontsForFormat, firstChildByLocalName, fixedClock, flipY, formulaDocument, formulaOfBlock, formulaPlaceholderText, fromCompact, displayTextFor as hsqldbCellDisplayText, inferCellValue, inflateHsqldbCompressedScript, isCompactXmlNode, isContentBlock, isMathMlElement, isMathVariant, isXmlNode, latexToFormula, layoutDocumentFromPackage, layoutFormula, lintMathCoherence, loadMathFont, localName, looksLikeSfnt, lowerLatex, lowerMarkdownMath, mapMathVariant, markdownDocxCodec, markdownOdtCodec, markdownPdfCodec, markdownToCsv, markdownToDocx, markdownToOdt, markdownToPdf, markdownToXlsx, textContent as mathMlTextContent, odbReportCommandSql, odbReportGroupChain, odbReportToDocx, odbReportToOdt, odbReportToPdf, odbTablesToSpreadsheetDocument, odbToCsv, odbToXlsx, odfToPdf, odgPdfCodec, odgSvgCodec, odgToPdf, odgToSvg, odmToPdf, odpPdfCodec, odpPptxCodec, odpToOdt, odpToPdf, odpToPptx, odsCsvCodec, odsPdfCodec, odsToCsv, odsToPdf, odsToXlsx, odsXlsxCodec, odtDocxCodec, odtPdfCodec, odtToDocx, odtToMarkdown, odtToOdp, odtToPdf, openDocx, openMarkdown, openOdg, openOdp, openOds, openOdt, openPdf, openPptx, operatorProperties, packageCodec, parseCellReference, parseHsqldbBinaryScript, parseHsqldbScript, parsePackage, parseRangeReference, parseRptFormula, parseSelect, parseXml, pdfCodec, pdfToCsv, pdfToDocx, pdfToMarkdown, pdfToOdg, pdfToOdp, pdfToOds, pdfToOdt, pdfToPptx, pdfToSvg, pdfToXlsx, pptxPdfCodec, pptxToDocx, pptxToOdp, pptxToPdf, rangeReference, readCsvContent, readDocumentMetadata, readDocxContent, readDocxExtras, readFirebirdBackup, readMarkdownContent, readOdbForm, readOdbForms, readOdbInventory, readOdbReport, readOdbReportContent, readOdbReports, readOdbTables, readOdfEmbeddedFormula, readOdfFormulaContent, readOdgContent, readOdpContent, readOdsContent, readOdtContent, readOfficeMath, readPdf, readPptxContent, readSvgContent, readXlsxContent, reconstructDrawing, reconstructPresentation, reconstructSpreadsheet, reconstructWordprocessing, renderContentDocumentToMarkdown, renderOdbReportContent, resolveCompositionPlan, resolveMetadataTimestamps, resolveOdbComponent, resolveOdbReportRows, resolveRelationships, rgbHexToColor, rootElement, rptBandDefinition, rptDefinitionFromReport, runRptReport, schemaUriFor, serializePackage, setDocumentMetadata, svgPdfCodec, svgToOdg, svgToPdf, systemClock, textContent$1 as textContent, throwIfAborted, toCompact, tokenizeSql, unzipPackage, walk, writePdf, xlsxCsvCodec, xlsxMarkdownCodec, xlsxPdfCodec, xlsxToCsv, xlsxToMarkdown, xlsxToOds, xlsxToPdf, xmlCodec, zipPackage };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Color, ContentStrokeStyle, LayoutFont } from "document-schema.js";
|
|
2
|
-
import { LayoutEllipse, LayoutImage, LayoutImageAsset, LayoutItem, LayoutLine, LayoutLink, LayoutPath, LayoutRect, LayoutSubpath, LayoutText } from "pdf-codec";
|
|
2
|
+
import { LayoutEllipse, LayoutImage, LayoutImageAsset, LayoutInternalLink, LayoutItem, LayoutLine, LayoutLink, LayoutPath, LayoutRect, LayoutSubpath, LayoutText } from "pdf-codec";
|
|
3
3
|
//#region src/edit/pdf/item.d.ts
|
|
4
4
|
declare abstract class PdfItemBase<T extends LayoutItem> {
|
|
5
5
|
protected readonly container: LayoutItem[];
|
|
@@ -206,6 +206,20 @@ interface PdfLinkInit {
|
|
|
206
206
|
readonly heightPt: number;
|
|
207
207
|
}
|
|
208
208
|
declare function buildLinkItem(init: PdfLinkInit): LayoutLink;
|
|
209
|
+
declare class PdfInternalLinkItem extends PdfItemBase<LayoutInternalLink> {
|
|
210
|
+
readonly kind: "internalLink";
|
|
211
|
+
constructor(container: LayoutItem[], node: LayoutInternalLink);
|
|
212
|
+
get destination(): string;
|
|
213
|
+
set destination(value: string);
|
|
214
|
+
get xPt(): number;
|
|
215
|
+
set xPt(value: number);
|
|
216
|
+
get yPt(): number;
|
|
217
|
+
set yPt(value: number);
|
|
218
|
+
get widthPt(): number;
|
|
219
|
+
set widthPt(value: number);
|
|
220
|
+
get heightPt(): number;
|
|
221
|
+
set heightPt(value: number);
|
|
222
|
+
}
|
|
209
223
|
declare class PdfLinkItem extends PdfItemBase<LayoutLink> {
|
|
210
224
|
readonly kind: "link";
|
|
211
225
|
constructor(container: LayoutItem[], node: LayoutLink);
|
|
@@ -220,7 +234,7 @@ declare class PdfLinkItem extends PdfItemBase<LayoutLink> {
|
|
|
220
234
|
get heightPt(): number;
|
|
221
235
|
set heightPt(value: number);
|
|
222
236
|
}
|
|
223
|
-
type PdfItem = PdfTextItem | PdfImageItem | PdfRectItem | PdfEllipseItem | PdfLineItem | PdfPathItem | PdfLinkItem;
|
|
237
|
+
type PdfItem = PdfTextItem | PdfImageItem | PdfRectItem | PdfEllipseItem | PdfLineItem | PdfPathItem | PdfLinkItem | PdfInternalLinkItem;
|
|
224
238
|
declare function wrapItem(container: LayoutItem[], node: LayoutItem, images: Record<string, LayoutImageAsset>): PdfItem;
|
|
225
239
|
//#endregion
|
|
226
|
-
export {
|
|
240
|
+
export { buildTextItem as C, buildRectItem as S, buildEllipseItem as _, PdfInternalLinkItem as a, buildLinkItem as b, PdfLineItem as c, PdfPathInit as d, PdfPathItem as f, PdfTextItem as g, PdfTextInit as h, PdfImageItem as i, PdfLinkInit as l, PdfRectItem as m, PdfEllipseItem as n, PdfItem as o, PdfRectInit as p, PdfImageInit as r, PdfLineInit as s, PdfEllipseInit as t, PdfLinkItem as u, buildImageItem as v, wrapItem as w, buildPathItem as x, buildLineItem as y };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Color, ContentStrokeStyle, LayoutFont } from "document-schema.js";
|
|
2
|
-
import { LayoutEllipse, LayoutImage, LayoutImageAsset, LayoutItem, LayoutLine, LayoutLink, LayoutPath, LayoutRect, LayoutSubpath, LayoutText } from "pdf-codec";
|
|
2
|
+
import { LayoutEllipse, LayoutImage, LayoutImageAsset, LayoutInternalLink, LayoutItem, LayoutLine, LayoutLink, LayoutPath, LayoutRect, LayoutSubpath, LayoutText } from "pdf-codec";
|
|
3
3
|
//#region src/edit/pdf/item.d.ts
|
|
4
4
|
declare abstract class PdfItemBase<T extends LayoutItem> {
|
|
5
5
|
protected readonly container: LayoutItem[];
|
|
@@ -206,6 +206,20 @@ interface PdfLinkInit {
|
|
|
206
206
|
readonly heightPt: number;
|
|
207
207
|
}
|
|
208
208
|
declare function buildLinkItem(init: PdfLinkInit): LayoutLink;
|
|
209
|
+
declare class PdfInternalLinkItem extends PdfItemBase<LayoutInternalLink> {
|
|
210
|
+
readonly kind: "internalLink";
|
|
211
|
+
constructor(container: LayoutItem[], node: LayoutInternalLink);
|
|
212
|
+
get destination(): string;
|
|
213
|
+
set destination(value: string);
|
|
214
|
+
get xPt(): number;
|
|
215
|
+
set xPt(value: number);
|
|
216
|
+
get yPt(): number;
|
|
217
|
+
set yPt(value: number);
|
|
218
|
+
get widthPt(): number;
|
|
219
|
+
set widthPt(value: number);
|
|
220
|
+
get heightPt(): number;
|
|
221
|
+
set heightPt(value: number);
|
|
222
|
+
}
|
|
209
223
|
declare class PdfLinkItem extends PdfItemBase<LayoutLink> {
|
|
210
224
|
readonly kind: "link";
|
|
211
225
|
constructor(container: LayoutItem[], node: LayoutLink);
|
|
@@ -220,7 +234,7 @@ declare class PdfLinkItem extends PdfItemBase<LayoutLink> {
|
|
|
220
234
|
get heightPt(): number;
|
|
221
235
|
set heightPt(value: number);
|
|
222
236
|
}
|
|
223
|
-
type PdfItem = PdfTextItem | PdfImageItem | PdfRectItem | PdfEllipseItem | PdfLineItem | PdfPathItem | PdfLinkItem;
|
|
237
|
+
type PdfItem = PdfTextItem | PdfImageItem | PdfRectItem | PdfEllipseItem | PdfLineItem | PdfPathItem | PdfLinkItem | PdfInternalLinkItem;
|
|
224
238
|
declare function wrapItem(container: LayoutItem[], node: LayoutItem, images: Record<string, LayoutImageAsset>): PdfItem;
|
|
225
239
|
//#endregion
|
|
226
|
-
export {
|
|
240
|
+
export { buildTextItem as C, buildRectItem as S, buildEllipseItem as _, PdfInternalLinkItem as a, buildLinkItem as b, PdfLineItem as c, PdfPathInit as d, PdfPathItem as f, PdfTextItem as g, PdfTextInit as h, PdfImageItem as i, PdfLinkInit as l, PdfRectItem as m, PdfEllipseItem as n, PdfItem as o, PdfRectInit as p, PdfImageInit as r, PdfLineInit as s, PdfEllipseInit as t, PdfLinkItem as u, buildImageItem as v, wrapItem as w, buildPathItem as x, buildLineItem as y };
|
|
@@ -134,6 +134,7 @@ function estimateModalLineSpacing(lines) {
|
|
|
134
134
|
}
|
|
135
135
|
function reconstructWordprocessing(doc, options) {
|
|
136
136
|
const signal = options?.signal;
|
|
137
|
+
doc = dropHiddenLayerContent(doc);
|
|
137
138
|
const headingLevels = headingSizeLevels(doc);
|
|
138
139
|
const sections = [];
|
|
139
140
|
let currentGroup = [];
|
|
@@ -141,19 +142,33 @@ function reconstructWordprocessing(doc, options) {
|
|
|
141
142
|
for (const page of doc.pages) {
|
|
142
143
|
require_ports_abort.throwIfAborted(signal);
|
|
143
144
|
if (currentGroup.length > 0 && !samePageSize(currentGroup[0], page)) {
|
|
144
|
-
sections.push(buildSection(currentGroup, groupStartPageIndex, doc.images, headingLevels));
|
|
145
|
+
sections.push(buildSection(currentGroup, groupStartPageIndex, doc.images, headingLevels, doc.form));
|
|
145
146
|
groupStartPageIndex += currentGroup.length;
|
|
146
147
|
currentGroup = [];
|
|
147
148
|
}
|
|
148
149
|
currentGroup.push(page);
|
|
149
150
|
}
|
|
150
|
-
if (currentGroup.length > 0) sections.push(buildSection(currentGroup, groupStartPageIndex, doc.images, headingLevels));
|
|
151
|
+
if (currentGroup.length > 0) sections.push(buildSection(currentGroup, groupStartPageIndex, doc.images, headingLevels, doc.form));
|
|
151
152
|
return {
|
|
152
153
|
kind: "wordprocessing",
|
|
153
154
|
metadata: doc.metadata,
|
|
154
155
|
sections
|
|
155
156
|
};
|
|
156
157
|
}
|
|
158
|
+
function layerOf(item) {
|
|
159
|
+
return item.kind === "link" || item.kind === "internalLink" ? void 0 : item.layer;
|
|
160
|
+
}
|
|
161
|
+
function dropHiddenLayerContent(doc) {
|
|
162
|
+
const hidden = new Set((doc.layers ?? []).filter((layer) => layer.visible !== true).map((layer) => layer.name));
|
|
163
|
+
if (hidden.size === 0) return doc;
|
|
164
|
+
return {
|
|
165
|
+
...doc,
|
|
166
|
+
pages: doc.pages.map((page) => ({
|
|
167
|
+
...page,
|
|
168
|
+
items: page.items.filter((item) => layerOf(item) === void 0 || !hidden.has(layerOf(item)))
|
|
169
|
+
}))
|
|
170
|
+
};
|
|
171
|
+
}
|
|
157
172
|
const HEADING_MIN_SIZE_DELTA_PT = 2;
|
|
158
173
|
const MAX_HEADING_LEVEL = 6;
|
|
159
174
|
function headingSizeLevels(doc) {
|
|
@@ -178,11 +193,11 @@ function headingLevelOf(paragraph, levels) {
|
|
|
178
193
|
function samePageSize(a, b) {
|
|
179
194
|
return a.widthPt === b.widthPt && a.heightPt === b.heightPt;
|
|
180
195
|
}
|
|
181
|
-
function buildSection(pages, startPageIndex, images, headingLevels) {
|
|
196
|
+
function buildSection(pages, startPageIndex, images, headingLevels, form) {
|
|
182
197
|
const blocks = [];
|
|
183
198
|
pages.forEach((page, i) => {
|
|
184
199
|
if (i > 0) blocks.push({ kind: "pageBreak" });
|
|
185
|
-
blocks.push(...reconstructPageBlocks(page, startPageIndex + i, images, headingLevels));
|
|
200
|
+
blocks.push(...reconstructPageBlocks(page, startPageIndex + i, images, headingLevels, form));
|
|
186
201
|
});
|
|
187
202
|
return {
|
|
188
203
|
pageSize: {
|
|
@@ -193,7 +208,7 @@ function buildSection(pages, startPageIndex, images, headingLevels) {
|
|
|
193
208
|
blocks
|
|
194
209
|
};
|
|
195
210
|
}
|
|
196
|
-
function reconstructPageBlocks(page, pageIndex, images, headingLevels) {
|
|
211
|
+
function reconstructPageBlocks(page, pageIndex, images, headingLevels, form) {
|
|
197
212
|
const recoveredTable = recoverTable(page, pageIndex);
|
|
198
213
|
const consumedText = recoveredTable?.consumedText;
|
|
199
214
|
const textItems = page.items.filter((i) => i.kind === "text" && consumedText?.has(i) !== true);
|
|
@@ -236,7 +251,121 @@ function reconstructPageBlocks(page, pageIndex, images, headingLevels) {
|
|
|
236
251
|
block: recoveredVectors.block
|
|
237
252
|
});
|
|
238
253
|
positioned.sort((a, b) => b.yPt - a.yPt);
|
|
239
|
-
|
|
254
|
+
const blocks = positioned.map((p) => p.block);
|
|
255
|
+
reconcileLinks(blocks, page, pageIndex);
|
|
256
|
+
appendAnnotationConstructs(blocks, page, pageIndex);
|
|
257
|
+
appendFormFieldConstructs(blocks, form, pageIndex);
|
|
258
|
+
return blocks;
|
|
259
|
+
}
|
|
260
|
+
function framesIntersect(a, b) {
|
|
261
|
+
return a.xPt < b.xPt + b.widthPt && b.xPt < a.xPt + a.widthPt && a.yPt < b.yPt + b.heightPt && b.yPt < a.yPt + a.heightPt;
|
|
262
|
+
}
|
|
263
|
+
function intersectionArea(a, b) {
|
|
264
|
+
const width = Math.min(a.xPt + a.widthPt, b.xPt + b.widthPt) - Math.max(a.xPt, b.xPt);
|
|
265
|
+
const height = Math.min(a.yPt + a.heightPt, b.yPt + b.heightPt) - Math.max(a.yPt, b.yPt);
|
|
266
|
+
return width > 0 && height > 0 ? width * height : 0;
|
|
267
|
+
}
|
|
268
|
+
function reconcileLinks(blocks, page, pageIndex) {
|
|
269
|
+
for (const item of page.items) {
|
|
270
|
+
if (item.kind !== "link" && item.kind !== "internalLink") continue;
|
|
271
|
+
if (item.kind === "link") {
|
|
272
|
+
let matchedRun = false;
|
|
273
|
+
for (const block of blocks) {
|
|
274
|
+
if (block.kind !== "paragraph") continue;
|
|
275
|
+
for (const run of block.runs) if ((run.frames ?? []).some((frame) => frame.pageIndex === pageIndex && framesIntersect(item, frame))) {
|
|
276
|
+
run.hyperlink = item.uri;
|
|
277
|
+
matchedRun = true;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
if (matchedRun) continue;
|
|
281
|
+
}
|
|
282
|
+
wrapBestBlock(blocks, item, pageIndex, linkDescriptor(item));
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
function linkDescriptor(item) {
|
|
286
|
+
if (item.kind === "link") return {
|
|
287
|
+
kind: "link",
|
|
288
|
+
target: {
|
|
289
|
+
kind: "external",
|
|
290
|
+
uri: item.uri
|
|
291
|
+
},
|
|
292
|
+
...item.title !== void 0 ? { title: item.title } : {}
|
|
293
|
+
};
|
|
294
|
+
return {
|
|
295
|
+
kind: "link",
|
|
296
|
+
target: {
|
|
297
|
+
kind: "internal",
|
|
298
|
+
anchor: item.destination
|
|
299
|
+
},
|
|
300
|
+
...item.title !== void 0 ? { title: item.title } : {}
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
function blockFramesOn(block, pageIndex) {
|
|
304
|
+
return block.kind === "constructStart" || block.kind === "constructEnd" ? [] : (block.frames ?? []).filter((frame) => frame.pageIndex === pageIndex);
|
|
305
|
+
}
|
|
306
|
+
function wrapBestBlock(blocks, rect, pageIndex, descriptor) {
|
|
307
|
+
let bestIndex = -1;
|
|
308
|
+
let bestArea = 0;
|
|
309
|
+
blocks.forEach((block, index) => {
|
|
310
|
+
const area = blockFramesOn(block, pageIndex).reduce((sum, frame) => sum + intersectionArea(rect, frame), 0);
|
|
311
|
+
if (area > bestArea) {
|
|
312
|
+
bestArea = area;
|
|
313
|
+
bestIndex = index;
|
|
314
|
+
}
|
|
315
|
+
});
|
|
316
|
+
const start = {
|
|
317
|
+
kind: "constructStart",
|
|
318
|
+
descriptor
|
|
319
|
+
};
|
|
320
|
+
const end = { kind: "constructEnd" };
|
|
321
|
+
if (bestIndex >= 0) {
|
|
322
|
+
blocks.splice(bestIndex, 0, start);
|
|
323
|
+
blocks.splice(bestIndex + 2, 0, end);
|
|
324
|
+
} else blocks.push(start, end);
|
|
325
|
+
}
|
|
326
|
+
function appendAnnotationConstructs(blocks, page, pageIndex) {
|
|
327
|
+
(page.annotations ?? []).forEach((annotation, annotIndex) => {
|
|
328
|
+
const key = `pdf-annot-${String(pageIndex)}-${String(annotIndex)}`;
|
|
329
|
+
blocks.push({
|
|
330
|
+
kind: "constructStart",
|
|
331
|
+
descriptor: {
|
|
332
|
+
kind: "anchor",
|
|
333
|
+
anchorType: "comment",
|
|
334
|
+
name: key,
|
|
335
|
+
definition: key,
|
|
336
|
+
...annotation.source !== void 0 ? { source: annotation.source } : {}
|
|
337
|
+
}
|
|
338
|
+
}, { kind: "constructEnd" });
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
function controlTypeOf(field) {
|
|
342
|
+
if (field.fieldType === "text") return "plainText";
|
|
343
|
+
if (field.fieldType === "button") return "button";
|
|
344
|
+
if (field.fieldType === "combobox") return "comboBox";
|
|
345
|
+
if (field.fieldType === "listbox") return "dropDown";
|
|
346
|
+
return "checkbox";
|
|
347
|
+
}
|
|
348
|
+
function appendFormFieldConstructs(blocks, form, pageIndex) {
|
|
349
|
+
const visit = (fields) => {
|
|
350
|
+
for (const field of fields) {
|
|
351
|
+
visit(field.children);
|
|
352
|
+
if (field.fieldType === "group" || field.fieldType === "signature") continue;
|
|
353
|
+
for (const widget of field.widgets) {
|
|
354
|
+
if (widget.pageIndex !== pageIndex) continue;
|
|
355
|
+
wrapBestBlock(blocks, widget, pageIndex, {
|
|
356
|
+
kind: "contentControl",
|
|
357
|
+
controlType: controlTypeOf(field),
|
|
358
|
+
tag: field.name,
|
|
359
|
+
...field.alias !== void 0 ? { alias: field.alias } : {},
|
|
360
|
+
...field.readOnly === true ? { lock: "content" } : {},
|
|
361
|
+
...field.value !== void 0 ? { value: field.value } : {},
|
|
362
|
+
...field.checked !== void 0 ? { checked: field.checked } : {},
|
|
363
|
+
...field.options !== void 0 ? { options: [...field.options] } : {}
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
};
|
|
368
|
+
visit(form ?? []);
|
|
240
369
|
}
|
|
241
370
|
function clusterIntoParagraphs(lines) {
|
|
242
371
|
if (lines.length === 0) return [];
|
|
@@ -133,6 +133,7 @@ function estimateModalLineSpacing(lines) {
|
|
|
133
133
|
}
|
|
134
134
|
function reconstructWordprocessing(doc, options) {
|
|
135
135
|
const signal = options?.signal;
|
|
136
|
+
doc = dropHiddenLayerContent(doc);
|
|
136
137
|
const headingLevels = headingSizeLevels(doc);
|
|
137
138
|
const sections = [];
|
|
138
139
|
let currentGroup = [];
|
|
@@ -140,19 +141,33 @@ function reconstructWordprocessing(doc, options) {
|
|
|
140
141
|
for (const page of doc.pages) {
|
|
141
142
|
throwIfAborted(signal);
|
|
142
143
|
if (currentGroup.length > 0 && !samePageSize(currentGroup[0], page)) {
|
|
143
|
-
sections.push(buildSection(currentGroup, groupStartPageIndex, doc.images, headingLevels));
|
|
144
|
+
sections.push(buildSection(currentGroup, groupStartPageIndex, doc.images, headingLevels, doc.form));
|
|
144
145
|
groupStartPageIndex += currentGroup.length;
|
|
145
146
|
currentGroup = [];
|
|
146
147
|
}
|
|
147
148
|
currentGroup.push(page);
|
|
148
149
|
}
|
|
149
|
-
if (currentGroup.length > 0) sections.push(buildSection(currentGroup, groupStartPageIndex, doc.images, headingLevels));
|
|
150
|
+
if (currentGroup.length > 0) sections.push(buildSection(currentGroup, groupStartPageIndex, doc.images, headingLevels, doc.form));
|
|
150
151
|
return {
|
|
151
152
|
kind: "wordprocessing",
|
|
152
153
|
metadata: doc.metadata,
|
|
153
154
|
sections
|
|
154
155
|
};
|
|
155
156
|
}
|
|
157
|
+
function layerOf(item) {
|
|
158
|
+
return item.kind === "link" || item.kind === "internalLink" ? void 0 : item.layer;
|
|
159
|
+
}
|
|
160
|
+
function dropHiddenLayerContent(doc) {
|
|
161
|
+
const hidden = new Set((doc.layers ?? []).filter((layer) => layer.visible !== true).map((layer) => layer.name));
|
|
162
|
+
if (hidden.size === 0) return doc;
|
|
163
|
+
return {
|
|
164
|
+
...doc,
|
|
165
|
+
pages: doc.pages.map((page) => ({
|
|
166
|
+
...page,
|
|
167
|
+
items: page.items.filter((item) => layerOf(item) === void 0 || !hidden.has(layerOf(item)))
|
|
168
|
+
}))
|
|
169
|
+
};
|
|
170
|
+
}
|
|
156
171
|
const HEADING_MIN_SIZE_DELTA_PT = 2;
|
|
157
172
|
const MAX_HEADING_LEVEL = 6;
|
|
158
173
|
function headingSizeLevels(doc) {
|
|
@@ -177,11 +192,11 @@ function headingLevelOf(paragraph, levels) {
|
|
|
177
192
|
function samePageSize(a, b) {
|
|
178
193
|
return a.widthPt === b.widthPt && a.heightPt === b.heightPt;
|
|
179
194
|
}
|
|
180
|
-
function buildSection(pages, startPageIndex, images, headingLevels) {
|
|
195
|
+
function buildSection(pages, startPageIndex, images, headingLevels, form) {
|
|
181
196
|
const blocks = [];
|
|
182
197
|
pages.forEach((page, i) => {
|
|
183
198
|
if (i > 0) blocks.push({ kind: "pageBreak" });
|
|
184
|
-
blocks.push(...reconstructPageBlocks(page, startPageIndex + i, images, headingLevels));
|
|
199
|
+
blocks.push(...reconstructPageBlocks(page, startPageIndex + i, images, headingLevels, form));
|
|
185
200
|
});
|
|
186
201
|
return {
|
|
187
202
|
pageSize: {
|
|
@@ -192,7 +207,7 @@ function buildSection(pages, startPageIndex, images, headingLevels) {
|
|
|
192
207
|
blocks
|
|
193
208
|
};
|
|
194
209
|
}
|
|
195
|
-
function reconstructPageBlocks(page, pageIndex, images, headingLevels) {
|
|
210
|
+
function reconstructPageBlocks(page, pageIndex, images, headingLevels, form) {
|
|
196
211
|
const recoveredTable = recoverTable(page, pageIndex);
|
|
197
212
|
const consumedText = recoveredTable?.consumedText;
|
|
198
213
|
const textItems = page.items.filter((i) => i.kind === "text" && consumedText?.has(i) !== true);
|
|
@@ -235,7 +250,121 @@ function reconstructPageBlocks(page, pageIndex, images, headingLevels) {
|
|
|
235
250
|
block: recoveredVectors.block
|
|
236
251
|
});
|
|
237
252
|
positioned.sort((a, b) => b.yPt - a.yPt);
|
|
238
|
-
|
|
253
|
+
const blocks = positioned.map((p) => p.block);
|
|
254
|
+
reconcileLinks(blocks, page, pageIndex);
|
|
255
|
+
appendAnnotationConstructs(blocks, page, pageIndex);
|
|
256
|
+
appendFormFieldConstructs(blocks, form, pageIndex);
|
|
257
|
+
return blocks;
|
|
258
|
+
}
|
|
259
|
+
function framesIntersect(a, b) {
|
|
260
|
+
return a.xPt < b.xPt + b.widthPt && b.xPt < a.xPt + a.widthPt && a.yPt < b.yPt + b.heightPt && b.yPt < a.yPt + a.heightPt;
|
|
261
|
+
}
|
|
262
|
+
function intersectionArea(a, b) {
|
|
263
|
+
const width = Math.min(a.xPt + a.widthPt, b.xPt + b.widthPt) - Math.max(a.xPt, b.xPt);
|
|
264
|
+
const height = Math.min(a.yPt + a.heightPt, b.yPt + b.heightPt) - Math.max(a.yPt, b.yPt);
|
|
265
|
+
return width > 0 && height > 0 ? width * height : 0;
|
|
266
|
+
}
|
|
267
|
+
function reconcileLinks(blocks, page, pageIndex) {
|
|
268
|
+
for (const item of page.items) {
|
|
269
|
+
if (item.kind !== "link" && item.kind !== "internalLink") continue;
|
|
270
|
+
if (item.kind === "link") {
|
|
271
|
+
let matchedRun = false;
|
|
272
|
+
for (const block of blocks) {
|
|
273
|
+
if (block.kind !== "paragraph") continue;
|
|
274
|
+
for (const run of block.runs) if ((run.frames ?? []).some((frame) => frame.pageIndex === pageIndex && framesIntersect(item, frame))) {
|
|
275
|
+
run.hyperlink = item.uri;
|
|
276
|
+
matchedRun = true;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
if (matchedRun) continue;
|
|
280
|
+
}
|
|
281
|
+
wrapBestBlock(blocks, item, pageIndex, linkDescriptor(item));
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
function linkDescriptor(item) {
|
|
285
|
+
if (item.kind === "link") return {
|
|
286
|
+
kind: "link",
|
|
287
|
+
target: {
|
|
288
|
+
kind: "external",
|
|
289
|
+
uri: item.uri
|
|
290
|
+
},
|
|
291
|
+
...item.title !== void 0 ? { title: item.title } : {}
|
|
292
|
+
};
|
|
293
|
+
return {
|
|
294
|
+
kind: "link",
|
|
295
|
+
target: {
|
|
296
|
+
kind: "internal",
|
|
297
|
+
anchor: item.destination
|
|
298
|
+
},
|
|
299
|
+
...item.title !== void 0 ? { title: item.title } : {}
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
function blockFramesOn(block, pageIndex) {
|
|
303
|
+
return block.kind === "constructStart" || block.kind === "constructEnd" ? [] : (block.frames ?? []).filter((frame) => frame.pageIndex === pageIndex);
|
|
304
|
+
}
|
|
305
|
+
function wrapBestBlock(blocks, rect, pageIndex, descriptor) {
|
|
306
|
+
let bestIndex = -1;
|
|
307
|
+
let bestArea = 0;
|
|
308
|
+
blocks.forEach((block, index) => {
|
|
309
|
+
const area = blockFramesOn(block, pageIndex).reduce((sum, frame) => sum + intersectionArea(rect, frame), 0);
|
|
310
|
+
if (area > bestArea) {
|
|
311
|
+
bestArea = area;
|
|
312
|
+
bestIndex = index;
|
|
313
|
+
}
|
|
314
|
+
});
|
|
315
|
+
const start = {
|
|
316
|
+
kind: "constructStart",
|
|
317
|
+
descriptor
|
|
318
|
+
};
|
|
319
|
+
const end = { kind: "constructEnd" };
|
|
320
|
+
if (bestIndex >= 0) {
|
|
321
|
+
blocks.splice(bestIndex, 0, start);
|
|
322
|
+
blocks.splice(bestIndex + 2, 0, end);
|
|
323
|
+
} else blocks.push(start, end);
|
|
324
|
+
}
|
|
325
|
+
function appendAnnotationConstructs(blocks, page, pageIndex) {
|
|
326
|
+
(page.annotations ?? []).forEach((annotation, annotIndex) => {
|
|
327
|
+
const key = `pdf-annot-${String(pageIndex)}-${String(annotIndex)}`;
|
|
328
|
+
blocks.push({
|
|
329
|
+
kind: "constructStart",
|
|
330
|
+
descriptor: {
|
|
331
|
+
kind: "anchor",
|
|
332
|
+
anchorType: "comment",
|
|
333
|
+
name: key,
|
|
334
|
+
definition: key,
|
|
335
|
+
...annotation.source !== void 0 ? { source: annotation.source } : {}
|
|
336
|
+
}
|
|
337
|
+
}, { kind: "constructEnd" });
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
function controlTypeOf(field) {
|
|
341
|
+
if (field.fieldType === "text") return "plainText";
|
|
342
|
+
if (field.fieldType === "button") return "button";
|
|
343
|
+
if (field.fieldType === "combobox") return "comboBox";
|
|
344
|
+
if (field.fieldType === "listbox") return "dropDown";
|
|
345
|
+
return "checkbox";
|
|
346
|
+
}
|
|
347
|
+
function appendFormFieldConstructs(blocks, form, pageIndex) {
|
|
348
|
+
const visit = (fields) => {
|
|
349
|
+
for (const field of fields) {
|
|
350
|
+
visit(field.children);
|
|
351
|
+
if (field.fieldType === "group" || field.fieldType === "signature") continue;
|
|
352
|
+
for (const widget of field.widgets) {
|
|
353
|
+
if (widget.pageIndex !== pageIndex) continue;
|
|
354
|
+
wrapBestBlock(blocks, widget, pageIndex, {
|
|
355
|
+
kind: "contentControl",
|
|
356
|
+
controlType: controlTypeOf(field),
|
|
357
|
+
tag: field.name,
|
|
358
|
+
...field.alias !== void 0 ? { alias: field.alias } : {},
|
|
359
|
+
...field.readOnly === true ? { lock: "content" } : {},
|
|
360
|
+
...field.value !== void 0 ? { value: field.value } : {},
|
|
361
|
+
...field.checked !== void 0 ? { checked: field.checked } : {},
|
|
362
|
+
...field.options !== void 0 ? { options: [...field.options] } : {}
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
};
|
|
367
|
+
visit(form ?? []);
|
|
239
368
|
}
|
|
240
369
|
function clusterIntoParagraphs(lines) {
|
|
241
370
|
if (lines.length === 0) return [];
|
package/dist/markdown/math.cjs
CHANGED
|
@@ -3,7 +3,6 @@ const require_model_formula = require("../model/formula.cjs");
|
|
|
3
3
|
const require_latex_symbols = require("../latex/symbols.cjs");
|
|
4
4
|
const require_latex_lower = require("../latex/lower.cjs");
|
|
5
5
|
//#region src/markdown/math.ts
|
|
6
|
-
const MATH_BLOCK_STYLE_ID = "MathBlock";
|
|
7
6
|
const MATH_INLINE_FONT_MARKER = "Cambria Math";
|
|
8
7
|
const STAND_IN_FRAME = {
|
|
9
8
|
xPt: 0,
|
|
@@ -62,14 +61,13 @@ function lowerMarkdownMath(document, options) {
|
|
|
62
61
|
});
|
|
63
62
|
continue;
|
|
64
63
|
}
|
|
65
|
-
if (block.kind
|
|
66
|
-
|
|
64
|
+
if (block.kind === "embeddedObject" && block.objectKind === "formula" && block.document.kind === "formula" && block.document.formula.presentation !== void 0) {
|
|
65
|
+
const formulaBlock = lowerOne(block.document.formula.presentation.latex, MATH_BLOCK_SOURCE);
|
|
66
|
+
out.push(formulaBlock ?? block);
|
|
67
67
|
continue;
|
|
68
68
|
}
|
|
69
|
-
if (block.
|
|
70
|
-
|
|
71
|
-
const formulaBlock = lowerOne(latex, MATH_BLOCK_SOURCE);
|
|
72
|
-
out.push(formulaBlock ?? block);
|
|
69
|
+
if (block.kind !== "paragraph") {
|
|
70
|
+
out.push(block);
|
|
73
71
|
continue;
|
|
74
72
|
}
|
|
75
73
|
const extraction = extractInlineMath(block.runs);
|