文件格式任意转换助手Transfer Any File

离线 · 无上传 · 浏览器本地完成Offline · no uploads · runs in the browser

TXT 转 PNG——离线、整页截图、不经 PDFTXT to PNG offline — a full-page render, no PDF

这条链值得先讲清它**没有**经过什么:`txt>html` + `html>png`,两步到图片(路径基线现读)。同一族的 Word→JPG、Excel→JPG、TXT→JPG 都多一步「先做一份 PDF、再从 PDF 出图」,而这一条直接把网页交给渲染器——所以它在 TXT 这一族里是唯一不套 PDF 的形状,产出是一张连续的长图,而不是一页一页的纸张。第二步用的是工作台同一套渲染路径:把 HTML 净化后离屏排到 `RENDER_WIDTH = 800` 的宽度,按整页高度决定 `pixelRatio`(整页越高取档越低,避免画布超出上限),再画进画布编成 PNG。因此几件事成立:一,**空白、缩进与换行按源文件的样子保留**(等宽 `<pre>` 排版,不做折行美化);二,PNG 无损,颜色与字符边缘不会被再量化一次;三,长内容有硬上限——整页高度超过 `MAX_CAPTURE_HEIGHT`(32768 px)时明确报「文档长度超出浏览器单次渲染上限」,让你拆短分批,而不是给你一张被静默截断的图。要说清的代价:产出是**图片**,里面的文字选不中、搜不到、也不能被屏幕阅读器读——要能被复制请留在 TXT / Markdown / HTML,要一份多页文档请走 TXT→PDF;图里的长行会按版心排版,宽表格会被换行。全程只有 storage 权限,不联网,也不上传。Start with what this chain does **not** go through: `txt>html` + `html>png` — two steps to an image, read live from the route baseline. Its whole family (Word to JPG, Excel to JPG, TXT to JPG) adds a «make a PDF first, then image it» step, while this one hands the page straight to the renderer. That makes it the only TXT exit **without a PDF inside**, producing one continuous tall image rather than a stack of paper. The second step is the same render path the workbench uses: sanitise the HTML, lay it out off-screen at `RENDER_WIDTH = 800`, choose a `pixelRatio` from the full page height (taller pages take a lower tier so the canvas stays within limits), then paint it into a canvas and encode a PNG. Three things follow. Whitespace, indentation and line breaks stay exactly as the source wrote them — a monospace `<pre>` layout with no prettified wrapping. PNG is lossless, so colours and glyph edges are not quantised again. And long content has a hard ceiling: past `MAX_CAPTURE_HEIGHT` (32768 px) the route fails with «the document is longer than the browser can render in one pass» and asks you to split it, instead of returning a silently cropped picture. The cost to say out loud: the output is **an image** — its words cannot be selected, searched or read by a screen reader. Stay in TXT, Markdown or HTML when text must be copied, and take TXT to PDF for a paginated document. Long lines wrap at the page’s measure, so wide tables reflow. All of it on the storage permission: no network, no upload.

一批转换结果卡片,含文件名、体积与下载入口
一次混合批量,一个 ZIP 下载One mixed batch, one ZIP download

这条链路怎么走How the route runs

纯文本 (TXT)plain text (TXT) HTMLHTML PNGPNG

共 2 步,由扩展的路径搜索自动选出,中间产物不落盘。2 steps, chosen by the extension's own path search; intermediate results never touch the disk.

会保留什么What carries over

  • 不套 PDF:两步到图片,产出是一张连续长图,不是一页一页的纸No PDF inside: two steps to an image, one continuous tall picture rather than a stack of pages
  • 空白与换行按源文件保留:等宽 `<pre>` 排版,不做折行美化Whitespace and line breaks follow the source file — a monospace `<pre>` layout with no prettified wrapping
  • PNG 无损:颜色与字符边缘不被再量化一次;渲染宽度固定 800,像素密度按整页高度取PNG is lossless: colours and glyph edges are not quantised again, at a fixed 800 render width with density chosen from the full page height
  • 过长明确报错而不是静默截断:整页高度超过 32768 px 时提示拆短分批Over-long input fails clearly instead of arriving silently cropped: past 32768 px of height you are asked to split it
  • 一批最多 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

  • 产物是图片:里面的文字选不中、搜不到,屏幕阅读器也读不出来The output is an image: its words cannot be selected, searched or read aloud by a screen reader
  • 整页高度有上限(32768 px):超长文档会被要求分批,不会给你一张截断图One page height ceiling (32768 px): an over-long document is asked to be split rather than returned cropped
  • 版心固定 800 且 `<pre>` 不折行:它在版心里只剩 702 px 文字区(扣掉 body 64、边框 2、内边距 32),又是 `overflow-x: auto`,超出的行尾不换行也不会被画进图里,请先自己拆短行A fixed 800 measure and `<pre>` never wraps: it keeps a 702 px text band (the body’s 64, its own 2 of border and 32 of padding come off) and is `overflow-x: auto`, so lines past that are neither reflowed nor painted — break them yourself first
  • 不加语法高亮、不折行美化、不改缩进:排版就是等宽 `<pre>` 的那一套No syntax highlighting, no wrapped-line prettifying, no re-indenting: the layout is the monospace `<pre>` one
  • TXT→PDF 用的是同一个渲染器、同一道高度上限:超长同样会报错,请先拆短;要能被复制的文字,留在 TXT / Markdown / HTMLTXT to PDF uses the same renderer and the same height ceiling, so over-long text fails there too — split it; for copyable text stay in TXT, Markdown or HTML

实操提示Working with it

  • 要一份多页文档:TXT→PDF,同一份网页按 A4 切片,但同样受单次渲染高度上限约束For a paginated document: TXT to PDF, which builds the same page first and slices it onto A4
  • 要 JPEG / WebP:TXT→JPG 与 TXT→WebP 都多一步 PDF,且终点是有损编码For JPEG or WebP: TXT to JPG and TXT to WebP each add a PDF step and end on a lossy encode
  • 要能被到处复制的文字:TXT→Markdown 或 TXT→HTML,那两条产出仍是文本For text that stays copyable: TXT to Markdown or HTML, which still produce text

常见问题Questions people actually ask

为什么这张 PNG 和 Word 转出来的图长得不一样?Why does this PNG look different from the Word one?

因为中间形态不同。TXT→PNG 直接把整页排到 800 宽的画布上,得到一张连续长图;以 JPG / WebP 收尾的那几条(Word→JPG、Excel→JPG、TXT→JPG 都在内)会先按 A4 排成多页、写成一份 PDF,再逐页出图,所以产出是一页一张;各家转 PNG 都是本页这种两步路,同样是一张连续长图。同一份文字走两条路,分页与尺寸都会不一样。Because the intermediate shape differs. TXT to PNG lays the whole page onto an 800-wide canvas and returns one continuous image; the routes ending in JPG or WebP (Word to JPG, Excel to JPG, TXT to JPG among them) first paginate onto A4, write a PDF, then image it page by page — so they come out one sheet per image. Same text, different pagination and proportions.

很长的日志文件转出来会被截断吗?Will a very long log file get cut off?

不会静默截断。整页高度超过浏览器单次渲染的上限(32768 px)时,这条路会明确报「文档长度超出上限,请拆短分批」,你拿到的是提示而不是半张图。TXT→PDF 用的是同一个渲染器、同一道高度上限,所以超长在那里同样会报错。Nothing is cropped silently. Past the browser’s single-render ceiling (32768 px of page height) the route fails with «longer than the browser can render in one pass — split it», so you get a message instead of half a picture. TXT to PDF uses the same renderer and the same ceiling, so over-long content fails there too.

图里的文字能复制吗?Can I copy the text out of the image?

不能——PNG 里没有文字层,字符是被画出来的像素。要能被复制、搜索或朗读,就留在文本类产出(TXT / Markdown / HTML);这条路的目的是把一段文字变成一张可以贴进只有图片栏位的东西里的图。No — a PNG has no text layer; the characters are painted pixels. When words must be copied, searched or read aloud, stay with a text output (TXT, Markdown, HTML). The point of this route is turning a block of text into a picture that fits where only an image is accepted.

不需要账号,也不需要联网:装好扩展后点图标,在新标签页里打开工作台,文件从磁盘直接选。No account and no network: install the extension, click its icon, and the workbench opens in a new tab reading straight off your disk.