6
$\begingroup$

Bug present in 10.2 and fixed in 11.2
Exporting to eps still produces a crash, but that is another bug.


Suppose I create a new Notebook:

nb = CreateDocument[{TextCell["PDF Test", "Section"],
                     Table[PieChart@Range@5, {7}]}];

notebook

And set a big paper size so that all my charts fit in a single line:

SetOptions[nb, PrintingOptions -> {"PaperSize" -> 72 {18, 12}}];
SetOptions[nb, ScreenStyleEnvironment -> "Printout"];

wide-notebook

An then I want to export this as PDF. So I issue this command:

Export["test6.pdf", nb]

The result is that my notebook becomes:

notebook-narrow-again

and the generated PDF looks like this:

enter image description here

And the "PaperSize" property is reverted to its default value

Options[nb, PrintingOptions]

{PrintingOptions -> {"EmbedExternalFonts" -> True, 
"EmbedStandardPostScriptFonts" -> True, "FacingPages" -> True, 
"FirstPageFace" -> Right, "FirstPageFooter" -> True, 
"FirstPageHeader" -> False, 
"GraphicsPrintingFormat" -> "Automatic", 
"IncludePostScriptResourceDirectives" -> True, 
"IncludeSpecialFonts" -> True, 
"InnerOuterMargins" -> {Automatic, Automatic}, 
"Magnification" -> 1., "OpacityRenderingMethod" -> Automatic, 
"PageFooterMargins" -> {Automatic, Automatic}, 
"PageHeaderMargins" -> {Automatic, Automatic}, 
"PageSize" -> {Automatic, Automatic}, 
"PaperOrientation" -> "Portrait", 
"PaperSize" -> {612, 792},
"PostScriptOutputFile" -> Automatic, "PrintCellBrackets" -> False, 
"PrintMultipleHorizontalPages" -> False, 
"PrintRegistrationMarks" -> False, 
"PrintSelectionHighlighting" -> False, 
"PrintingMargins" -> {{54, 54}, {72, 72}}, 
"RasterizationResolution" -> "Automatic", 
"RestPagesFooter" -> True, "RestPagesHeader" -> True, 
"UnixShellPrintingCommand" -> Automatic, 
"UsePostScriptOutputFile" -> False, 
"UseUnixShellPrintingCommand" -> False, 
"VertexColorRenderingMethod" -> Automatic}}

If I reset the PaperSize and use the File->Save As.. and used the PDF format, exactly the same happens. If one again I reset the PaperSize and print a PDF file using my new Adobe Acrobat licence, exactly the same happens (but it is slower).

So my question is: How can I get a PDF will all these charts in one row without changing their ImageSize? Is this a bug? Isn't the "Printout" screen environment supposed to match the PDF printout of a notebook? Why is the PaperSize notebook property changed when you Export or print a PDF? Can it be prevented?

I am using Mathematica 10.2 under Windows 7.

$\endgroup$
  • $\begingroup$ it works if you export to .tiff. Perhaps you can find some intermediate format that works and use an external converter. (.eps crashed on me by the way ) $\endgroup$ – george2079 Oct 1 '15 at 16:02
  • $\begingroup$ .eps crashed on me too. In my real application the notebook is several pages long, so I don't think that .tiff is an option. Maybe .rtf $\endgroup$ – Gustavo Delfino Oct 1 '15 at 17:23
4
$\begingroup$

You need to set the page size as well as the paper size. I can only test this in V10.1 but it works:

nb = CreateDocument[{TextCell["PDF Test", "Section"],Table[PieChart@Range@5, {7}]}];
SetOptions[nb, PrintingOptions -> {"PaperOrientation"->"Landscape","PageSize" -> {1296, 864}, 
"PaperSize" -> {1296, 864}}];
SetOptions[nb, ScreenStyleEnvironment -> "Printout"];

As an FYI if you set the toolbar to display the ruler you will see why setting the page size is required.

$\endgroup$
  • $\begingroup$ Unfortunately with version 10.2 this does not work: after Export["test6.pdf", nb] I obtain a PDF file which looks like this: i.stack.imgur.com/DuoyS.jpg $\endgroup$ – Alexey Popkov Oct 2 '15 at 7:29
  • $\begingroup$ It did not work on my Win7 Mathematica 10.2, and I got a different result than Alexey Popkov: i.stack.imgur.com/KZ9f0.png $\endgroup$ – Gustavo Delfino Oct 2 '15 at 13:40
  • $\begingroup$ @GustavoDelfino you are using landscape dimensions but a portrait orientation. Try it again using Landscape. You may need to tweek the margins. $\endgroup$ – Mike Honeychurch Oct 2 '15 at 23:35
3
$\begingroup$

If you highlight all the brackets on the right side of what you want, and then do File->Save Selection As you should get this.

nb = CreateDocument[{TextCell["PDF Test", 
     "Section"], {Table[PieChart@Range@5, {7}]} // TableForm}];

enter image description here

I transposed the list so it reads left to right and put it in table form to get rid of the brackets.

nb = CreateDocument[{TextCell["PDF Test", 
     "Section"], {Table[PieChart@Range@5, {7}]} // TableForm}];

enter image description here

I'm not sure if I had to do this or not, but I made the mathematica window really large and stretched it off my screen so there was plenty of white space to the right of the image before selecting and saving. I think it might matter because my earlier saves still had brackets showing on the right side of the image.

EDIT: Just to be as clear as possible, this is what I meant by "highlight all the brackets."

enter image description here

Mathematica 10.0.0 Mac

$\endgroup$
0
$\begingroup$

With some modifications.

nb = CreateDocument[
   Column[{TextCell["PDF Test", "Section"], 
     GraphicsRow[Table[PieChart@Range@5, {7}], ImageSize -> 700]}]];
$\endgroup$
  • $\begingroup$ Thanks, but this is a trick to reduce the content so that it fits in a letter sized paper. When you open the generated PDF and open the properties windows, you can see that the size is reported as 8.5x11" and not the specified PaperSize. $\endgroup$ – Gustavo Delfino Oct 1 '15 at 18:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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