Skip to content

Instantly share code, notes, and snippets.

@zr-tex8r
Created November 16, 2015 12:39
Show Gist options
  • Save zr-tex8r/f80c36adbf8f6d1df8f7 to your computer and use it in GitHub Desktop.
Save zr-tex8r/f80c36adbf8f6d1df8f7 to your computer and use it in GitHub Desktop.
LaTeX: the graphicx driver for "would-be" dvipdfmx modified to support PDF /Rotate feature
%% This is file `dvipdfmx.def' for DVIPDFMx by J.-H. Cho and S. Hirata
%% based upon `dvipdf.def' in the LaTeX `Graphics Bundle'.
%%
%% Copyright 2005-2015 Jin-Hwan Cho, Shunsaku Hirata
%% (with contributions from many others)
%%
%% This file is not part of the Standard LaTeX `Graphics Bundle'.
%% It may be distributed under the terms of the LaTeX Project Public
%% License, as described in lppl.txt in the base LaTeX distribution.
%% Either version 1.0 or, at your option, any later version.
%%
%% This driver is developed at:
%% http://puszcza.gnu.org.ua/projects/latexfmxdef
%% Please report bugs and patches through the tracker there.
%% Official releases, though, are made through CTAN:
%% http://www.ctan.org/pkg/dvipdfmx-def
%%
%% The original source files were:
%% drivers.dtx (with options: `dvipdf,color1,psrulesZ')
%% Copyright (C) 1995 1996 1997 1998 1999, 2014 David Carlisle
%% Copyright (C) 1994 David Carlisle Sebastian Rahtz
%%
% emacs-page
\ProvidesFile{dvipdfmx.def}
[2015/11/04 v4.07 LaTeX color/graphics driver for dvipdfmx (TeX Live/ChoF)]
%
\def\c@lor@arg#1{%
\dimen@#1\p@
\ifdim\dimen@<\z@\dimen@\maxdimen\fi
\ifdim\dimen@>\p@
\PackageError{color}{Argument `#1' not in range [0,1]}\@ehd
\fi}
\def\color@gray#1#2{%
\c@lor@arg{#2}%
\edef#1{[#2]}%
}
\def\color@cmyk#1#2{\c@lor@@cmyk#2\@@#1}
\def\c@lor@@cmyk#1,#2,#3,#4\@@#5{%
\c@lor@arg{#4}%
\c@lor@arg{#1}%
\c@lor@arg{#2}%
\c@lor@arg{#3}%
\edef#5{[#1 #2 #3 #4]}%
}
\def\color@rgb#1#2{\c@lor@@rgb#2\@@#1}
\def\c@lor@@rgb#1,#2,#3\@@#4{%
\c@lor@arg{#1}%
\c@lor@arg{#2}%
\c@lor@arg{#3}%
\edef#4{[#1 #2 #3]}%
}
\def\color@RGB#1#2{\c@lor@@RGB#2\@@#1}
\def\c@lor@@RGB#1,#2,#3\@@#4{%
\c@lor@RGB@rgb{#1}\@tempa
\c@lor@RGB@rgb{#2}\@tempb
\c@lor@RGB@rgb{#3}\@tempc
\c@lor@@rgb\@tempa,\@tempb,\@tempc\@@#4%
}
\def\c@lor@RGB@rgb#1#2{%
\dimen@#1\p@
\divide\dimen@\@cclv
\edef#2{\strip@pt\dimen@}}
\def\color@hsb#1#2{\c@lor@@hsb#2\@@#1}
\def\c@lor@@hsb#1,#2,#3\@@#4{%
\c@lor@arg{#1}%
\c@lor@arg{#2}%
\c@lor@arg{#3}%
\edef#4{[#1 #2 #3] hsb}%
}
\def\color@named#1#2{\c@lor@@named#2,,\@@#1}
\def\c@lor@@named#1,#2,#3\@@#4{%
\@ifundefined{col@#1}%
{\PackageError{color}{Undefined color `#1'}\@ehd}%
{\edef#4{ #1}}%
}
\def\c@lor@to@ps#1 #2\@@{\csname c@lor@ps@#1\endcsname#2 \@@}
\def\c@lor@ps@#1 #2\@@{TeXDict begin #1 end}
\def\c@lor@ps@rgb#1\@@{#1 setrgbcolor}
\def\c@lor@ps@hsb#1\@@{#1 sethsbcolor}
\def\c@lor@ps@cmyk#1\@@{#1 setcmykcolor}
\def\c@lor@ps@gray#1\@@{#1 setgray}
\def\current@color{[0]}
\def\set@color{%
\special{pdf:bcolor \current@color
}\aftergroup\reset@color}
\def\reset@color{\special{%
pdf:ecolor}}
\def\set@page@color{\special{%
pdf:bgcolor \current@color}}
\def\define@color@named#1#2{%
\expandafter\let\csname col@#1\endcsname\@nnil}
%
% Graphics
%
\def\declareimagemask{%
\@ifnextchar[\declareimagemask@i{\declareimagemask@i[]}}
\def\declareimagemask@i[#1]#2#3{%
\special{pdf:image @#2\space hide (#3) #1}}
%
% import from pdftex.def
%
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname RequirePackage\endcsname\relax
\input infwarerr.sty\relax
\input ltxcmds.sty\relax
\else
\RequirePackage{infwarerr}[2007/09/09]%
\RequirePackage{ltxcmds}[2010/12/07]%
\fi
\def\GPT@error{\@PackageError{dvipdfmx.def}}%
\def\GPT@warn{\@PackageWarning{dvipdfmx.def}}%
\let\GPT@pagebox@option\ltx@empty
\begingroup
\toks@{%
\define@key{Gin}{page}{\def\Gin@page{#1}}
\define@key{Gin}{mask}{\def\Gin@mask{#1}}
\define@key{Gin}{interpolate}[true]{%
\lowercase{\Gin@boolkey{#1}}{interpolate}}
\define@key{Gin}{pagebox}{%
\expandafter\let\expandafter\GPT@pagebox%
\csname GPT@pagebox@#1\endcsname
\ifx\GPT@pagebox\relax
\let\GPT@pagebox\ltx@empty
\GPT@warn{%
Unknown value `#1' for `pagebox'.\MessageBreak
Supported values:\MessageBreak
mediabox, cropbox, bleedbox, trimbox, artbox%
}%
\else%
\def\GPT@pagebox@option{-B \GPT@pagebox\space}%
\fi%
}%
\define@key{Gin}{pdfrotate}{\Gin@DPX@set@pdfrotate{#1}}%
}
\ltx@IfUndefined{define@key}{
\edef\x{\endgroup
\noexpand\AtBeginDocument{%
\noexpand\ltx@IfUndefined{define@key}{}{\the\toks@}%
}%
}\x
}{%
\expandafter\endgroup\the\toks@
}%
\def\GPT@pagebox@cropbox{cropbox}%
\def\GPT@pagebox@mediabox{mediabox}%
\def\GPT@pagebox@artbox{artbox}%
\def\GPT@pagebox@trimbox{trimbox}%
\def\GPT@pagebox@bleedbox{bleedbox}%
%
% end (import from pdftex.def)
%
% improved by N. Abe to cache BoundingBox for pdfpages package
%
\def\Gread@pdf#1{%
\edef\@tempa{pdf@bbox@cache@\Gin@page @\GPT@pagebox @#1}%
\expandafter\expandafter\expandafter\@ifundefined\expandafter{\@tempa}{\Gread@@pdf{#1}}{%
\edef\@gtempa{\csname\@tempa\endcsname}%
\expandafter\Gread@parse@bb\@gtempa\\}}
\def\Gread@@pdf#1{%
\begingroup
\Gin@DPX@set@pdfrotate{0}%
\Gin@DPX@retain@viewport@code
\@tempcnta\z@
\loop\ifnum\@tempcnta<\@xxxii
\catcode\@tempcnta14 %
\advance\@tempcnta\@ne
\repeat
\catcode`\^^?14 %
\let\do\@makeother
\dospecials
\catcode`\ 10 %
\catcode`\^^I10 %
\catcode\endlinechar5 %
\@makeother\:%
\@makeother\-%
\immediate\openin\@inputcheck"#1" % allow spaces in a name of a .xbb file
\ifeof\@inputcheck
\def\@tempc{!}%
\ifx\Gin@page\@tempc
\def\@tempc{}%
\else
\def\@tempc{-p \Gin@page\space}%
\fi
\immediate\openin\@inputcheck="|extractbb \GPT@pagebox@option \@tempc -O \Gin@base\Gin@ext"%
\fi
\Gread@true
\let\@tempb\relax
\ifeof\@inputcheck
\@latex@error
{Cannot run pipe command. Try --shell-escape^^J%
(--enable-pipes in MikTeX) option}%
\@ehc
\else
\loop
\read\@inputcheck to\@tempc
\ifeof\@inputcheck
\Gread@false
\else
\expandafter\Gread@find@bb\@tempc:.\\%
\expandafter\Gread@find@rotate\@tempc:.\\%
\fi
\ifGread@
\repeat
\immediate\closein\@inputcheck
\fi
%
% If BoundingBox is not obtained, extractbb may be an old one which does not
% support the -p and/or -B options, and usage of extractbb is printed to stdout.
% Thus we retry without the -p and/or -B optons.
%
\ifGin@bbox\else
\immediate\openin\@inputcheck="|extractbb -O \Gin@base\Gin@ext"%
\message{^^JI try without the new options^^J}%
\Gread@true
\let\@tempb\relax
\ifeof\@inputcheck
\@latex@error
{Cannot run pipe command. Try --shell-escape^^J%
(--enable-pipes in MikTeX) option}%
\@ehc
\else
\loop
\read\@inputcheck to\@tempc
\ifeof\@inputcheck
\Gread@false
\else
\expandafter\Gread@find@bb\@tempc:.\\%
\expandafter\Gread@find@rotate\@tempc:.\\%
\fi
\ifGread@
\repeat
\immediate\closein\@inputcheck
\aftergroup\Gin@clear@pagebox
\fi
\fi
%
% improved by N. Abe to cache BoundingBox for pdfpages package
%
\ifGin@bbox
\edef\@tempa{pdf@bbox@cache@\Gin@page @\GPT@pagebox @#1}%
\expandafter\expandafter\expandafter\xdef\expandafter\csname\@tempa\endcsname{\@gtempa}%
\else
\@latex@error
{Cannot determine size of image (no BoundingBox)}%
\@ehc
\gdef\@gtempa{0 0 72 72 }%
\fi
\endgroup
\expandafter\Gread@parse@bb\@gtempa\\%
\let\Gin@DPX@pdfrotate\Gin@DPX@g@pdfrotate
}
\def\Gin@clear@pagebox{%
\let\GPT@pagebox\@empty}
\let\Gread@bmp\Gread@pdf
\def\Gin@page{!}
\def\Gin@mask{!}
\newif\ifGin@interpolate\Gin@interpolatefalse
\let\GPT@pagebox\ltx@empty
\def\Gin@DPX@pdfrotate{0}
\def\Ginclude@pdf#1{%
\message{<#1>}%
\bgroup
\Gin@DPX@pdfrotate@post
\def\@tempa{!}%
\special{pdf:epdf\space
\ifx\Gin@page\@tempa\else page\space\Gin@page\space\fi
\ifx\GPT@pagebox\ltx@empty\else pagebox\space\GPT@pagebox\space\fi
bbox\space\Gin@llx\space\Gin@lly\space\Gin@urx\space\Gin@ury\space
clip\space\ifGin@clip 1\else 0\fi\space
\ifx\Gin@scalex\@tempa\else width\space\the\Gin@req@width\space\fi
\ifx\Gin@scaley\@tempa\else height\space\the\Gin@req@height\space\fi
(#1)\space
\ifx\Gin@mask\@tempa
\ifGin@interpolate<</Interpolate\space true>>\fi
\else
<</SMask @\Gin@mask\space%
\ifGin@interpolate/Interpolate\space true\fi>>%
\fi}%
\egroup}
\def\Ginclude@bmp#1{%
\message{<#1>}%
\bgroup
\def\@tempa{!}%
\special{pdf:image\space
\ifx\Gin@page\@tempa\else page\space\Gin@page\space\fi
% The next line was \ifGin@bbox previously. However, LaTeX can read
% BoundingBox from a .xbb file even when \Gin@bboxfalse.
% Thus, we give bbox in the cases of trim/viewport, since
% trim/viewport don't work without bbox.
\ifx\Gin@ollx\@undefined\else
bbox\space\Gin@llx\space\Gin@lly\space\Gin@urx\space\Gin@ury\space
clip\space\ifGin@clip 1\else 0\fi\space
\fi
\ifx\Gin@scalex\@tempa\else width\space\the\Gin@req@width\space\fi
\ifx\Gin@scaley\@tempa\else height\space\the\Gin@req@height\space\fi
(#1)\space
\ifx\Gin@mask\@tempa
\ifGin@interpolate<</Interpolate\space true>>\fi
\else
<</SMask @\Gin@mask\space%
\ifGin@interpolate/Interpolate\space true\fi>>%
\fi}%
\egroup}
\newif\if@trim@vport
\def\Ginclude@eps#1{%
\message{<#1>}%
\bgroup
\ifx\Undefined\Gin@vllx\else\@trim@vporttrue\fi
\def\@tempa{!}%
\dimen@\Gin@urx\p@
\advance\dimen@ -\Gin@llx\p@
\if@trim@vport
\advance\dimen@ \Gin@vllx\p@
\fi
\edef\Gin@urx{\strip@pt\dimen@}%
\dimen@\Gin@ury\p@
\advance\dimen@ -\Gin@lly\p@
\if@trim@vport
\advance\dimen@ \Gin@vlly\p@
\fi
\edef\Gin@ury{\strip@pt\dimen@}%
\dimen@\Gin@req@width
\[email protected]%
\divide\dimen@\dimen@ii
\@tempdima\Gin@req@height
\divide\@tempdima\dimen@ii
\special{PSfile="#1"\space
\if@trim@vport
llx=\Gin@vllx\space
lly=\Gin@vlly\space
\fi
urx=\Gin@urx\space
ury=\Gin@ury\space
\ifx\Gin@scalex\@tempa\else rwi=\number\dimen@\space\fi
\ifx\Gin@scaley\@tempa\else rhi=\number\@tempdima\space\fi
\ifGin@clip clip\fi}%
\egroup}
%
% [Support for pdfrotate]
% Attach \Gin@viewport@prehook.
\def\Gin@DPX@patch@graphics@code{%
\global\let\Gin@DPX@patch@graphics@code\@empty
\ifx\Gin@viewport\@undefined
\typeout{\string\Gin@DPX@patch@graphics@code}%
\gdef\Gin@viewport@code{\Gin@viewport@prehook}%
\fi}
\def\Gin@DPX@patch@graphicx@code{%
\ifx\Gin@viewport\@undefined\else
\typeout{\string\Gin@DPX@patch@graphicx@code}%
\global\let\Gin@DPX@patch@graphicx@code\@empty
\gdef\Gin@DPX@g@next{%
\gdef\Gin@viewport@code{\Gin@viewport@prehook}}%
\Gin@DPX@patch@viewport@code\Gin@viewport
\Gin@DPX@patch@viewport@code\Gin@trim
\Gin@DPX@g@next
%\typeout{\meaning\Gin@viewport@code}%
%\typeout{\meaning\Gin@viewport}%
%\typeout{\meaning\Gin@trim}%
\fi}
\def\Gin@DPX@patch@viewport@code#1{%
\ifx\Gin@viewport@code#1%
\g@addto@macro\Gin@DPX@g@next{\let\Gin@viewport@code#1}\fi
\expandafter\gdef\expandafter#1\expandafter{%
\expandafter\Gin@viewport@prehook#1}}
\def\Gin@DPX@retain@viewport@code{%
\global\let\Gin@DPX@g@viewport@code\Gin@viewport@code
\aftergroup\let\aftergroup\Gin@viewport@code
\aftergroup\Gin@DPX@g@viewport@code}
% the hook
\def\Gin@viewport@prehook{\Gin@DPX@pdfrotate@pre}
% Read /Rotate line from .xbb.
\edef\Gread@DPX@Rotate{\@percentchar\@percentchar Rotate}
\long\def\Gread@find@rotate#1:#2#3\\{%
\def\@tempa{#1}%
\ifx\@tempa\Gread@DPX@Rotate
\Gread@find@rotate@i#2#3\\%
\fi}
\def\Gread@find@rotate@i#1 #2\\{%
\Gin@DPX@set@pdfrotate{#1}}
%
\def\Gin@DPX@set@pdfrotate#1{% {<angle>}
\typeout{\string\Gin@DPX@set@pdfrotate{#1}}%
% This triggers the hook attachment.
\Gin@DPX@patch@graphics@code
\Gin@DPX@patch@graphicx@code
\begingroup
\@tempcnta=#1\relax
\@whilenum\@tempcnta>\z@\do{\advance\@tempcnta-360 }%
\@whilenum\@tempcnta<\z@\do{\advance\@tempcnta360 }%
\@tempcntb\@tempcnta \divide\@tempcntb90 %
\edef\@tempa{\the\@tempcntb}%
\multiply\@tempcntb90 %
\ifnum\@tempcnta=\@tempcntb
\global\let\Gin@DPX@g@pdfrotate\@tempa
\else
\@tempcnta=#1\relax
\@latex@error
{Illegal value of pdfrotate (\the\@tempcnta)}%
{The value of pdfrotate must be multiple of 90.\MessageBreak
\@ehc}%
\gdef\Gin@DPX@g@pdfrotate{0}%
\fi
\endgroup
\typeout{=>\Gin@DPX@g@pdfrotate}%
\let\Gin@DPX@pdfrotate\Gin@DPX@g@pdfrotate}
\def\Gin@DPX@pdfrotate@pre{%
\typeout{\string\Gin@DPX@pdfrotate@pre}%
\def\@tempa##1##2\\{\def\@tempa{##1}}%
\expandafter\expandafter\expandafter\@tempa
\csname Gin@rule@\Gin@ext\endcsname\relax\\%
\def\@tempb{pdf}%
\ifx\@tempa\@tempb\else
\typeout{not pdf (\@tempa)}%
\def\Gin@DPX@pdfrotate{0}%
\fi
\Gin@DPX@apply@pdfrotate{+\Gin@DPX@pdfrotate}}
\def\Gin@DPX@pdfrotate@post{%
\typeout{\string\Gin@DPX@pdfrotate@post}%
\Gin@DPX@apply@pdfrotate{-\Gin@DPX@pdfrotate}}
\def\Gin@DPX@apply@pdfrotate#1{%
\typeout{\string\Gin@DPX@apply@pdfrotate{#1}}%
\@tempcnta#1\relax
\ifnum\@tempcnta<\z@ \advance\@tempcnta4 \fi
\ifcase\@tempcnta
\or \Gin@DPX@apply@rot@sub{\Gin@olly}{-\Gin@ourx}{\Gin@oury}{-\Gin@ollx}%
\or \Gin@DPX@apply@rot@sub{-\Gin@ourx}{-\Gin@oury}{-\Gin@ollx}{-\Gin@olly}%
\or \Gin@DPX@apply@rot@sub{-\Gin@oury}{\Gin@ollx}{-\Gin@olly}{\Gin@ourx}%
\fi}
\def\Gin@DPX@apply@rot@sub#1#2#3#4{%
\let\Gin@ollx\Gin@llx \let\Gin@olly\Gin@lly
\let\Gin@ourx\Gin@urx \let\Gin@oury\Gin@ury
\edef\Gin@llx{\number#1}\edef\Gin@lly{\number#2}%
\edef\Gin@urx{\number#3}\edef\Gin@ury{\number#4}}
%
\def\Grot@start{%
\special{pdf:btrans rotate \Grot@angle}}
\def\Grot@end{\special{pdf:etrans}}
\def\Gscale@start{%
\special{pdf:btrans xscale \Gscale@x\space yscale \Gscale@y}}
\def\Gscale@end{\special{pdf:etrans}}
\def\Gin@PS@raw#1{\special{ps: #1}}
\def\Gin@PS@restored#1{\special{" #1}}
\def\Gin@PS@literal@header#1{\AtBeginDvi{\special{! #1}}}
\def\Gin@PS@file@header#1{\AtBeginDvi{\special{header=#1}}}
\def\Gin@extensions{% order here is like xetex.def, except for PS
.pdf,.PDF,.ai,.AI,%
.png,.PNG,.jpg,.JPG,.jpeg,.JPEG,.jp2,.JP2,.jpf,.JPF,.bmp,.BMP,%
.ps,.PS,.eps,.EPS,%
.pz,.eps.Z,.ps.Z,.ps.gz,.eps.gz}
%
\@namedef{Gin@[email protected]}#1{{pdf}{.xbb}{#1}}
\@namedef{Gin@[email protected]}#1{{pdf}{.xbb}{#1}}
%
\@namedef{Gin@[email protected]}#1{{pdf}{.xbb}{#1}}
\@namedef{Gin@[email protected]}#1{{pdf}{.xbb}{#1}}
%
\@namedef{Gin@[email protected]}#1{{bmp}{.xbb}{#1}}
\@namedef{Gin@[email protected]}#1{{bmp}{.xbb}{#1}}
%
\@namedef{Gin@[email protected]}#1{{bmp}{.xbb}{#1}}
\@namedef{Gin@[email protected]}#1{{bmp}{.xbb}{#1}}
%
\@namedef{Gin@[email protected]}#1{{bmp}{.xbb}{#1}}
\@namedef{Gin@[email protected]}#1{{bmp}{.xbb}{#1}}
%
\@namedef{Gin@[email protected]}#1{{bmp}{.xbb}{#1}}
\@namedef{Gin@[email protected]}#1{{bmp}{.xbb}{#1}}
%
\@namedef{Gin@[email protected]}#1{{bmp}{.xbb}{#1}}
\@namedef{Gin@[email protected]}#1{{bmp}{.xbb}{#1}}
%
\@namedef{Gin@[email protected]}#1{{bmp}{.xbb}{#1}}
\@namedef{Gin@[email protected]}#1{{bmp}{.xbb}{#1}}
%
\@namedef{Gin@[email protected]}#1{{bmp}{.xbb}{#1}}
\@namedef{Gin@[email protected]}#1{{bmp}{.xbb}{#1}}
%
\@namedef{Gin@[email protected]}#1{{bmp}{.xbb}{#1}}
\@namedef{Gin@[email protected]}#1{{bmp}{.xbb}{#1}}
%
\@namedef{Gin@[email protected]}#1{{eps}{.ps}{#1}}
\@namedef{Gin@[email protected]}#1{{eps}{.ps}{#1}}
%
\@namedef{Gin@[email protected]}#1{{eps}{.eps}{#1}}
\@namedef{Gin@[email protected]}#1{{eps}{.eps}{#1}}
%
% (don't bother with uppercase versions for these Unixish extensions)
\@namedef{Gin@[email protected]}#1{{eps}{.xbb}{`gunzip -c #1}}
\@namedef{Gin@[email protected]}#1{{eps}{.eps.xbb}{`gunzip -c #1}}
\@namedef{Gin@[email protected]}#1{{eps}{.ps.xbb}{`gunzip -c #1}}
\@namedef{Gin@[email protected]}#1{{eps}{.ps.xbb}{`gunzip -c #1}}
\@namedef{Gin@[email protected]}#1{{eps}{.eps.xbb}{`gunzip -c #1}}
%
\@namedef{Gin@rule@*}#1{{eps}{\Gin@ext}{#1}}
\endinput
%%
%% End of file `dvipdfmx.def'.
%%Title: snowman.pdf
% snowman.pdf に対する"修正後の" extractbb の出力に相当するもの.
% ちなみに snowman.pdf は例のアレ.
%%Creator: extractbb 2015XXXX
%%BoundingBox: 30 20 90 90
%%HiResBoundingBox: 30.000000 20.000000 90.000000 98.000000
%%Rotate: 270
%%PDFVersion: 1.4
%%Pages: 1
%%CreationDate: Wed Nov 11 22:33:44 2015
\documentclass[dvipdfmx,a4paper]{article}
% ダミーの tiger.pdf と snowman.pdf を用意してコンパイルする.
\newsavebox{\mytestbox}
%------
% pattern-1
\usepackage{color,graphics}
% pattern-2
%\usepackage{color,graphics}
%\savebox{\mytestbox}{\includegraphics{tiger.pdf}}
% pattern-3
%\usepackage{graphics}
% pattern-4
%\usepackage{graphics}
%\savebox{\mytestbox}{\includegraphics{tiger.pdf}}
% pattern-5
%\usepackage{graphicx}
% pattern-6
%\usepackage{graphicx}
%\savebox{\mytestbox}{\includegraphics{tiger.pdf}}
%------
\usepackage{graphicx}
\begin{document}
%------
% pattern-A
\includegraphics[width=5cm,trim=10 10 10 10,bb=0 0 550 568,pdfrotate=90]{tiger.pdf}
% pattern-B
%\includegraphics[width=5cm,pdfrotate=90,trim=20 0 30 10,bb=0 0 550 568]{tiger.pdf}
%------
\savebox\mytestbox{\includegraphics[viewport=20 0 40 60]{snowman.pdf}}
\typeout{\the\wd\mytestbox,\the\ht\mytestbox}
\par\usebox\mytestbox
\end{document}
%%Title: tiger.pdf
% tiger.pdf に対する"修正後の" extractbb の出力に相当するもの.
%%Creator: extractbb 2015XXXX
%%BoundingBox: 0 0 550 568
%%HiResBoundingBox: 0.000000 0.000000 550.000000 568.000000
%%Rotate: 90
%%PDFVersion: 1.4
%%Pages: 1
%%CreationDate: Wed Nov 11 00:22:33 2015
@zr-tex8r
Copy link
Author

  • dvipdfmx の pdf:epdf special の仕様は特に変更なし。対象のPDF(のページ)が /Rotate 指定を持っている場合はそれが適用される。 bbox パラメタは元々の座標系で指定する。
  • extractbb は /Rotate 指定がある場合は %%Rotate: の行でその値を出力する。バウンディングボックスは元々の座標系で出力する。
  • graphicx の \includegraphics では自動的に /Rotate が適用される。 もし bb を指定するのであれば、pdfrotate で /Rotate の正しい値を指定する必要がある。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment