Windows 10 在 CMD 上打印 RTF 文档

Windows 10 在 CMD 上打印 RTF 文档

众所周知,Windows 命令提示符能够打印彩色和格式化的文本。因此,如果我有一个没有图像或其他内容的 rtf,以至于 Windows 命令提示符有可能显示内容,那么有没有什么办法可以做到这一点。

type我尝试使用命令提示符中的命令执行此操作。

RTF 文档(名为 sample.rtf)

当我输入命令时,type sample.rtf这是收到的打印

{\rtf1\ansi\deff3\adeflang1025
{\fonttbl{\f0\froman\fprq2\fcharset0 Times New Roman;}{\f1\froman\fprq2\fcharset2 Symbol;}{\f2\fswiss\fprq2\fcharset0 Arial;}{\f3\froman\fprq2\fcharset0 Liberation Serif{\*\falt Times New Roman};}{\f4\fswiss\fprq2\fcharset0 Liberation Sans{\*\falt Arial};}{\f5\fnil\fprq2\fcharset0 Microsoft YaHei;}{\f6\fnil\fprq0\fcharset128 Mangal;}{\f7\fnil\fprq2\fcharset0 Mangal;}}
{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;\red212\green234\blue107;}
{\stylesheet{\s0\snext0\hich\af3\dbch\af8\langfe2052\dbch\af7\afs24\alang1081\nowidctlpar\hyphpar0\ltrpar\cf0\loch\f3\fs24\lang16393\kerning1 Normal;}
{\s15\sbasedon0\snext16\dbch\af5\dbch\af7\afs28\sb240\sa120\keepn\loch\f4\fs28 Heading;}
{\s16\sbasedon0\snext16\sl276\slmult1\sb0\sa140 Text Body;}
{\s17\sbasedon16\snext17\dbch\af6\sl276\slmult1\sb0\sa140 List;}
{\s18\sbasedon0\snext18\dbch\af6\afs24\ai\sb120\sa120\noline\fs24\i Caption;}
{\s19\sbasedon0\snext19\dbch\af6\noline Index;}
}{\*\generator LibreOffice/6.4.5.2$Windows_X86_64 LibreOffice_project/a726b36747cf2001e06b58ad5db1aa3a9a1872d6}{\info{\creatim\yr0\mo0\dy0\hr0\min0}{\revtim\yr2020\mo9\dy15\hr20\min40}{\printim\yr0\mo0\dy0\hr0\min0}}{\*\userprops}\deftab709\hyphauto1\viewscale75
{\*\pgdsctbl
{\pgdsc0\pgdscuse451\pgwsxn11906\pghsxn16838\marglsxn1134\margrsxn1134\margtsxn1134\margbsxn1134\pgdscnxt0 Default Style;}}
\formshade\paperh16838\paperw11906\margl1134\margr1134\margt1134\margb1134\sectd\sbknone\sectunlocked1\pgndec\pgwsxn11906\pghsxn16838\marglsxn1134\margrsxn1134\margtsxn1134\margbsxn1134\ftnbj\ftnstart1\ftnrstcont\ftnnar\aenddoc\aftnrstcont\aftnstart1\aftnnrlc
{\*\ftnsep\chftnsep}\pgndec\pard\plain \s0\hich\af3\dbch\af8\langfe2052\dbch\af7\afs24\alang1081\nowidctlpar\hyphpar0\ltrpar\cf0\loch\f3\fs24\lang16393\kerning1\ql\ltrpar\loch

\par \pard\plain \s0\hich\af3\dbch\af8\langfe2052\dbch\af7\afs24\alang1081\nowidctlpar\hyphpar0\ltrpar\cf0\loch\f3\fs24\lang16393\kerning1\ql\ltrpar{\loch
This is just a sample text}
\par \pard\plain \s0\hich\af3\dbch\af8\langfe2052\dbch\af7\afs24\alang1081\nowidctlpar\hyphpar0\ltrpar\cf0\loch\f3\fs24\lang16393\kerning1\ql\ltrpar\loch

\par \pard\plain \s0\hich\af3\dbch\af8\langfe2052\dbch\af7\afs24\alang1081\nowidctlpar\hyphpar0\ltrpar\cf0\loch\f3\fs24\lang16393\kerning1\ql\ltrpar{\rtlch\ab \ltrch\b\loch
This is just a sample bold text  }
\par \pard\plain \s0\hich\af3\dbch\af8\langfe2052\dbch\af7\afs24\alang1081\nowidctlpar\hyphpar0\ltrpar\cf0\loch\f3\fs24\lang16393\kerning1\ql\ltrpar\rtlch\ab \ltrch\b\loch

\par \pard\plain \s0\hich\af3\dbch\af8\langfe2052\dbch\af7\afs24\alang1081\nowidctlpar\hyphpar0\ltrpar\cf0\loch\f3\fs24\lang16393\kerning1\ql\ltrpar{\rtlch\ai\ab0 \ltrch\i\b0\loch
This is just a sample  italics text }
\par \pard\plain \s0\hich\af3\dbch\af8\langfe2052\dbch\af7\afs24\alang1081\nowidctlpar\hyphpar0\ltrpar\cf0\loch\f3\fs24\lang16393\kerning1\ql\ltrpar\rtlch\ai\ab0 \ltrch\i\b0\loch

\par \pard\plain \s0\hich\af3\dbch\af8\langfe2052\dbch\af7\afs24\alang1081\nowidctlpar\hyphpar0\ltrpar\cf0\loch\f3\fs24\lang16393\kerning1\ql\ltrpar{\rtlch\ai\ab0 \ltrch\cf17\i\b0\loch
This is just a sample coloured text }
\par }

我理解这是 RTF 的 ANSI/Unicode 等效数据和元数据,在文字处理器中处理时会产生格式化的文本。有没有办法在命令提示符上打印 RTF。此外,如果存在这样的命令,它如何处理图像和其他可能不在命令提示符处理范围内的内容。

答案1

不,您无法在命令提示符上查看/打印格式丰富的文档。文本编辑器和终端仿真器无法呈现格式丰富的文档。您需要使用文字处理器,例如 Microsoft Word、LibreOffice Writer、Wordpad 等。

相关内容