So, as LaTeX does the job very well, one workaround is to generate a draft watermark using LaTeX and then setting it as the background image of an exported PDF from LibreOffice (another one is setting a background image directly in LibreOffice):
The following code uses the draftwatermark package to adjust and generate a watermark:
\documentclass[a4paper]{article}
\usepackage{lmodern} % Latin Modern
%\usepackage{tgheros} % Helvetica
%\usepackage{tgtermes} % Times
%\usepackage{tgcursor} % Courier
% adapt default font
% * serif: \rmdefault
% * sans-serif: \sfdefault
% * monospace: \ttdefault
%\renewcommand*\familydefault{\sfdefault}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{draftwatermark}
% see package documentation for further configuration options
% see package documentation for further configuration options
\SetWatermarkText{Draft}
\SetWatermarkLightness{0.75}
\SetWatermarkScale{1.2}
\begin{document}
\pagenumbering{gobble} % remove page numbers
\mbox{} % pdflatex refuses to emit an empty page otherwise
\end{document}
After building the PDF file using pdflatex, you can use the pdftk command line tool to add it as background/watermark to a PDF document exported from LibreOffice (stamp instead of background places the LaTeX document in front of the other):
pdflatex watermark.tex
pdftk in.pdf background watermark.pdf output out.pdf
The source code and some generated PDFs can be found in this tar archive. It also contains a script draft.sh which adds a draft watermark to a PDF document:
./draft.sh in.pdf out.pdf
pdftk in.pdf background watermark.pdf output out.pdf
The source code and some generated PDFs can be found in this tar archive. It also contains a script draft.sh which adds a draft watermark to a PDF document:
./draft.sh in.pdf out.pdf
Keine Kommentare:
Kommentar veröffentlichen