Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Create pdf document from graphics

  • To: mathgroup at smc.vnet.net
  • Subject: [mg86382] Re: Create pdf document from graphics
  • From: ragfield <ragfield at gmail.com>
  • Date: Mon, 10 Mar 2008 02:02:08 -0500 (EST)
  • References: <fr0crv$er9$1@smc.vnet.net>

On Mar 9, 5:06 gam, "L. Dwynn Lafleur" <lafl... at louisiana.edu> wrote:
> [$Version = 6.0 for Microsoft Windows (32-bit) (February 7, 2008) ]
>
> Is it possible to export a list of Graphics to create a PDF document in
> which each graphic appears on one page of the document?  gI tried
>
> Export["document.pdf", Table[Plot[x^n, {x, 0, 1}], {n, 1, 3}]]
>
> but got a PDF file with all three Graphics appearing as a list on a single
> page.  gI suspect I need to add an "elements" parameter to the statement, but
> I can't figure what it should be.

This is possible, but it's not as easy as it should be.  The steps are
roughly as follows:

* Put each of the graphics in a separate cell in a new notebook.
* Add a page break below each graphic cell
* Set up some printing options for that notebook.
* Depending on your OS, use the Page Setup dialog to set a custom
paper size for the notebook.
* Use NotebookPrint[] or File > Save As > PDF

Everything except for the system page setup dialog can be automated.
Here's an example:

nb = CreateDocument[
  Table[Cell[BoxData@ToBoxes[Plot[x^n, {x, 0, 1}]],
    PageBreakBelow -> True], {n, 1, 3}], ShowPageBreaks -> True,
  PrintingOptions -> {"PaperSize" -> {560, 460},
    "PageSize" -> {560, 460}, "FirstPageHeader" -> False,
    "FirstPageFooter" -> False, "RestPagesHeader" -> False,
    "RestPagesFooter" -> False}, Magnification -> 1.0]

(* at this point use the Page Setup dialog to change to a custom paper
size of 7.78" wide x 6.39" high *)

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

-Rob


  • Prev by Date: Re: Extracting the contents of tagged cells as plain text
  • Next by Date: Re: How to use Thread when second argument to function is a list
  • Previous by thread: Create pdf document from graphics
  • Next by thread: Re: Create pdf document from graphics