离线 · 无上传 · 浏览器本地完成Offline · no uploads · runs in the browser
CSV 转 WebP——离线、表格按 A4 分页出图CSV to WebP offline — the table as A4 pages
这条链是**三步**,中间真的有一份 PDF:`csv>html` + `html>pdf` + `pdf>webp`(路径基线现读)。第一步只出一张表格——SheetJS 的 `sheet_to_html` 把行与格写成 HTML 标记,**只有内容与结构**:列宽、字号、底色、边框样式都不在里面(读取根本没要单元格样式),公式也是文件里存下的值,不会被重算。第二步由浏览器把这份 HTML 排在 **800 px 版心**里、按 **A4** 逐页渲染,每页作为 **PNG 无损切片**写进 PDF;第三步由 pdf.js 把每页画到白底画布上,`encodeCanvas` 编成 WebP——所以**整条链只量化一次**,质量与目标尺寸这些旋钮只作用在最后那一步。要如实说清的代价有三条,都跟「表格比版心宽/长」有关:一,**宽度没有闸**,超出内容区的右侧列会被裁掉而不是换行,宽表请先拆列;二,**高度有闸**,排版超过 32768 px 时渲染那一步明确报 `errors.renderTooTall`(CSV→PDF 用的是同一道闸),所以超长表要分批;三,这条链的中间 PDF 因为同一道高度闸**排不到几百页**,出图那一步的页数上限在这里其实碰不到,别把它当成长表的保险。产物是图片:格子里的字选不中、不能被程序读回,要交付数据本身请走 CSV→JSON / TXT 那几页。全程只有 storage 权限,不联网。This chain is **three steps** with a real PDF inside: `csv>html` + `html>pdf` + `pdf>webp`, read live from the baseline. Step one emits a single table — SheetJS’s `sheet_to_html` writes rows and cells as markup carrying **content and structure only**: column widths, font sizes, fills and borders are not in it (the reader never asks for cell styles), and formulas are the stored values, never re-evaluated. Step two lets the browser set that HTML into the **800 px measure**, paginate it on **A4** and write each page into the PDF as a **lossless PNG slice**; step three has pdf.js draw every page onto a white canvas and `encodeCanvas` it into WebP — so **the chain quantises exactly once**, and quality or target-size knobs act only on that last step. Three costs must be stated, all about tables being wider or longer than the page. First, **nothing gates width**: columns running past the content box are clipped, not wrapped, so split a wide table first. Second, height is gated: past 32768 px of laid-out page the render step fails with `errors.renderTooTall` (CSV to PDF shares that gate), so a very long table needs splitting. Third, because the same ceiling keeps the intermediate PDF far from hundreds of pages, the image step’s page cap is unreachable here — it is not a safety net for long tables. And the artifact is a picture: cell values cannot be selected or read back by a program, so deliver the data through CSV to JSON or TXT instead. All of it on the storage permission, with no network.
这条链路怎么走How the route runs
CSVCSV HTMLHTML PDFPDF WebPWebP
共 3 步,由扩展的路径搜索自动选出,中间产物不落盘。3 steps, chosen by the extension's own path search; intermediate results never touch the disk.
会保留什么What carries over
- 内容与结构都在:行列、单元格顺序与文字按表格原样进标记再进图Content and structure survive: rows, cells and their order go from the table into markup and from there into the image
- 整条链只量化一次:中间是 PNG 无损切片,质量与目标尺寸只作用在 WebP 终点One quantisation on the whole chain: the middle is lossless PNG slices, quality and target size act only on the WebP endpoint
- 按 A4 逐页出图,一页一张 WebP;多页打包成 ZIP,条目按页顺序命名Paginated on A4, one WebP per page; several pages arrive as a ZIP numbered in page order
- 背景固定白底:表格图不谈透明,边界也不会带半透明残留A fixed white ground: a table picture has no alpha story and keeps no translucent leftovers
- 一批最多 200 个文件、单个 100 MB,与其他路线共用同一道闸门Up to 200 files per batch and 100 MB each — the same gate every other route shares
如实说明的限制What it does not do
- 宽度没有闸:超出约 800 px 版心的右侧列被裁掉而不是换行,宽表请先拆列Nothing gates width: columns past the roughly 800 px measure are clipped, not wrapped — split a wide table first
- 高度有闸:排版超过 32768 px 时明确报 `errors.renderTooTall`,超长表要分批(CSV→PDF 同一道闸)Height is gated: past 32768 px of laid-out page it fails with `errors.renderTooTall`, so long tables need splitting (CSV to PDF carries the same ceiling)
- 呈现层不进中间那份 HTML:列宽、字号、底色、边框都按渲染默认样式重画The presentation layer never enters the intermediate HTML: widths, sizes, fills and borders are redrawn with renderer defaults
- 产物是图片:格子里的字选不中、也不能被程序读回,要数据请走 CSV→JSON / TXTThe artifact is a picture: cell values cannot be selected or read back by a program — take CSV to JSON or TXT for data
- 没有选页这一步:分页来自排版,页码选择只在源是 PDF 时存在There is no page-range step: pagination comes from layout, and the range control exists only when the source is a PDF
实操提示Working with it
- 要一份多页文档:CSV→PDF,中间那份 PDF 就是终点、切片无损For a multi-page document: CSV to PDF, where the intermediate PDF becomes the destination
- 要一页一张且最通用:CSV→JPG 是同一条三步链,终点换成 JPEGFor one page per image with maximum reach: CSV to JPG is the same chain ending in JPEG
- 要交付数据:CSV→JSON 或 TXT,那里是值而不是画面To deliver data: CSV to JSON or TXT, which hand over values rather than a picture
常见问题Questions people actually ask
我的表有 30 列,转出来右边没了?My table has 30 columns and the right side disappeared?
这是这条链的实际行为:中间那份 HTML 排在约 800 px 版心里,宽度方向没有任何检查,超出的列被裁掉而不是折到下一行。要么先把表拆成两组列,要么改用 CSV→HTML 自己在浏览器里横向滚动,要么走 CSV→PDF 再在阅读器里缩放。That is how this chain behaves: the intermediate HTML is set into a roughly 800 px measure, nothing checks the width, and the overflowing columns are clipped rather than pushed to a second line. Split the columns into two groups, use CSV to HTML and scroll sideways in a browser, or take CSV to PDF and zoom in a reader.
为什么图里的数字在 Excel 里算不了?Why can’t Excel compute with the numbers in the image?
因为产物是位图:格子里的字被画成像素,没有可寻址的单元格。要能继续算,就得交付数据本身——CSV→JSON 或 CSV→TXT 走的是同一份 HTML 之前的值,不经这些渲染步骤。Because the artifact is a bitmap: the cell text is painted, with no addressable cells. To keep computing, deliver data instead — CSV to JSON or TXT works from the values before any of these rendering steps.
长表会不会被切成几百页?Will a long table be sliced into hundreds of pages?
不会走到那一步:排版高度超过 32768 px 时,渲染那一环就会明确报错要求拆短,所以中间那份 PDF 实际排不到几百页——出图那一步的页数上限在这条链上碰不到,别把它当保险。正确做法是分批转换或改交付形式。It never gets that far: past 32768 px of laid-out height the render step fails and asks you to split, so the intermediate PDF cannot actually grow to hundreds of pages — the image step’s page ceiling is unreachable on this chain and should not be treated as a safety net. Split the run, or change what you deliver.
不需要账号,也不需要联网:装好扩展后点图标,在新标签页里打开工作台,文件从磁盘直接选。No account and no network: install the extension, click its icon, and the workbench opens in a new tab reading straight off your disk.
从 Chrome 应用商店安装Install from the Chrome Web Store 安装步骤Install steps GitHub 源码Source on GitHub
要把它压到指定体积?Need it under a target size? The 图片压缩工具image compressor可以在浏览器里重编码 PNG / JPEG / WebP。 re-encodes PNG / JPEG / WebP in the browser.