MathGroup Archive 2011

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

Search the Archive

Re: Problems Exporting to PDF

  • To: mathgroup at smc.vnet.net
  • Subject: [mg115744] Re: Problems Exporting to PDF
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Wed, 19 Jan 2011 05:31:05 -0500 (EST)

You could break it into pages

linesPerPage = 40;

grid5 = Grid[#, Frame -> All] & /@
   Partition[
    Join[
     Table[Flatten[
       {StandardForm["Question " <> ToString[n]],
        RandomInteger[{10^5, 10^8}, 5]}],
      {n, 100}],
     Table[{}, {linesPerPage - 1}]],
    linesPerPage];

Table[Export["grid5" <> "_" <> ToString[n] <> ".pdf",
  grid5[[n]]], {n, Length[grid5]}]

{"grid5_1.pdf", "grid5_2.pdf", "grid5_3.pdf"}


Bob Hanlon

---- Helen Read <readhpr at gmail.com> wrote: 

=============
I have some (lots) of rather long Grids, each of which needs to be 
exported to a .pdf. Unfortunately, the grid gets exported as a single 
page, which is a mess if you try to print it from Adobe Acrobat.

Here's a toy example to see what I am talking about. (The actual data is 
confidential results of online course evaluations for all classes taught 
in my department during the semester that just ended.)

SetDirectory[NotebookDirectory[]];

grid5 = Grid[
   Table[Flatten[{"Question " <> ToString[n],
      RandomInteger[{10^5, 10^8}, 5]}], {n, 100}], Frame -> All];

Export["grid5.pdf", grid5]

It doesn't look to awful just reading it in Adobe Acrobat, but go to 
print and check out the preview. It's a wreck no matter what you choose 
for the Page Scaling.

Is there any way to force page breaks in the exported .pdf? I couldn't 
find anything of help in the Documentation for Export.

So I finally resorted to the following.

grid6 = Grid[
   Table[Flatten[{OutputForm["Question " <> ToString[n]],
      RandomInteger[{10^5, 10^8}, 5]}], {n, 100}], Frame -> All];

path = Directory[];

nb5 = CreateDocument[grid5, PageBreakWithin -> True, Visible -> False];
NotebookPrint[nb5, path <> "\\nb5.pdf"]

This is better, and looks pretty reasonable for this example, but when 
we were working with the actual data this afternoon, pages were breaking 
in the middle of a line of a row. The last row of text and data on page 
1 was cut in half, printing half on one page and half on the next 
(breaking right in the middle of the characters).

Also, a couple of oddities:

1. Without putting OutputForm[] around the strings, they print with 
quotes around them.

2. No idea where the .pdf goes from NotebookPrint if the full path isn't 
specified. It didn't go to the directory that was set, nor to 
$UserBaseDirectory, nor anywhere else that I looked.

-- 
Helen Read
University of Vermont




  • Prev by Date: Re: Problems Exporting to PDF
  • Next by Date: Re: SetOptions does not work with Grid
  • Previous by thread: Re: Problems Exporting to PDF
  • Next by thread: Re: Problems Exporting to PDF