3
$\begingroup$

The following is a minimal example that I intended to obtain a graph (RegionPlot) of image size 3cm:

cm = 72/2.54;
r = RegionPlot[x^2 + y^2 < 1, {x, -1, 1}, {y, -1, 1}, Frame -> True, 
  PlotRange -> {{-1, 1}, {-1, 1}}, FrameLabel -> {x, y}]
Export["test1.pdf", Show[r, ImageSize -> 3 cm]]

After opening test1.pdf by Adobe Acrobat reader, I found out that the real size of the pdf file is 2.19 * 1.98 cm. Why does not the size match, and how can I resolve this problem?

$\endgroup$

1 Answer 1

3
$\begingroup$

You are facing the problem described here. The simplest workaround is to evaluate

SetOptions[$FrontEndSession, PrintingStyleEnvironment -> "Working"]

before exporting. Now it works as expected:

Export["test1.pdf", Show[r, ImageSize -> 3 cm]];
pg = Import["test1.pdf", "PageGraphics"][[1]];
Options[pg, ImageSize]
 {ImageSize -> {86., 76.}}
$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.