Repository navigation
Conversation
Add Sdcb.SimdPaddleOCR.Pdf library that turns page images plus OCR results into searchable, copyable dual-layer PDFs: - PaddleOcrPdfWriter: minimal PDF 1.4 writer (pages, xref, trailer) embedding the original image per page with a transparent text layer positioned from OCR line/character boxes; works with any stream. - PdfTextAlignment: CTC-based character box estimation plus padding emission filtering, so text layer placement follows the image. - PdfImage: SkiaSharp decode into BGRA pixels for the OCR pipeline. - Example SkiaSharp.SearchablePdf: folder of images -> one multi-page PDF or one PDF per image (--separate) with per-stage timing, CPU/memory sampling and JSON/CSV benchmark reports. - Tests: 14 tests covering writer structure, text layer, alignment filtering and round-trip text extraction. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
功能说明
新增 Sdcb.SimdPaddleOCR.Pdf 库与 SkiaSharp.SearchablePdf 示例,把页面图片 + OCR 结果生成为可搜索、可复制的双层 PDF:
PaddleOcrPdfWriter:轻量 PDF 1.4 写入器(页对象、xref、trailer),每页嵌入原始图片 + 依 OCR 行/字符框定位的透明文本层,支持任意 Stream 输出。PdfTextAlignment:基于 CTC 的字符框估计与 padding emission 过滤,文本层与图像对齐。PdfImage:SkiaSharp 解码为 BGRA,供 OCR 流水线使用。SkiaSharp.SearchablePdf:目录图片 -> 单个多页 PDF 或每图一个 PDF(--separate),含分阶段计时、CPU/内存采样与 JSON/CSV 基准报告。使用示例
验证
test/Sdcb.SimdPaddleOCR.Pdf.Tests:14 个测试全部通过(写入器结构、文本层、对齐过滤、round-trip 文本提取)。文档
🤖 由 Copilot 生成