Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is it somehow possible to "zoom out" a multi-page PDF to fit all pages to one via command line (must work under Linux)

e.g. I have a PDF generated with XSL:FO/FOP with a table (the red one in the picture) which spreads over 3 pages. But I want to have it automically resized to one page (see the right page on the picture) So I don't want a "matrix" of pages, like you can select when you print multiple pages, but automatically resized

edit: Even better would be automatically fit the table to one page with xsl:fo if that's easier

[picture](http://www.tinyimage.de/jpeg.php?img_id=391137)

share|improve this question
1  
Have you thought about not using PDF, a format for print documents? –  Daniel Beck Aug 10 '12 at 13:50
    
Your question is unclear. You say you want to make all the pages fit on one physical page, but then you say you don't want a "matrix" of pages like printing 2 or 4 pages to one sheet of paper. So what DO you want? I don't understand what you want the output to be. –  ÃŁŁǫǛȉЖΦΤїҪ Aug 10 '12 at 13:53
    
@allquixotic: look at the (awfull, I know) picture. I want multipe pages printed to one page but below each other withou borders or paddings.... –  stwagner Aug 10 '12 at 13:59
    
@allquixotic: I think what he wants is, he wishes to merge the tables from multiple pages into one page with smaller font size. I am not sure if this can be done –  darnir Aug 10 '12 at 13:59
add comment

3 Answers 3

up vote 0 down vote accepted

Just a guess... Try setting the page size very large in the vertical direction (eg. 8.5" x 33") so everything fits onto one page. Then when you print, you can choose your printer's scale-to-fit option to get the page on single sheet of standard paper. You're likely to get unreadable text this way though.

[Added] A more complex method would be to render twice. Once to get the number of pages and again to get the final result on one appropriately sized page. You may also need to account for header/footer size when computing the ideal page height.

((number-of-pages * (standard-page-height - header-height - footer-height)) + header-height + footer-height)
share|improve this answer
    
yeah, I thought about that too: Setting page-height in xsl:fo to a high number and printing it to a A4 PDF with "lpr -pPDF -o fit-to-page table.pdf" works good - remaining problem is, that I don't know which height to set - see my answer to @RedGrittyBrick's answer –  stwagner Aug 10 '12 at 14:27
    
just discoverd page-height="indefinite" which autosizes the height to fit the content - but thats not supported by fop renderes a s I read –  stwagner Aug 10 '12 at 14:32
    
If you can arrange to render twice, run the first as usual and read the number of pages from the output, then render again with number-of-pages * 11" (or whatever). –  Chris Nava Aug 10 '12 at 15:41
    
You may need to make the computation a bit more complex to account for header/footers. ((number-of-pages * (11 - header-height - footer-height)) + header-height + footer-height) –  Chris Nava Aug 10 '12 at 15:44
add comment

No, general purpose PDF (or PS) tools (e.g. pdftk, psutils) don't offer this capability - I guess for a number of reasons

Most PDFs are created for pages with a width-to-height ratio close to that of A4 or Letter-sized paper. Simply placing three pages in a vertical arrangement would leave excessively large empty margins to left an/or right of the text. There is also the distraction of repeated headers and footers. Because PDF is a final format based on drawing specified shapes at specified coordinates, it isn't possible to re-flow text and other objects in arbitrary PDF files.

Can you set your tools to use a smaller font size?

share|improve this answer
    
because I don't now how long the table will be - I could guess or calculate the height using the number of characters and rows used, but that would be a very unreliable solution I think –  stwagner Aug 10 '12 at 14:03
    
PDF is the wrong format for this, use HTML or some other non-page oriented format. Perhaps XML+XSL - most browsers support XSL I think. –  RedGrittyBrick Aug 10 '12 at 14:05
    
unfortunately it has to be a PDF in the end - without a person printing it to PDF via browser. Currently I'm using wkhtmltopdf with autozooming with javascript, but that produced very bad looking PDFs (e.g. thin borders are destroyed or not shown anymore) –  stwagner Aug 10 '12 at 14:08
add comment

No.. as far as I know, you cannot accomplish what you seek.

You want to read and merge the tables into one sheet.

However, sometimes the application will allow you to create what you are looking for. Check print properties, page layout, etc those kind of options. I don't know much about XSL so can't comment if it is possible for you. However, I did do exactly what you are asking for from LibreOffice Calc and MS Excel recently. However, it is not recommended you do this.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.