I have a list, myList, of let's say 20 (different) objects
myList = Table["object", {20}]
I know would like to export every single element of myList to its own PDF page in a 20-paged PDF document; i.e., myList[[1]] comes on page 1, ..., myList[[20]] comes on page 20.
Is this possible in Mathematica? I have heard of the Export function, of course, but have not seen any way of combining 20 exports in one single document.
Answer
Vitally has the same idea, but I thought it would be a hassle to do it manually like that, so let MMA insert the page breaks:
myList = Array["object", {20}];
Table[CellPrint[{i,
Cell["", "PageBreak", PageBreakBelow -> True]}], {i, myList}]
Edit: In response to the comment,
Here we create a new notebook and set the page headers to none. Then we Paste your objects and NotebookWrite page breaks. Finally, we Export the notebook and clean up.
myList = Array["object", {20}];
report = CreateDocument[Null,
PageHeaders -> {{None, None, None}, {None, None, None}}];
Do[
Paste[report, i];
NotebookWrite[report,Cell["", "PageBreak", PageBreakBelow -> True]];
, {i, myList}]
Export["myList.pdf", report];
NotebookClose[report];
Clear[report];
Comments
Post a Comment