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

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

TXT 转 PDF——等宽原样排版,本地离线TXT to PDF offline — spacing kept as written

日志、合同草稿、带表格对齐的纯文本笔记,用 Word 打开一次就被重排一次;要交出去的往往是一份「打印出来跟屏幕上一样」的 PDF。这条链路是 TXT → HTML → PDF:整篇文本被转义后放进一个 `<pre>` 块(换行写成 `<br>`),于是空格对齐、代码缩进、表格列宽都按文件里的样子排;再把整页渲染成画布,按 A4 切成若干页。它保的是**排版的形状**,代价是产出的 PDF 没有文字层。A log, a draft contract, or notes aligned with spaces get re-flowed the moment a word processor opens them, while what has to be handed over is something that prints the way it looks on screen. This route is TXT → HTML → PDF: the whole file is escaped into a single `<pre>` block (newlines written as `<br>`), so space alignment, code indentation and column widths keep the shape they have in the file; that page is then rendered and cut into A4 pages. What it preserves is the layout, and the price is a PDF with no text layer.

工作台里已载入的多个文件,每行带自己的格式标签
批量:多种源格式,一个目标格式Batch: mixed source formats, one target

这条链路怎么走How the route runs

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

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

会保留什么What carries over

  • 等宽呈现与空白:整篇进 `<pre>`,行首缩进、列对齐、ASCII 表格都按文件里的字符位置排Monospace and whitespace: the file lands in a `<pre>`, so leading indentation, column alignment and ASCII tables sit where the characters put them
  • 换行照文件走,不做「智能折行」——每一行在 PDF 里还是那一行(超出页面宽度的部分见限制那栏)Line breaks are the file’s own — nothing is re-wrapped “intelligently”, so a line stays a line (what happens past the page width is in the limits)
  • 编码不是前提:按 UTF-8 → GB18030 → GBK 依次严格解码,老编辑器导出的 GBK 文本也读得进来The encoding is not a precondition: input is decoded UTF-8 → GB18030 → GBK, so a GBK file from an older editor still reads
  • 整页按 A4 的宽高比切成多页,长文件往下翻页而不是被截断The rendered page is cut at the A4 aspect ratio, so a long file continues onto further pages instead of being truncated

如实说明的限制What it does not do

  • 产出的 PDF 是渲染出来的图像,没有文字层:不能选中、搜索不到,也不能复制进别处——要能选字的交付物,这份给不了The PDF is a rendered image with no text layer: nothing can be selected or searched, and none of it copies out — a selectable deliverable is not what this route produces
  • 版面宽度固定 800 px,不随内容变宽:一行比这更长时,靠右侧的那几个字符进不了画面The surface stays 800 px wide regardless of content, so the right-hand characters of a longer line never reach the picture
  • 分页按固定高度切,不保证把一行整个留在同一页;跨页的那一行会上下各留一半Pages are cut at a fixed height, so a line can straddle the break and end up split across two pages
  • 四种编码都解不出文本时直接报错,不产出一份乱码 PDF;解出的是「像文本」的字节(比如全是 CJK 的 UTF-16 被按 GB18030 蒙对)另有控制字符闸门拦着If none of the four encodings yields text, it fails rather than producing a PDF of mojibake; a control-character gate also rejects bytes that only look like text
  • 超过约 4000 CSS px 高的整页按 1 倍采样(更矮的用 1.5 或 2 倍),所以一份很长的日志会比一份短文件糊一档——这是画布上限换来的取舍,不报错A page taller than about 4000 CSS px is captured at 1× sampling (shorter ones at 1.5× or 2×), so a very long log comes out one notch softer than a short file — a trade for the canvas ceiling, not an error
  • 整页高度超过 32768 px 会明确报错而不是给你一张截半的文件Page height past 32768 px is an explicit error, not a silently truncated picture

实操提示Working with it

  • 一批最多 200 个文件,单个文件上限 100 MB;多个 .txt 一起转逐个产出各自的 .pdf,想一次拿走就打成一个 ZIPUp to 200 files per batch and 100 MB per file; several .txt files yield one .pdf each, and the set can be taken as a single ZIP
  • 要的是「能选字的 PDF」就别走这条:目前这条路交的是排版形状。只想把文本变成可再编辑的标记语言,走 TXT 转 Markdown 或 TXT 转 HTMLIf selectable text in the PDF is the requirement, this is not the route — it delivers layout. To make the text editable markup instead, take TXT to Markdown or TXT to HTML

常见问题Questions people actually ask

为什么 PDF 里的字选不中?Why can’t I select the text in the PDF?

因为这条链路把整页渲染成图像再铺到 A4 上——这正是它能锁住空格对齐的原因。要一份能选中、可搜索的 PDF,需要的是把字形写成文本对象的那类工具,本扩展全部在浏览器里画,交的是渲染结果。Because the route renders the page to an image and lays that on A4 — which is exactly why the space alignment holds. A selectable, searchable PDF needs a tool that writes glyphs as text objects; everything here is drawn in the browser and delivers the rendered result.

我的日志一行有 300 个字符,会被折行吗?My log lines are 300 characters wide — will they wrap?

不会折,也不会缩排:版面宽度固定在 800 px,超出一行的部分留在画面之外,所以那种文件建议先按列切窄一点(或转成 CSV / Excel 再看)。这是「不重排」这个主张的另一面——它既不替你断行,也不替你挤字。It neither wraps nor squeezes: the surface is fixed at 800 px, so what hangs past it stays out of the picture. For that kind of file, narrow the columns first (or take the CSV / Excel route and look there). It is the other face of «no re-flowing» — the route will not break your lines or compress your glyphs for you.

服务器日志要转 PDF,文件会离开本机吗?If I turn a server log into a PDF, does the file leave my machine?

不会。扩展只申请 storage 权限、没有 host 权限,产物里也没有从网络取来的代码;读文件、解码、排版、写 PDF 都在标签页内完成。日志里有什么,只有你知道。No. The extension asks for the storage permission only, has no host permissions and ships no remotely hosted code; reading, decoding, laying out and writing the PDF all happen inside the tab. Whatever is in the log stays where you can see it.

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