I'm trying to save the notebook as PDF with working. I tried all methods in old threads but nothing works.
Does anyone know how to make this work?
(version, windows 64-bit)

  PrintingStyleEnvironment -> "Printout", ShowSyntaxStyles -> True]
f[a_, b_, d_] := (a + b)/(a - b) d;
tup1 = Tuples@{{1, 0, 0, 1}, {2, 1, 0, 3}};
       t = Plot[{f[##, d], 1}, {d, 0, 1}, ImageSize -> 1000, 
         PlotLabel -> Style[StringForm["a= `` b= ``", ##]]]; t, 
       Nothing[]] & @@@ tup1 // Flatten // 
  Partition[#, 2, 2, {1, 1}, {}] & // Grid

Also how to print PDF a whole notebook with many inputs and outputs not just graphics?

  • $\begingroup$ Why not use Export["test.pdf",%] ? $\endgroup$
    – cvgmt
    Dec 31, 2020 at 1:06
  • $\begingroup$ @cvgmt I didn't know that this work. It somehow works but there is a problem with margin. Where can I set the margin? $\endgroup$
    – emnha
    Dec 31, 2020 at 1:22
  • 2
    $\begingroup$ I know nothing about Windows, but on MacOS, to save a notebook in a PDF file, I click on Print in the File menu and then choose save as PDF in the print dialog that appears. Maybe something similar works on Windows? $\endgroup$
    – m_goldberg
    Dec 31, 2020 at 1:48
  • 1
    $\begingroup$ @anhnha I’ve printed several pdfs of notebooks for class & unfortunately all I found to work was to just organize the notebook rather carefully. You can change the way your notebook is displayed as you work on it & I found that to be a bit helpful. $\endgroup$ Dec 31, 2020 at 2:28
  • 1
    $\begingroup$ @MichaelE2 I can export the file but the graphics are cut off not like the working view. $\endgroup$
    – emnha
    Jan 4, 2021 at 13:50

3 Answers 3


In V12.0, I get graphics to be broken across pages if I set their ImageSize to be wider than the page width, even though PageBreakWithin is set to False. For instance, it happens with ImageSize -> 1000 for me, which setting is the same as in the OP.

Try ImageSize -> Full if you want the graphics as wide as the page.

[In V12.1/12.2, the graphics are not broken at page breaks.]

  • $\begingroup$ I just updated to 12.2 but the problem still remains. $\endgroup$
    – emnha
    Jan 4, 2021 at 15:51
  • 1
    $\begingroup$ @anhnha Does ImageSize -> Full solve the problem for you? $\endgroup$
    – Michael E2
    Jan 4, 2021 at 16:19
  • $\begingroup$ you're right. That works. What is the reason? I still have overlapping labels problem with long label $\endgroup$
    – emnha
    Jan 4, 2021 at 16:22
  • $\begingroup$ @anhnha I don't know. If the other behavior is a bug, then the explanation is that Full simply works correctly. $\endgroup$
    – Michael E2
    Jan 4, 2021 at 16:26
  • $\begingroup$ I tried another notebook and got labels overlapping of two graphs horizontally $\endgroup$
    – emnha
    Jan 4, 2021 at 16:27

On an Apple, simply printing to a file works.

Why not print to a file, and then see what your print settings are set at?

Can you print to a printer?

UPDATE (see comments below)

Please try updating to Mathematica Version 12.1 or 12.2.

  • $\begingroup$ It does not work for me on a Mac in V12.0 or in V12.2, if I set ImageSize -> 1000. $\endgroup$
    – Michael E2
    Jan 4, 2021 at 14:55
  • $\begingroup$ Does a notebook's size have something to do with ImageSize? $\endgroup$
    – mjw
    Jan 4, 2021 at 14:58
  • $\begingroup$ It doesn't seem to. But I made a mistake in my first comment. In V12.2 the graphics are just cut off at the right margin, but the entire height of each appears on one page. In V12.0, the graphics are broken at page breaks, too. I must have gotten confused which version I was running. :) $\endgroup$
    – Michael E2
    Jan 4, 2021 at 15:04
  • $\begingroup$ Thank you. I am not sure what the issue is. Running on a MacBook Pro with OS X 10.14.6, and trying out the OP's code, and printing to a file. Seems to work as expected. $\endgroup$
    – mjw
    Jan 4, 2021 at 15:09
  • $\begingroup$ Maybe it was a bug in 12.0. $\endgroup$
    – Michael E2
    Jan 4, 2021 at 15:10

We have two questions: 1) How to make a PDF from a grid of graphics (output of Plot), and 2) How to make a PDF for a whole notebook.

For the second question... Here's a way to make a PDF of a whole notebook including inputs and outputs. NotebookPrint saves a print-ready form of a notebook to a file in the format indicated by a file extension. First, open a notebook as a NotebookObject with NotebookOpen, then use the file.ext option of NotebookPrint to make a PDF file. For example:

file = FileNameJoin[{$WolframDocumentsDirectory, "notebook.nb"}];
nb = NotebookOpen[file];
NotebookPrint[nb, "notebook.pdf"];

For the grid of graphics, use CreateDocument to make a new notebook from an expression or expressions. Using the example from your question:

nb = CreateDocument[{f[a_, b_, d_] := (a + b)/(a - b) d;
    tup1 = Tuples@{{1, 0, 0, 1}, {2, 1, 0, 3}};
          Check[t = 
            Plot[{f[##, d], 1}, {d, 0, 1}, ImageSize -> 1000, 
             PlotLabel -> Style[StringForm["a= `` b= ``", ##]]]; t, 
           Nothing[]] & @@@ tup1 // Flatten // 
      Partition[#, 2, 2, {1, 1}, {}] & // Grid}];

NotebookPrint[nb, "plots.pdf"];

I tried several detailed notebooks with mixed graphics, inputs and outputs. NotebookPrint created PDFs that scaled large graphics to a single page (graphics are not split at page breaks, although I found a large, rasterized image that worked better with smaller dimensions). Inputs and outputs are formatted to closely match the notebook appearance.

  • $\begingroup$ I tried your code but the print doesn't look like working view where I have 2 graphics horizontally. ibb.co/56r1FCH $\endgroup$
    – emnha
    Jan 8, 2021 at 4:52
  • $\begingroup$ @anhnha I don't have a notebook that shows that issue. Maybe it's similar to the problem I found with the large rasterized image. If you have a specific example, please edit your question, however, I suggest that problem might be a topic for a new question. $\endgroup$
    – creidhne
    Jan 8, 2021 at 5:04
  • $\begingroup$ specific example? I just copied your code above 100% to save as PDF. $\endgroup$
    – emnha
    Jan 8, 2021 at 5:07
  • $\begingroup$ my question is about saving it with screen environment as working so it should include two horizontally-aligned graphics as the working shows that? $\endgroup$
    – emnha
    Jan 8, 2021 at 5:25

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.