Re: Problems Exporting to PDF
- To: mathgroup at smc.vnet.net
- Subject: [mg115861] Re: Problems Exporting to PDF
- From: Helen Read <readhpr at gmail.com>
- Date: Sun, 23 Jan 2011 05:35:26 -0500 (EST)
- References: <ih3rcl$bg5$1@smc.vnet.net> <ih6ebf$3dt$1@smc.vnet.net>
On 1/19/2011 5:27 AM, Armand Tamzarian wrote: > On Jan 18, 9:52 pm, Helen Read<read... 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 > > > I guess you aren't on a Mac? I only ever use the system Save To PDF or > Acrobat for creating PDFs. They both work - do what they say on the > packet -- without aggravation. Other options such as printing to PDFCreator would have worked just fine (I tried it on one of them), except that we had about 150 of these to process, hence the need to convert each of them to PDF from within Mathematica itself in an automated way. We ended up splitting the results for each class section into several smaller grids, one for the tabulated numerical results of the multiple choice questions, and a separate grid for each of the free response questions ("What did you most like about the instructor" etc.). We used CreateDocument (each grid in its own cell) with PageBreakWithin -> True, Visible -> False followed by NotebookPrint (to a .pdf). (Then SendMail to send the .pdf to the corresponding instructor.) We might have been able to improve the formatting slightly if we had more time, but what we ended up with was good enough. Still, it would be nice if Export to .pdf worked better (and had, at the very least, an option to make it put in page breaks). -- Helen Read University of Vermont