edgeparse 0.1.0__tar.gz → 0.1.1__tar.gz
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.
- {edgeparse-0.1.0 → edgeparse-0.1.1}/Cargo.lock +4 -4
- {edgeparse-0.1.0 → edgeparse-0.1.1}/Cargo.toml +2 -2
- {edgeparse-0.1.0 → edgeparse-0.1.1}/PKG-INFO +5 -5
- {edgeparse-0.1.0 → edgeparse-0.1.1}/README.md +1 -1
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/api/config_loader.rs +4 -1
- edgeparse-0.1.1/crates/edgeparse-core/src/hybrid.rs +4 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/lib.rs +29 -10
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/models/bbox.rs +1 -7
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/models/text.rs +3 -4
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/output/docx.rs +1 -3
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/output/html.rs +5 -1
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/output/json.rs +4 -1
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/output/legacy_json.rs +49 -39
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/output/markdown.rs +315 -155
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/output/toc_builder.rs +2 -8
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/pdf/annotation_enrichment.rs +15 -8
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/pdf/annotation_extractor.rs +1 -1
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/pdf/chunk_parser.rs +16 -34
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/pdf/encryption.rs +39 -36
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/pdf/font.rs +166 -83
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/pdf/graphics_state.rs +6 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/pdf/hyperlink_extractor.rs +1 -1
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/pdf/image_extractor.rs +19 -32
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/pdf/line_extractor.rs +36 -40
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/pdf/loader.rs +4 -6
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/pdf/metadata_writer.rs +10 -6
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/pdf/page_info.rs +10 -13
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/pdf/raster_table_ocr.rs +53 -25
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/pdf/text_extractor.rs +35 -34
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/pipeline/error_recovery.rs +5 -6
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/pipeline/logging.rs +5 -4
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/pipeline/orchestrator.rs +170 -52
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/pipeline/parallel.rs +1 -4
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/pipeline/stages/boxed_heading_promoter.rs +8 -5
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/pipeline/stages/caption_linker.rs +18 -8
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/pipeline/stages/cluster_table_detector.rs +668 -205
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/pipeline/stages/column_detector.rs +17 -10
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/pipeline/stages/content_filter.rs +1 -5
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/pipeline/stages/footnote_linker.rs +18 -23
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/pipeline/stages/header_footer.rs +18 -24
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/pipeline/stages/heading_detector.rs +216 -99
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/pipeline/stages/list_detector.rs +25 -17
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/pipeline/stages/list_pass2.rs +60 -42
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/pipeline/stages/nesting_level.rs +8 -6
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/pipeline/stages/output_builder.rs +4 -4
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/pipeline/stages/paragraph_detector.rs +71 -13
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/pipeline/stages/table_content_assigner.rs +36 -11
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/pipeline/stages/table_detector.rs +195 -93
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/pipeline/stages/text_block_grouper.rs +100 -40
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/pipeline/stages/text_line_grouper.rs +39 -14
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/pipeline/stages/toc_detector.rs +52 -40
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/pipeline/stages/watermark_detector.rs +29 -8
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/tagged/struct_tree.rs +19 -15
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/utils/diff.rs +27 -7
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/utils/font_metrics_cache.rs +47 -17
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/utils/image_dedup.rs +1 -1
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/utils/language_detector.rs +122 -31
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/utils/layout_analysis.rs +6 -6
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/utils/sanitizer.rs +7 -7
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/utils/text_normalizer.rs +13 -12
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/utils/xref_index.rs +7 -13
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/utils/xycut.rs +69 -23
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-python/src/lib.rs +10 -14
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/Cargo.toml +1 -1
- {edgeparse-0.1.0 → edgeparse-0.1.1}/pyproject.toml +3 -3
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/Cargo.toml +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/README.md +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/api/batch.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/api/config.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/api/filter.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/api/mod.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/models/chunks.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/models/content.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/models/document.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/models/enums.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/models/list.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/models/mod.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/models/semantic.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/models/table.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/output/csv.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/output/mod.rs +1 -1
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/output/text.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/pdf/bookmark_extractor.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/pdf/data/glyphlist.txt +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/pdf/form_extractor.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/pdf/mod.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/pipeline/mod.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/pipeline/stages/content_sanitizer.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/pipeline/stages/cross_page_linker.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/pipeline/stages/figure_detector.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/pipeline/stages/footnote_detector.rs +2 -2
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/pipeline/stages/id_assignment.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/pipeline/stages/mod.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/pipeline/stages/reading_order.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/tagged/mod.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/tagged/processor.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/utils/mod.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/utils/page_range.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/src/utils/statistics.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/tests/integration_tests.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-core/tests/perf_benchmarks.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/edgeparse-python/Cargo.toml +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/.cargo_vcs_info.json +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/.chglog/CHANGELOG.tpl.md +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/.chglog/config.yml +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/.editorconfig +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/.gitattributes +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/.github/workflows/ci.yml +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/.gitignore +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/.vscode/launch.json +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/.vscode/settings.json +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/CHANGELOG.md +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/Cargo.lock +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/LICENSE +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/README.md +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/assets/pdf_icon.jpg +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/assets/supported_color_type/L16.png +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/assets/supported_color_type/L8.jpg +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/assets/supported_color_type/La16.png +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/assets/supported_color_type/La8.png +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/assets/supported_color_type/Rgb16.png +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/assets/supported_color_type/Rgb8.jpg +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/assets/supported_color_type/Rgba16.png +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/assets/supported_color_type/Rgba8.png +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/benches/datetime.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/benches/parse.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/examples/add_barcode.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/examples/analyze_object_streams.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/examples/analyze_page_contents.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/examples/analyze_pdf.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/examples/analyze_references.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/examples/check_raw_objstream.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/examples/compress_existing_pdf.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/examples/create.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/examples/create_text_heavy_pdf.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/examples/debug_compression_detailed.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/examples/debug_compression_full.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/examples/debug_object_stream.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/examples/debug_save_with_objstreams.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/examples/decrypt.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/examples/encrypt.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/examples/extract_text.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/examples/extract_toc.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/examples/final_compression_test.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/examples/inspect_object_stream.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/examples/merge.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/examples/object_streams.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/examples/print_annotations.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/examples/replace_partial_text.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/examples/rotate.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/examples/test_better_compression.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/examples/test_decryption.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/examples/test_direct_objstream.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/examples/test_filter_roundtrip.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/examples/test_metadata.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/examples/test_object_stream_creation.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/examples/test_object_stream_roundtrip.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/examples/test_real_pdf_compression_with_fix.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/examples/test_structural_compression.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/examples/verify_decryption.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/examples/verify_page_compression.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/examples/verify_pdf.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/examples/verify_trailer_compression_fix.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/rustfmt.toml +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/src/bookmarks.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/src/cmap_section.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/src/common_data_structures/mod.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/src/content.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/src/creator.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/src/datetime.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/src/destinations.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/src/document.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/src/encodings/cmap.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/src/encodings/glyphnames.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/src/encodings/mappings.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/src/encodings/mod.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/src/encryption/algorithms.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/src/encryption/crypt_filters.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/src/encryption/pkcs5.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/src/encryption/rc4.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/src/encryption.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/src/error.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/src/filters/mod.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/src/filters/png.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/src/font.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/src/incremental_document.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/src/lib.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/src/object.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/src/object_stream.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/src/outlines.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/src/parser/cmap_parser.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/src/parser/mod.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/src/parser_aux.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/src/processor.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/src/reader.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/src/save_options.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/src/toc.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/src/writer.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/src/xobject.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/src/xref.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/tests/annotation.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/tests/catalog_compression_integration_test.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/tests/decryption.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/tests/extract_test.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/tests/font_test.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/tests/incremental_document.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/tests/metadata_test.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/tests/modify.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/tests/object_stream_comprehensive_test.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/tests/object_stream_edge_cases_test.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/tests/object_stream_methods_test.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/tests/object_stream_performance_test.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/tests/resources/fonts/Montserrat-Regular.ttf +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/tests/simple_object_stream_test.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/tests/trailer_reference_compression_test.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/tests/unicode.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/crates/pdf-cos/tests/utils.rs +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/edgeparse/__init__.py +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/edgeparse/_types.py +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/edgeparse/cli.py +0 -0
- {edgeparse-0.1.0 → edgeparse-0.1.1}/edgeparse/py.typed +0 -0
|
@@ -608,7 +608,7 @@ dependencies = [
|
|
|
608
608
|
|
|
609
609
|
[[package]]
|
|
610
610
|
name = "edgeparse-cli"
|
|
611
|
-
version = "0.1.
|
|
611
|
+
version = "0.1.1"
|
|
612
612
|
dependencies = [
|
|
613
613
|
"anyhow",
|
|
614
614
|
"clap",
|
|
@@ -622,7 +622,7 @@ dependencies = [
|
|
|
622
622
|
|
|
623
623
|
[[package]]
|
|
624
624
|
name = "edgeparse-core"
|
|
625
|
-
version = "0.1.
|
|
625
|
+
version = "0.1.1"
|
|
626
626
|
dependencies = [
|
|
627
627
|
"anyhow",
|
|
628
628
|
"base64",
|
|
@@ -646,7 +646,7 @@ dependencies = [
|
|
|
646
646
|
|
|
647
647
|
[[package]]
|
|
648
648
|
name = "edgeparse-node"
|
|
649
|
-
version = "0.1.
|
|
649
|
+
version = "0.1.1"
|
|
650
650
|
dependencies = [
|
|
651
651
|
"edgeparse-core",
|
|
652
652
|
"napi",
|
|
@@ -658,7 +658,7 @@ dependencies = [
|
|
|
658
658
|
|
|
659
659
|
[[package]]
|
|
660
660
|
name = "edgeparse-python"
|
|
661
|
-
version = "0.1.
|
|
661
|
+
version = "0.1.1"
|
|
662
662
|
dependencies = [
|
|
663
663
|
"edgeparse-core",
|
|
664
664
|
"pyo3",
|
|
@@ -3,11 +3,11 @@ resolver = "2"
|
|
|
3
3
|
members = ["crates/edgeparse-core", "crates/pdf-cos", "crates/edgeparse-python"]
|
|
4
4
|
|
|
5
5
|
[workspace.package]
|
|
6
|
-
version = "0.1.
|
|
6
|
+
version = "0.1.1"
|
|
7
7
|
edition = "2021"
|
|
8
8
|
rust-version = "1.85"
|
|
9
9
|
license = "Apache-2.0"
|
|
10
|
-
repository = "https://github.com/
|
|
10
|
+
repository = "https://github.com/raphaelmansuy/edgeparse"
|
|
11
11
|
description = "EdgeParse — High-performance PDF-to-structured-data extraction engine"
|
|
12
12
|
|
|
13
13
|
[workspace.dependencies]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: edgeparse
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.1
|
|
4
4
|
Classifier: Development Status :: 4 - Beta
|
|
5
5
|
Classifier: Intended Audience :: Developers
|
|
6
6
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
@@ -17,9 +17,9 @@ Summary: High-performance PDF-to-structured-data extraction — Rust engine, Pyt
|
|
|
17
17
|
Keywords: pdf,extraction,markdown,rag,llm
|
|
18
18
|
Requires-Python: >=3.9
|
|
19
19
|
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
20
|
-
Project-URL: Documentation, https://
|
|
21
|
-
Project-URL: Homepage, https://github.com/
|
|
22
|
-
Project-URL: Repository, https://github.com/
|
|
20
|
+
Project-URL: Documentation, https://github.com/raphaelmansuy/edgeparse/tree/main/docs
|
|
21
|
+
Project-URL: Homepage, https://github.com/raphaelmansuy/edgeparse
|
|
22
|
+
Project-URL: Repository, https://github.com/raphaelmansuy/edgeparse
|
|
23
23
|
|
|
24
24
|
# edgeparse
|
|
25
25
|
|
|
@@ -68,5 +68,5 @@ edgeparse /path/to/dir/ --output-dir out/ # batch convert
|
|
|
68
68
|
|
|
69
69
|
- [GitHub](https://github.com/raphaelmansuy/edgeparse)
|
|
70
70
|
- [crates.io (Rust)](https://crates.io/crates/edgeparse-core)
|
|
71
|
-
- [npm (
|
|
71
|
+
- [npm (edgeparse)](https://www.npmjs.com/package/edgeparse)
|
|
72
72
|
|
|
@@ -45,4 +45,4 @@ edgeparse /path/to/dir/ --output-dir out/ # batch convert
|
|
|
45
45
|
|
|
46
46
|
- [GitHub](https://github.com/raphaelmansuy/edgeparse)
|
|
47
47
|
- [crates.io (Rust)](https://crates.io/crates/edgeparse-core)
|
|
48
|
-
- [npm (
|
|
48
|
+
- [npm (edgeparse)](https://www.npmjs.com/package/edgeparse)
|
|
@@ -39,7 +39,10 @@ pub fn config_to_json(config: &ProcessingConfig) -> Result<String, EdgePdfError>
|
|
|
39
39
|
///
|
|
40
40
|
/// This works by serializing both to JSON, merging the JSON objects, and
|
|
41
41
|
/// deserializing back. Fields in `overlay` that are `null` are skipped.
|
|
42
|
-
pub fn merge_configs(
|
|
42
|
+
pub fn merge_configs(
|
|
43
|
+
base: &ProcessingConfig,
|
|
44
|
+
overlay_json: &str,
|
|
45
|
+
) -> Result<ProcessingConfig, EdgePdfError> {
|
|
43
46
|
let base_json = serde_json::to_value(base)
|
|
44
47
|
.map_err(|e| EdgePdfError::OutputError(format!("config serialization error: {}", e)))?;
|
|
45
48
|
let overlay_val: serde_json::Value = serde_json::from_str(overlay_json)
|
|
@@ -54,7 +54,10 @@ pub fn convert(
|
|
|
54
54
|
for (&page_num, &page_id) in &pages_map {
|
|
55
55
|
let page_chunks = extract_page_chunks(&raw_doc.document, page_num, page_id)?;
|
|
56
56
|
let mut recovered_tables = Vec::new();
|
|
57
|
-
if let Some(page_info) = page_info_list
|
|
57
|
+
if let Some(page_info) = page_info_list
|
|
58
|
+
.iter()
|
|
59
|
+
.find(|info| info.page_number == page_num)
|
|
60
|
+
{
|
|
58
61
|
recovered_tables = recover_raster_table_borders(
|
|
59
62
|
input_path,
|
|
60
63
|
&page_info.crop_box,
|
|
@@ -87,16 +90,19 @@ pub fn convert(
|
|
|
87
90
|
.into_iter()
|
|
88
91
|
.map(ContentElement::LineArt),
|
|
89
92
|
);
|
|
90
|
-
elements.extend(
|
|
93
|
+
elements.extend(
|
|
94
|
+
recovered_tables
|
|
95
|
+
.into_iter()
|
|
96
|
+
.map(ContentElement::TableBorder),
|
|
97
|
+
);
|
|
91
98
|
|
|
92
99
|
page_contents.push(elements);
|
|
93
100
|
}
|
|
94
101
|
|
|
95
102
|
// Run the processing pipeline
|
|
96
103
|
let mcid_map = build_mcid_map(&raw_doc.document);
|
|
97
|
-
let mut pipeline_state =
|
|
98
|
-
|
|
99
|
-
.with_page_info(page_info_list);
|
|
104
|
+
let mut pipeline_state = PipelineState::with_mcid_map(page_contents, config.clone(), mcid_map)
|
|
105
|
+
.with_page_info(page_info_list);
|
|
100
106
|
run_pipeline(&mut pipeline_state)?;
|
|
101
107
|
|
|
102
108
|
// Build the output document
|
|
@@ -163,7 +169,10 @@ impl From<lopdf::Error> for EdgePdfError {
|
|
|
163
169
|
#[cfg(test)]
|
|
164
170
|
mod tests {
|
|
165
171
|
use super::*;
|
|
166
|
-
use lopdf::{
|
|
172
|
+
use lopdf::{
|
|
173
|
+
content::{Content, Operation},
|
|
174
|
+
dictionary, Object, Stream,
|
|
175
|
+
};
|
|
167
176
|
use std::io::Write;
|
|
168
177
|
|
|
169
178
|
/// Create a synthetic PDF file for integration testing.
|
|
@@ -238,7 +247,10 @@ mod tests {
|
|
|
238
247
|
|
|
239
248
|
let doc = result.unwrap();
|
|
240
249
|
assert_eq!(doc.number_of_pages, 1);
|
|
241
|
-
assert!(
|
|
250
|
+
assert!(
|
|
251
|
+
!doc.kids.is_empty(),
|
|
252
|
+
"Expected content elements in document"
|
|
253
|
+
);
|
|
242
254
|
|
|
243
255
|
// Check that we extracted content (may be TextChunks, TextLines, or TextBlocks after pipeline)
|
|
244
256
|
let mut all_text = String::new();
|
|
@@ -268,11 +280,18 @@ mod tests {
|
|
|
268
280
|
}
|
|
269
281
|
}
|
|
270
282
|
|
|
271
|
-
assert!(
|
|
272
|
-
|
|
283
|
+
assert!(
|
|
284
|
+
all_text.contains("Hello"),
|
|
285
|
+
"Expected 'Hello' in extracted text, got: {}",
|
|
286
|
+
all_text
|
|
287
|
+
);
|
|
288
|
+
assert!(
|
|
289
|
+
all_text.contains("Second"),
|
|
290
|
+
"Expected 'Second' in extracted text, got: {}",
|
|
291
|
+
all_text
|
|
292
|
+
);
|
|
273
293
|
|
|
274
294
|
// Cleanup
|
|
275
295
|
let _ = std::fs::remove_file(&pdf_path);
|
|
276
296
|
}
|
|
277
|
-
|
|
278
297
|
}
|
|
@@ -46,13 +46,7 @@ impl PartialEq for BoundingBox {
|
|
|
46
46
|
|
|
47
47
|
impl BoundingBox {
|
|
48
48
|
/// Create a new BoundingBox.
|
|
49
|
-
pub fn new(
|
|
50
|
-
page: Option<u32>,
|
|
51
|
-
left_x: f64,
|
|
52
|
-
bottom_y: f64,
|
|
53
|
-
right_x: f64,
|
|
54
|
-
top_y: f64,
|
|
55
|
-
) -> Self {
|
|
49
|
+
pub fn new(page: Option<u32>, left_x: f64, bottom_y: f64, right_x: f64, top_y: f64) -> Self {
|
|
56
50
|
Self {
|
|
57
51
|
page_number: page,
|
|
58
52
|
last_page_number: page,
|
|
@@ -147,8 +147,7 @@ impl TextLine {
|
|
|
147
147
|
};
|
|
148
148
|
|
|
149
149
|
let mut result = String::with_capacity(
|
|
150
|
-
real_chunks.iter().map(|c| c.value.len()).sum::<usize>()
|
|
151
|
-
+ real_chunks.len(),
|
|
150
|
+
real_chunks.iter().map(|c| c.value.len()).sum::<usize>() + real_chunks.len(),
|
|
152
151
|
);
|
|
153
152
|
result.push_str(&real_chunks[0].value);
|
|
154
153
|
|
|
@@ -306,9 +305,9 @@ impl TextBlock {
|
|
|
306
305
|
if result.ends_with('-') {
|
|
307
306
|
// Check it's a real hyphenation (lowercase letter before hyphen)
|
|
308
307
|
let before_hyphen = result[..result.len() - 1].chars().last();
|
|
309
|
-
if before_hyphen.
|
|
308
|
+
if before_hyphen.is_some_and(|c| c.is_alphabetic()) {
|
|
310
309
|
result.pop(); // Remove the hyphen
|
|
311
|
-
|
|
310
|
+
// Don't add a space — the word continues
|
|
312
311
|
} else {
|
|
313
312
|
result.push(' ');
|
|
314
313
|
}
|
|
@@ -116,9 +116,7 @@ fn token_rows_text(rows: &[TableTokenRow]) -> String {
|
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
fn make_paragraph(text: &str) -> String {
|
|
119
|
-
format!(
|
|
120
|
-
"<w:p><w:r><w:t xml:space=\"preserve\">{text}</w:t></w:r></w:p>\n"
|
|
121
|
-
)
|
|
119
|
+
format!("<w:p><w:r><w:t xml:space=\"preserve\">{text}</w:t></w:r></w:p>\n")
|
|
122
120
|
}
|
|
123
121
|
|
|
124
122
|
fn make_heading(text: &str, level: u32) -> String {
|
|
@@ -62,7 +62,11 @@ fn render_element(out: &mut String, element: &ContentElement) {
|
|
|
62
62
|
for item in &list.list_items {
|
|
63
63
|
let label = token_rows_text(&item.label.content);
|
|
64
64
|
let body = token_rows_text(&item.body.content);
|
|
65
|
-
out.push_str(&format!(
|
|
65
|
+
out.push_str(&format!(
|
|
66
|
+
"<li>{}{}</li>\n",
|
|
67
|
+
html_escape(label.trim()),
|
|
68
|
+
html_escape(body.trim())
|
|
69
|
+
));
|
|
66
70
|
}
|
|
67
71
|
out.push_str("</ul>\n");
|
|
68
72
|
}
|
|
@@ -7,7 +7,10 @@ use crate::EdgePdfError;
|
|
|
7
7
|
///
|
|
8
8
|
/// # Errors
|
|
9
9
|
/// Returns `EdgePdfError::OutputError` if serialization fails.
|
|
10
|
-
pub fn write_json<W: std::io::Write>(
|
|
10
|
+
pub fn write_json<W: std::io::Write>(
|
|
11
|
+
doc: &PdfDocument,
|
|
12
|
+
writer: &mut W,
|
|
13
|
+
) -> Result<(), EdgePdfError> {
|
|
11
14
|
serde_json::to_writer_pretty(writer, doc)
|
|
12
15
|
.map_err(|e| EdgePdfError::OutputError(format!("JSON serialization failed: {}", e)))
|
|
13
16
|
}
|
|
@@ -9,9 +9,8 @@
|
|
|
9
9
|
|
|
10
10
|
use std::cell::Cell;
|
|
11
11
|
|
|
12
|
-
use serde_json::{Map, Value
|
|
12
|
+
use serde_json::{json, Map, Value};
|
|
13
13
|
|
|
14
|
-
use crate::EdgePdfError;
|
|
15
14
|
use crate::models::bbox::BoundingBox;
|
|
16
15
|
use crate::models::chunks::ImageChunk;
|
|
17
16
|
use crate::models::content::ContentElement;
|
|
@@ -23,13 +22,14 @@ use crate::models::semantic::{
|
|
|
23
22
|
SemanticNumberHeading, SemanticParagraph, SemanticTable, SemanticTextNode,
|
|
24
23
|
};
|
|
25
24
|
use crate::models::table::{TableBorder, TableBorderCell, TableBorderRow, TableToken};
|
|
25
|
+
use crate::EdgePdfError;
|
|
26
26
|
|
|
27
27
|
// ---------------------------------------------------------------------------
|
|
28
28
|
// Thread-local ID counter
|
|
29
29
|
// ---------------------------------------------------------------------------
|
|
30
30
|
|
|
31
31
|
thread_local! {
|
|
32
|
-
static NEXT_ID: Cell<u64> = Cell::new(1);
|
|
32
|
+
static NEXT_ID: Cell<u64> = const { Cell::new(1) };
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
fn next_id() -> u64 {
|
|
@@ -76,10 +76,7 @@ fn legacy_float_str(v: f64) -> String {
|
|
|
76
76
|
fn text_color_string(color: &Option<Vec<f64>>) -> String {
|
|
77
77
|
match color {
|
|
78
78
|
Some(components) if !components.is_empty() => {
|
|
79
|
-
let parts: Vec<String> = components
|
|
80
|
-
.iter()
|
|
81
|
-
.map(|v| legacy_float_str(*v))
|
|
82
|
-
.collect();
|
|
79
|
+
let parts: Vec<String> = components.iter().map(|v| legacy_float_str(*v)).collect();
|
|
83
80
|
format!("[{}]", parts.join(", "))
|
|
84
81
|
}
|
|
85
82
|
_ => String::new(),
|
|
@@ -144,7 +141,7 @@ fn text_node_style(node: &SemanticTextNode) -> (String, f64, String) {
|
|
|
144
141
|
.unwrap_or("")
|
|
145
142
|
.to_string(),
|
|
146
143
|
font_size.unwrap_or(0.0),
|
|
147
|
-
text_color_string(
|
|
144
|
+
text_color_string(text_color),
|
|
148
145
|
)
|
|
149
146
|
}
|
|
150
147
|
|
|
@@ -152,11 +149,7 @@ fn text_node_style(node: &SemanticTextNode) -> (String, f64, String) {
|
|
|
152
149
|
/// First tries semantic contents (preferred), then falls back to raw body tokens.
|
|
153
150
|
fn list_item_text(item: &ListItem) -> String {
|
|
154
151
|
if !item.contents.is_empty() {
|
|
155
|
-
let parts: Vec<String> = item
|
|
156
|
-
.contents
|
|
157
|
-
.iter()
|
|
158
|
-
.filter_map(element_text_str)
|
|
159
|
-
.collect();
|
|
152
|
+
let parts: Vec<String> = item.contents.iter().filter_map(element_text_str).collect();
|
|
160
153
|
if !parts.is_empty() {
|
|
161
154
|
return parts.join(" ").trim().to_string();
|
|
162
155
|
}
|
|
@@ -187,15 +180,27 @@ fn element_text_str(el: &ContentElement) -> Option<String> {
|
|
|
187
180
|
// Raw text elements from list_detector and early pipeline stages
|
|
188
181
|
ContentElement::TextLine(l) => {
|
|
189
182
|
let s = l.value().trim().to_string();
|
|
190
|
-
if s.is_empty() {
|
|
183
|
+
if s.is_empty() {
|
|
184
|
+
None
|
|
185
|
+
} else {
|
|
186
|
+
Some(s)
|
|
187
|
+
}
|
|
191
188
|
}
|
|
192
189
|
ContentElement::TextBlock(b) => {
|
|
193
190
|
let s = b.value().trim().to_string();
|
|
194
|
-
if s.is_empty() {
|
|
191
|
+
if s.is_empty() {
|
|
192
|
+
None
|
|
193
|
+
} else {
|
|
194
|
+
Some(s)
|
|
195
|
+
}
|
|
195
196
|
}
|
|
196
197
|
ContentElement::TextChunk(c) => {
|
|
197
198
|
let s = c.value.trim().to_string();
|
|
198
|
-
if s.is_empty() {
|
|
199
|
+
if s.is_empty() {
|
|
200
|
+
None
|
|
201
|
+
} else {
|
|
202
|
+
Some(s)
|
|
203
|
+
}
|
|
199
204
|
}
|
|
200
205
|
_ => None,
|
|
201
206
|
}
|
|
@@ -210,12 +215,7 @@ fn list_item_style(item: &ListItem) -> (String, f64, String) {
|
|
|
210
215
|
}
|
|
211
216
|
}
|
|
212
217
|
// Try body tokens first chunk
|
|
213
|
-
let first_chunk = item
|
|
214
|
-
.body
|
|
215
|
-
.content
|
|
216
|
-
.iter()
|
|
217
|
-
.flat_map(|row| row.iter())
|
|
218
|
-
.next();
|
|
218
|
+
let first_chunk = item.body.content.iter().flat_map(|row| row.iter()).next();
|
|
219
219
|
if let Some(token) = first_chunk {
|
|
220
220
|
let color_str = format_font_color(&token.base.font_color);
|
|
221
221
|
return (
|
|
@@ -245,7 +245,9 @@ fn element_style(el: &ContentElement) -> Option<(String, f64, String)> {
|
|
|
245
245
|
}
|
|
246
246
|
}
|
|
247
247
|
ContentElement::TextBlock(b) => {
|
|
248
|
-
if let Some(chunk) = b
|
|
248
|
+
if let Some(chunk) = b
|
|
249
|
+
.text_lines
|
|
250
|
+
.iter()
|
|
249
251
|
.flat_map(|l| l.text_chunks.iter())
|
|
250
252
|
.find(|c| !c.value.trim().is_empty())
|
|
251
253
|
{
|
|
@@ -497,10 +499,7 @@ fn list_to_legacy(list: &PDFList, stem: &str, img_idx: &mut u64) -> Value {
|
|
|
497
499
|
obj.insert("level".into(), json!(level));
|
|
498
500
|
obj.insert("page number".into(), json!(page_num(&list.bbox)));
|
|
499
501
|
obj.insert("bounding box".into(), bbox_array(&list.bbox));
|
|
500
|
-
obj.insert(
|
|
501
|
-
"numbering style".into(),
|
|
502
|
-
json!(numbering),
|
|
503
|
-
);
|
|
502
|
+
obj.insert("numbering style".into(), json!(numbering));
|
|
504
503
|
obj.insert("number of list items".into(), json!(num_items));
|
|
505
504
|
obj.insert("next list id".into(), json!(next_list_id_val));
|
|
506
505
|
obj.insert("previous list id".into(), json!(prev_list_id_val));
|
|
@@ -672,8 +671,12 @@ fn elements_to_legacy(el: &ContentElement, stem: &str, img_idx: &mut u64) -> Vec
|
|
|
672
671
|
ContentElement::Figure(fig) => figure_to_legacy(fig, stem, img_idx),
|
|
673
672
|
ContentElement::Image(img) => vec![image_to_legacy(img, stem, img_idx)],
|
|
674
673
|
ContentElement::List(l) => vec![list_to_legacy(l, stem, img_idx)],
|
|
675
|
-
ContentElement::Table(st) => semantic_table_to_legacy(st, stem, img_idx)
|
|
676
|
-
|
|
674
|
+
ContentElement::Table(st) => semantic_table_to_legacy(st, stem, img_idx)
|
|
675
|
+
.into_iter()
|
|
676
|
+
.collect(),
|
|
677
|
+
ContentElement::TableBorder(tb) => table_border_to_legacy(tb, stem, img_idx)
|
|
678
|
+
.into_iter()
|
|
679
|
+
.collect(),
|
|
677
680
|
// Skip raw low-level elements not exposed in legacy output
|
|
678
681
|
ContentElement::TextChunk(_)
|
|
679
682
|
| ContentElement::TextLine(_)
|
|
@@ -705,10 +708,7 @@ pub fn to_legacy_json_value(doc: &PdfDocument, stem: &str) -> Value {
|
|
|
705
708
|
|
|
706
709
|
let mut obj = Map::new();
|
|
707
710
|
obj.insert("file name".into(), json!(doc.file_name));
|
|
708
|
-
obj.insert(
|
|
709
|
-
"number of pages".into(),
|
|
710
|
-
json!(doc.number_of_pages),
|
|
711
|
-
);
|
|
711
|
+
obj.insert("number of pages".into(), json!(doc.number_of_pages));
|
|
712
712
|
obj.insert(
|
|
713
713
|
"author".into(),
|
|
714
714
|
doc.author.as_deref().map_or(Value::Null, |s| json!(s)),
|
|
@@ -719,11 +719,15 @@ pub fn to_legacy_json_value(doc: &PdfDocument, stem: &str) -> Value {
|
|
|
719
719
|
);
|
|
720
720
|
obj.insert(
|
|
721
721
|
"creation date".into(),
|
|
722
|
-
doc.creation_date
|
|
722
|
+
doc.creation_date
|
|
723
|
+
.as_deref()
|
|
724
|
+
.map_or(Value::Null, |s| json!(s)),
|
|
723
725
|
);
|
|
724
726
|
obj.insert(
|
|
725
727
|
"modification date".into(),
|
|
726
|
-
doc.modification_date
|
|
728
|
+
doc.modification_date
|
|
729
|
+
.as_deref()
|
|
730
|
+
.map_or(Value::Null, |s| json!(s)),
|
|
727
731
|
);
|
|
728
732
|
obj.insert("kids".into(), json!(kids));
|
|
729
733
|
|
|
@@ -748,18 +752,18 @@ pub fn to_legacy_json_string(doc: &PdfDocument, stem: &str) -> Result<String, Ed
|
|
|
748
752
|
mod tests {
|
|
749
753
|
use super::*;
|
|
750
754
|
use crate::models::bbox::BoundingBox;
|
|
755
|
+
use crate::models::enums::SemanticType;
|
|
751
756
|
use crate::models::semantic::{SemanticParagraph, SemanticTextNode};
|
|
752
757
|
use crate::models::text::TextColumn;
|
|
753
|
-
use crate::models::enums::SemanticType;
|
|
754
758
|
|
|
755
759
|
fn make_bbox(page: u32, left: f64, bottom: f64, right: f64, top: f64) -> BoundingBox {
|
|
756
760
|
BoundingBox::new(Some(page), left, bottom, right, top)
|
|
757
761
|
}
|
|
758
762
|
|
|
759
763
|
fn make_text_node(bbox: BoundingBox, text: &str) -> SemanticTextNode {
|
|
760
|
-
use crate::models::text::{TextBlock, TextLine};
|
|
761
764
|
use crate::models::chunks::TextChunk;
|
|
762
765
|
use crate::models::enums::{PdfLayer, TextFormat, TextType};
|
|
766
|
+
use crate::models::text::{TextBlock, TextLine};
|
|
763
767
|
let chunk = TextChunk {
|
|
764
768
|
value: text.to_string(),
|
|
765
769
|
bbox: bbox.clone(),
|
|
@@ -869,8 +873,14 @@ mod tests {
|
|
|
869
873
|
|
|
870
874
|
#[test]
|
|
871
875
|
fn test_text_color_grayscale() {
|
|
872
|
-
assert_eq!(
|
|
873
|
-
|
|
876
|
+
assert_eq!(
|
|
877
|
+
text_color_string(&Some(vec![0.0, 0.0, 0.0])),
|
|
878
|
+
"[0.0, 0.0, 0.0]"
|
|
879
|
+
);
|
|
880
|
+
assert_eq!(
|
|
881
|
+
text_color_string(&Some(vec![1.0, 1.0, 1.0])),
|
|
882
|
+
"[1.0, 1.0, 1.0]"
|
|
883
|
+
);
|
|
874
884
|
assert_eq!(text_color_string(&None), "");
|
|
875
885
|
}
|
|
876
886
|
|