對 PDF 中的文字進行混淆/打亂

對 PDF 中的文字進行混淆/打亂

如果您需要共用包含不可公開影像的 PDF 文檔,您可以使用該draft選項

\documentclass[draft]{book}

是否可以對文本做類似的事情?出於調試目的,我必須共享包含不可公開文字的 PDF。只要佈局(幾乎)與常規的PDF。

我正在尋找使用 XeLaTeX 文件的解決方案。

答案1

如果您願意投入大量精力,這種蠻力方法可能會有所幫助。請注意,它不理解換行符(連字符),但您可以編譯、記下尖嘴並替換片段文字。另外,對於整行,您可以簡單地在 textwidth 處使用規則。這是與編譯器無關的。

\documentclass{article}
\newif\ifredacted
\redactedtrue % or false
\newsavebox\hideme
\def\blackout{\ifredacted\rule{\wd\hideme}{.5em}\else\usebox\hideme\fi\obeyspaces}
\begin{document}
\sbox\hideme{Battalion 43}
We will be sending \blackout to the island.\par
\sbox\hideme{04h36m tomorrow}
They arrive \blackout.\par
\end{document}

相關內容