6
$\begingroup$

I have created a dashboard that looks fine on my screen and fits onto my screen at 100% magnification on Mathematica. When I try printing it, no matter what printing environment I use, I can not get it to print what is on the screen on a single or two consecutive A4 pages. Depending on the printing environment selected, it prints out either some of the page but not all of it, or prints out the page magnified a few times so that it ends up taking up about 8 A4 pages. When I click on Page Setup, nothing happens. I have also tried exporting to PDF first but the export ends up looking exactly as the printed version did.

Here is the code:

--Some functions

GraphHeading[GraphLabel_] := 
  TextCell[GraphLabel, FontWeight -> Bold, FontFamily -> "Helvetica"];
DropDownBoxHeading[BoxHeading_] := 
  TextCell[BoxHeading, FontWeight -> Bold, FontFamily -> "Helvetica"];

--Some Definitions

Tab3DropDownOpUSelection = "Haul Trucks";
Tab3DropDownMetricSelection = "Fuel";
Tab3DropDownOperationalUnit = 
  PopupMenu[
   Dynamic[Tab3DropDownOpUSelection], {"Haul Trucks", "Loaders", 
    "Haul Trucks and Loaders", ""}];
Tab3DropDownMetric = 
  PopupMenu[
   Dynamic[Tab3DropDownMetricSelection], {"Fuel", "Costs", 
    "Consumption Index", "Cost per Tonne"}];
Tab3MetricList = {"Fuel", "Costs", "Consumption Index", 
   "Cost per Tonne"};

--Some things to display

Tab3Graph := 
 Dynamic[ListLinePlot[{{{1, 0.96`}, {2, 0.6900000000000001`}, {3, 
      1.11`}, {4, 1.`}, {5, 1.3900000000000001`}, {6, 
      1.1500000000000001`}, {7, 1.3800000000000001`}, {8, 1.51`}, {9, 
      1.1500000000000001`}, {10, 0.51`}}, {{1, 1.06`}, {2, 0.75`}, {3,
       1.22`}, {4, 1.1`}, {5, 1.53`}, {6, 1.27`}, {7, 1.52`}, {8, 
      1.6600000000000001`}, {9, 1.27`}, {10, 0.56`}}}, 
   PlotMarkers -> Automatic, 
   PlotRange -> {{1, 10}, {0, 1.8260000000000003`}}, 
   AxesOrigin -> {1, Automatic}, 
   Frame -> {{True, False}, {True, False}}, 
   PlotLabel -> "Haul Truck Fuel", 
   FrameLabel -> {"Week", "Litres", "", ""}, AspectRatio -> 1/3.5, 
   ImageSize -> {800, 300}, PlotStyle -> {Black, Black}]]
Tab3Stats1Table := 
 Grid[{{"Metric", "Unit", 1, 2, 3, 4, 5, 6, 7, 8, 9, 
    10}, {"Predicted Fuel", "Mlitres", 1.01`, 0.72`, 1.16`, 1.05`, 
    1.46`, 1.21`, 1.45`, 1.58`, 1.21`, 
    0.53`}, {"Upper Predicted Fuel", "Mlitres", 1.06`, 0.75`, 1.22`, 
    1.1`, 1.53`, 1.27`, 1.52`, 1.660000, 1.27`, 
    0.56`}, {"Lower Predicted Fuel", "Mlitres", 0.96, 0.6900000, 
    1.11`, 1.`, 1.3900, 1.1500, 1.38000, 1.51`, 1.15000, 
    0.51`}, {"Material Handled", "Mtonnes", 3.29`, 2.39`, 3.83`, 
    3.14`, 4.`, 3.2600000000000002`, 3.81`, 4.21`, 3.12`, 1.42`}}, 
  Alignment -> Left, 
  Dividers -> {{Black, Black, Black, Gray, Gray, Gray, Gray, Gray, 
     Gray, Gray, Gray, Gray, Gray, Gray, Black}, {Black, Black, Gray, 
     Gray, Gray, Gray, Gray, Black}}]

--Putting it all together

Tab3 := Column[{Row[{GraphHeading["Most Recent Update Week is Week "],
       GraphHeading[10], " - ", GraphHeading[2013]}], 
    Column[{Grid[{{"Operational Unit", 
         "Metric"}, {Tab3DropDownOperationalUnit, 
         Tab3DropDownMetric,}}, Alignment -> Left], Tab3Graph, 
      Tab3Graph, Tab3Graph, 
      Grid[{{"         "}, {"Totals for Selected Week"}, {Dynamic[
          Tab3Stats1Table]}, {"           "}}, 
       Alignment -> {Left, Top}], 
      Column[{"Weekly Measures", Dynamic[Tab3Stats1Table]}]}]}, 
   Alignment -> Center];

--Use this to generate what is to be display and then hide the code and simply try to print the display.

Dynamic[Tab3]
$\endgroup$
6
  • $\begingroup$ It is hard to be specific without some example code, but you could try displaying the ruler to give you an idea of what paper size relates to your screen area, Window-> Show Ruler. Does what you see with File->Print Preview correlate with what is actually printed ? $\endgroup$ Jan 9, 2013 at 9:23
  • $\begingroup$ @image_doctor I can't find File->Print Preview in MMA 9 for Mac. $\endgroup$
    – Murta
    Jan 9, 2013 at 9:48
  • $\begingroup$ @Murta That would be File->Print...->Preview for Mac V9 $\endgroup$ Jan 9, 2013 at 10:04
  • $\begingroup$ I added the example code into the question. Yes, what is actually printed is the same as what is displayed via print preview. $\endgroup$
    – lara
    Jan 9, 2013 at 10:33
  • 1
    $\begingroup$ @LaraJordan On linux, V8, I adjusted the size of the output cells to be within the 8" margins of an A4 page (the tables overran a couple of inches), and Print->Preview placed them sensibly within the boundaries of the page. $\endgroup$ Jan 9, 2013 at 12:29

1 Answer 1

4
$\begingroup$

Initially I used the method near the bottom of this answer which was a lot of effort but did work. I have now come up with a better method.

New Method: I create whatever size pages I want in my notebook and can use this better method to get a proper printout and properly scaled pdf document. I simply create a Column (in the example below this column is called "Printable") consisting of all of the pages of my dashboard. I then create a document containing that column and then save the document as an html file with two commands combined into one:

NotebookSave[CreateDocument[{Printable}]]

Executing the above command open a SaveAs dialgo box - be sure to save the file type as html. Once I have my html file I can open it and go to print preview and use the Scale and Layout options of my browser to get what was in my notebook to fit onto as many pages as I like. I can then print to paper or print to pdf from the browser with a few clicks of a button rather than re-format my entire dashboard to fit the page margains of an A4 page within my notebook.

Browser Print Preview menu bar with Scaling and Layout options shown

Old Method: I ended up adding a ruler to my page and ensuring that everything fell inside of the A4 size margains. I then created a variable that consisted of a column of all my dashboard pages and some appropriately placed page breaks.

  PrintableVersion := Column[{IntroPage, Column[{Tab4, 
     Button[Style["Recalculate", FontSize -> 10], RecalcFunction, 
      Method -> "Queued"], PrintButton}], PageBreak, Tab2, PageBreak, 
   Tab3}]

I created a Print button using the Button function and the NotebookPrint function.

    PrintButton := Button[Style["Print", FontSize -> 10], NotebookPrint[PrintableVersion]]

All the dashboard pages printed properly when I pressed this Print button but there were a few strange formatting issues - for example each time I had used the PageBreak in the column it had printed on the printout as "PageBreak". But it is better than nothing.

$\endgroup$

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.