Message Boards Message Boards

How to insert pagebreaks when exporting a List to .pdf file?

Posted 10 months ago

I'd like to create some multi-page .pdf files containing long tables of text with graphs. These will be supplemental files in a publication. Here is a model of my data:

(* writes single page .pdf file *)
myTable = (Row[{"description", MatrixForm[GraphDistanceMatrix[#]], #},
       Spacer[12]] & /@ GraphData["HeawoodGraph", "Graph", "All"]);
myPDF = FileNameJoin[{$HomeDirectory, "Desktop", "myTable.pdf"}];
Export[myPDF, myTable];
POSTED BY: Richard Frost
9 Replies

Try printing the output cell to pdf from the Front End.

POSTED BY: Gianluca Gorni

To eliminate manual processing, I would need to write the List to a Cell and then Export the Cell to a file. Do you have a working example that produces multi-page output?

POSTED BY: Richard Frost
Posted 10 months ago

The attached pdf is multipage. Got it by evaluating myTable in a blank notebook. Deleted the input cell, and did set the notebook option ShowCellLabel to False. Then saved the notebook as a pdf.

Attachments:
POSTED BY: Hans Milton

Maybe you can send the output to a blank notebook and print that?

POSTED BY: Gianluca Gorni

The cell option PageBreakWithin -> True may play a role.

POSTED BY: Gianluca Gorni

Thank Hans, but I need a solution relying only on Wolfram Language. The manual steps you describe will become too tedious for the number of documents I need to produce.

POSTED BY: Richard Frost

How is that done?

POSTED BY: Richard Frost
Posted 10 months ago

Here is a way that reduces, but does not eliminate, the need for manual actions:

myTable = Column[
  Row[{"description", MatrixForm[GraphDistanceMatrix[#]], #},Spacer[12]] & /@ GraphData["HeawoodGraph", "Graph", "All"],
  Automatic,1
];
myPDF=FileNameJoin[{$HomeDirectory, "Desktop", "myTable"}];
FrontEndExecute[FrontEndToken[CreateDocument[myTable,NotebookFileName->myPDF],"SaveRename"]]
POSTED BY: Hans Milton

Here's what I gather from the discussion so far

  • There's no guide for application of Cell page break options
  • A notebook is a terminal object whose container is a file

True or False?

POSTED BY: Richard Frost
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract