[DVIPDFMx] Overprinting with xelatex

Clinton Gormley clint at traveljury.com
Mon Feb 22 21:40:58 KST 2010


Hi all

Not sure if this is the right list to ask, but I need to convince
xelatex to set overprinting in the produced PDFs.

I've found this stylesheet
( http://tex.aanhet.net/overprint/overprint.sty ) for achieving that in
pdflatex, but of course this doesn't work for xelatex.

Any ideas how I should convert this stylesheet for xelatex?

thanks

Clint


OVERPRINTING STYLESHEET:

\ProvidesPackage{overprint}
\RequirePackage{color}
%
% support for overprinting.
% only support for dvips.def and pdftex.def
%
% Copyright (C) 2004, 2006 Siep Kroonenberg
% siepo at cybercomm dot nl
%
% Based on color.sty and posts from the pdftex list in may 2004
%
% 2004/06/02
% Initial comments and change history added
% Creation of ExtGState dictionaries put inside AtBeginDocument
% 2004/05/30
% First release
% 2006/10/16
% Adds to \pdfpageresources rather than just setting this tokenlist

% dummy definition for other drivers:
\let\set at op\relax

\newif\if at op
\def\overprint{%
  \@optrue
  \set at op
  \ignorespaces
}
\def\knockout{%
  \@opfalse
  \set at op
  \ignorespaces
}

\def\testname{pdftex.def}
\ifx \Gin at driver \testname
  % Create graphics state dictionaries with overprint settings
  % Delay this until after the preamble
  % because of restrictions of the pdf format.
  %
  \AtBeginDocument{
    \immediate\pdfobj{<< /Type /ExtGState /op false /OP false /OPM 0 >>}
    \edef\op at off{\the\pdflastobj}
    \immediate\pdfobj{<< /Type /ExtGState /op true /OP true /OPM 1 >>}
    \edef\op at on{\the\pdflastobj}
    \immediate\pdfobj{ << %
      /GSko \op at off\space 0 R %
      /GSop \op at on\space 0 R >>}
    \edef\@extgs{\the\pdflastobj}
    \edef\next{\global\noexpand\pdfpageresources={\the\pdfpageresources
      \space /ExtGState \@extgs\space 0 R }}
    \next
    %\edef\next{\global\noexpand\pdfpageresources={\the\pdfpageresources
    %  \space /ExtGState #1\space 0 R }}
    %\next{\@extgs}
  }
  % macros for setting and resetting overprint state
  \def\set at op{%
    \if at op
      \pdfliteral direct {/GSop gs}%
    \else
      \pdfliteral direct {/GSko gs}%
    \fi
    \aftergroup\reset at op}
  \def\reset at op{%
    \if at op
      \pdfliteral direct {/GSop gs}%
    \else
      \pdfliteral direct {/GSko gs}%
    \fi
  }
\fi

\def\testname{dvips.def}
\ifx \Gin at driver \testname
  \def\set at op{%
    \if at op
      \special{ps:true setoverprint}%
    \else
      \special{ps:false setoverprint}%
    \fi
    \aftergroup\reset at op}
  \def\reset at op{%
    \if at op
      \special{ps:true setoverprint}%
    \else
      \special{ps:false setoverprint}%
    \fi
  }
\fi

% initialize to knockout
\@opfalse
\knockout

% do we need something like colorfix?
%\AtBeginDocument{%
%  \let\@ld at op\overprint
%  \def\overprint{%
%    \@ifundefined{if at inlabel}{}{%
%      \csname if at inlabel\expandafter\endcsname
%      \expandafter\leavevmode\csname fi\endcsname
%    }%
%    \@ld at op
%  }%
%  \let\@ld at ko\knockout
%  \def\knockout{%
%    \@ifundefined{if at inlabel}{}{%
%      \csname if at inlabel\expandafter\endcsname
%      \expandafter\leavevmode\csname fi\endcsname
%    }%
%    \@ld at ko
%  }%
%  \let\@lduseb at x\usebox
%  \def\usebox#1{\@lduseb at x{#1}\set at op}%
%}



More information about the dvipdfmx mailing list