Is there a way to force a certain block of captured output to fit onto a single printed page, where one can specify the properties of the page (dimensions, margins, etc)? For example, I might want to generate 10 different cuts of a data table and then capture all the output into a PDF, ensuring that each run of the data table fits onto a single page (i.e. the font-size of the output may have to be dynamically adjusted). Thanks, Abiel This communication is for informational purposes only. It is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction. All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice. Any comments or statements made herein do not necessarily reflect those of JPMorgan Chase & Co., its subsidiaries and affiliates. This transmission may contain information that is privileged, confidential, legally privileged, and/or exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. Although this transmission and any attachments are believed to be free of any virus or other defect that might affect any computer system into which it is received and opened, it is the responsibility of the recipient to ensure that it is virus free and no responsibility is accepted by JPMorgan Chase & Co., its subsidiaries and affiliates, as applicable, for any loss or damage arising in any way from its use. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format. Thank you. Please refer to http://www.jpmorgan.com/pages/disclosures for disclosures relating to European legal entities.
On 05/05/2010 12:12 AM, Abiel X Reinhart wrote:> Is there a way to force a certain block of captured output to fit onto a single printed page, where one can specify the properties of the page (dimensions, margins, etc)? For example, I might want to generate 10 different cuts of a data table and then capture all the output into a PDF, ensuring that each run of the data table fits onto a single page (i.e. the font-size of the output may have to be dynamically adjusted). >Hi Abiel, One way that comes to mind is to display the block of text on a graphics device like postscript. First open the postscript device and create an empty plot: # notice how culturally sensitive I am, using "letter" size paper! postscript("mytext.ps",width=8.5,height=11) # set the margins to zero or something narrow par(mar=c(0,0,0,0)) plot(0,xlab="",ylab="",xlim=c(0,1),ylim=c(0,1),type="n",axes=FALSE) Then work out whether your block of text will fit into the plot: blockwidth<-strwidth(mytextblock) blockheight<-strheight(mytextblock) # this should get the reduction (or expansion) to make it fit cexmult<-1/max(c(blockwidth,blockheight) text(0.5,0.5,mytextblock,cex=cexmult) This is off the top of my head (which is a bit dented at the moment) so you might want to try it out first. Jim