Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Multiple PDF Pages using Export

284 views
Skip to first unread message

djo...@comcast.net

unread,
Jan 19, 2009, 2:59:38 AM1/19/09
to
Hi All!

I'm interested in generating one PDF graphic per page as in

fourpages=Table[Graphics[Circle[], ImageSize -> {s, s}], {s, 100, 200, 25}]

followed by something like

Export["file.pdf", Table[{Page[i] -> fourcircles[[i]]}, {i, 1, 4}], "PDF"]

Without the nonexistent function Page[i], i.e., just fourcircles[[i]], the
four images are horizontally juxtaposed in the same page and not
on separate pages.

Another words, one table[[i]] graphic per one PDF page for four pages.

Thanks in advance!

Don J. Orser

Scot T. Martin

unread,
Jan 20, 2009, 5:45:55 AM1/20/09
to
Don, I don't think the functionality you want exists. I hope someone
writes and explains that I'm wrong because I also export directly to PDF
for my applications. I think I read somewhere that Mathematica only
supports single page export in PDF (can't find it now) and this is indeed
my experience.

What do I do?

I write 4 PDF files and then use the Adobe Acrobat "assemble into a single
PDF" option.

ragfield

unread,
Jan 20, 2009, 5:44:29 AM1/20/09
to
On Jan 19, 1:59 am, djor...@comcast.net wrote:
> I'm interested in generating one PDF graphic per page as in
>
> fourpages=Table[Graphics[Circle[], ImageSize -> {s, s}], {s, 100, 200, =

25}]
>
> followed by something like
>
> Export["file.pdf", Table[{Page[i] -> fourcircles[[i]]}, {i, 1, 4}], "PDF"=
]
>
> Without the nonexistent function Page[i], i.e., just fourcircles[[i]], th=
e

> four images are horizontally juxtaposed in the same page and not
> on separate pages.
>
> Another words, one table[[i]] graphic per one PDF page for four pages.

Mathematica doesn't currently support multiple PDF pages through the
Export[] function. The only way to get this behavior is to use
NotebookPrint[], which has it's own limitations. Try something like
this:

nb = NotebookPut@
Notebook[Cell[BoxDataBox@ToBoxes@#, PageBreakBelow -> True] & /@
fourpages,
PageHeaders -> {{None, None, None}, {None, None, None}},
PageFooters -> {{None, None, None}, {None, None, None}}]

NotebookPrint[nb, "/tmp/a.pdf"]

-Rob

Murray Eisenberg

unread,
Jan 21, 2009, 6:50:29 AM1/21/09
to
File > SaveAs offers the choice to save the notebook in PDF, and does
so, even with many pages.

Scot T. Martin wrote:
> Don, I don't think the functionality you want exists. I hope someone
> writes and explains that I'm wrong because I also export directly to PDF
> for my applications. I think I read somewhere that Mathematica only
> supports single page export in PDF (can't find it now) and this is indeed
> my experience.
>
> What do I do?
>
> I write 4 PDF files and then use the Adobe Acrobat "assemble into a single
> PDF" option.
>
>
>
> On Mon, 19 Jan 2009, djo...@comcast.net wrote:
>
>> Hi All!
>>

>> I'm interested in generating one PDF graphic per page as in
>>

>> fourpages=Table[Graphics[Circle[], ImageSize -> {s, s}], {s, 100, 200, 25}]
>>
>> followed by something like
>>
>> Export["file.pdf", Table[{Page[i] -> fourcircles[[i]]}, {i, 1, 4}], "PDF"]
>>
>> Without the nonexistent function Page[i], i.e., just fourcircles[[i]], the


>> four images are horizontally juxtaposed in the same page and not
>> on separate pages.
>>
>> Another words, one table[[i]] graphic per one PDF page for four pages.
>>

>> Thanks in advance!
>>
>> Don J. Orser
>>
>

--
Murray Eisenberg mur...@math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower phone 413 549-1020 (H)
University of Massachusetts 413 545-2859 (W)
710 North Pleasant Street fax 413 545-1801
Amherst, MA 01003-9305

dange...@gmail.com

unread,
Jan 22, 2009, 7:01:08 AM1/22/09
to
On Jan 20, 2:45 am, "Scot T. Martin" <smar...@deas.harvard.edu> wrote:
> Don, I don't think the functionality you want exists. I hope someone
> writes and explains that I'm wrong because I also export directly to PDF
> for my applications. I think I read somewhere that Mathematica only
> supports single page export in PDF (can't find it now) and this is indeed
> my experience.
>
> What do I do?
>
> I write 4 PDF files and then use the Adobe Acrobat "assemble into a singl=
e
> PDF" option.

>
> On Mon, 19 Jan 2009, djor...@comcast.net wrote:
> > Hi All!
>
> > I'm interested in generating one PDF graphic per page as in
>
> > fourpages=Table[Graphics[Circle[], ImageSize -> {s, s}], {s, 100, 200=

, 25}]
>
> > followed by something like
>
> > Export["file.pdf", Table[{Page[i] -> fourcircles[[i]]}, {i, 1, 4}], "PD=
F"]
>
> > Without the nonexistent function Page[i], i.e., just fourcircles[[i]], =

the
> > four images are horizontally juxtaposed in the same page and not
> > on separate pages.
>
> > Another words, one table[[i]] graphic per one PDF page for four pages.
>
> > Thanks in advance!
>
> > Don J. Orser

For charts I use Column[] to get two charts on a page. Something like
this:

fshow[plots_, title_] := Framed[
Show[plots, PlotLabel -> DisplayForm[
GridBox[
{
{Style[title[[1]], FontFamily -> "Helvetica", Bold, Larger]},
{Style[title[[2]], FontFamily -> "Helvetica"]},
{If[Length[title] == 3,
Style[title[[3]], FontFamily -> "Helvetica", Small], ""]}
}
]
], Background -> None
], FrameMargins -> 20, ImageMargins -> 5
];

graphs = { fshow[ a, titleLista ], fshow[ b, titleListb ], fshow[ c,
titleListc ], fshow[ d, titleListd ], };
Export[ graphPath<>title<>" 12.pdf",Column[{graphs[[1]], graphs
[[2]]}];
Export[ graphPath<>title<>" 34.pdf",Column[{graphs[[3]], graphs
[[4]]}];

For tabular data, I use CellPrint to create a cell with a page break
in the current notebook and then print to PDF from Mathematica - you
might be able to adapt this for export purposes (i.e., export a cell
to a file instead of a specific graphics object). In line, I use:

CellPrint[ Cell[ "", PageBreakBelow -> True ] ];

Hope that helps.

congruenti...@yahoo.com

unread,
Jan 22, 2009, 7:03:24 AM1/22/09
to
I would recommend what Murray says here. I do not remember the exact
option right now, but there is a CellProperty to "make page break
before/after cell". Then you should be able to get one graphic per
page.

HTH.

Regards..

Roger Williams
Franklin Laboratory

On Jan 21, 3:50 am, Murray Eisenberg <mur...@math.umass.edu> wrote:
> File > SaveAs offers the choice to save the notebook in PDF, and does
> so, even with many pages.
>

<snipped/>

0 new messages