"Convert to Page Images" and "Impose"

  • Andrew Roach

    Andrew Roach - 2004-04-04

    I have two suggestions for improvements to Multivalent. The first one concerns the "Convert to Page Images" function. This, I find handy for printing out non-interactive PDF "forms" to a bitmap, which I then put as a background in a drawing package, and type in my form data. Sounds a round-about way of doing stuff, but it is actually quite neat. My question concerns the resolution. It seems the default resolution for exporting pages is 72 dpi, which is OK, I guess, but it would be nicer if there was a way for the user to increase this at their whim. Is this possible, but not documented ?

    My second suggestion concerns the "Impose" command. It occurs to me, that with the "Impose" command, you are 75% plus of the way towards having a handy "Booklet" function. After all, that command can do the all important role of setting two pages beside each other on the one page, like a left and right page of a book. If more functionality was added to work out the correct automatic sequencing of pages, the command could be made into a booklet prepping command where the correct facing pages would be preserved in a double-sided leaf printing process.

    Best wishes,

    • Tom Phelps

      Tom Phelps - 2004-04-05

      There are plans for a zoom setting for PageImages.

      Impose can make booklets with many different folding patterns, including page sequencing and different rotations for the front and back of a piece of paper, but the layout options might get involved.  Can you draw a picture shoing the page layout and rotations for the process you mention?  If you wanted to contribute tool configurations for popular booklet formats, I'd consider bundling them for easy access within Impose.

      • ThePickle

        ThePickle - 2007-12-01

        I have been struggling with this as well.  I have a 300+ page document and wanted to reformat it for 2 sided printing with 2 pages on each: 8,1 2,7 6,3 4,5.... except for the full document.  This way, print the full book double sided, cut down the center, and bind!

        (BTW: The newest version of Adobe Reader can do this, but, it is at print time, and you have to print the full thing at one time with a printer that can do 2 sided printing.  If you check "print even pages only" to print the front then flip over, Adobe applies the "even only" it before it builds the pages so you get: 8,2 4,6.  My printer is one-side only and I do not trust it to print more then 20 pages at a time.  If I am able to get Impose to work as above, it will be much easier!).

        I have seen some other posts, but could not find a solution.

        This is a more standard page numbering and not too hard to implement, but I think it would be useful if Impose could read a sequence from a file.  This way, if someone has a real unusual layout they need to obtain on a large document, they could write a script to generate a file to describe page by page where everything goes and then feed that to impose.  It would be a simple text file and should use the same notation that -page uses.

        I did find a "work around" to get what I want in a few steps and will post it here for others:
        java -Xmx192m -classpath c:\...\mv.jar tool.pdf.Split -page odd,even%reverse org.pdf
        java -Xmx192m -classpath c:\...\mv.jar tool.pdf.Split -page even,odd,backmap org-x.pdf
        java -Xmx192m -classpath c:\...\mv.jar tool.pdf.Impose -nup 2 -paper 8.5x11in org-x-x.pdf
        java -Xmx192m -classpath c:\...\mv.jar tool.pdf.Split -page odd,even%reverse,backmap org-x-x-up.pdf

        org-x-x-up-x.pdf will then have the pages as needed:8,1 2,7 6,3 4,5 (except across the full book).  However, the original book MUST be a multiple of 4 (pages mod 4=0).  Eg: you must pad a 9 page book with 3 blank pages at the end or the output will be a mess!

        Here is an equation to find what pages go on what without using the loop method posted earlier:
        Left Half:(NumPg-(INT((PgNm-1)*0.5)*2))*MOD(PgNm,2)+(MOD(PgNm-1,2)*INT((PgNm)*0.5)*2)
        Right Half:NumPg-LhPn+1
        NumPg=Number of pages
        PgNm=Page in sequence (1=8,1 2=7,2, 3=6,3, 4=4,5)
        LhPn=Page number of Left Half


    • Andrew Roach

      Andrew Roach - 2004-04-29

      Sorry for getting back so late, but your reply didn't appear to me when I visited the forum until yesterday, despite it being posted nearly a month ago !

      Ok, if I do the command:

      java tool.pdf.Impose -dim 2x1 -paper 297x210mm docs.pdf

      I get the "layout" just as I imagine - two pages side by side on the one page, all ready for a booklet. Basically, I have effectively converted the A4 pages to A5 pages mapped them out to an A4 Landscape page. This part is great, and easy so far...

      To print as a booklet with facing pages, a little extension would need to be done, I think... I am not sure if there is a way to get this working "out of the box". Imagine there are 8 pages in the original file, which are in order. When printed using the above format of two A5 pages beside each other on a landscape A4, each physical page has two sub-pages beside each other. Each physical page is printed on both sides, so each physical page has 4 sub-pages on it (two on the front, and two on the back). For an 8 page booklet with facing pages, the page sequences have to be:

      L  R

      8  1  [physical page one, side 1]
      2  7  [physical page one, side 2]

      6  3  [physical page two, side 1]
      4  5  [physical page two, side 2]

      For a 10 page book, using the same assumptions, two blank pages are needed at the end, and three physical pages.

      L  R

      B  1  [physical page one, side 1]
      2  B  [physical page one, side 2]

      10 3 [physical page two, side 1]
      4  9  [physical page two, side 2]

      8  5 [physical page three, side 1]
      6  7 [physical page three, side 1]

      ...and so on and so on. When you take the pages, printed on both sides, and collate them, you have a book with facing pages.

      Is there any way of currently doing a layout like that easily, or would something else need be done ?


    • Tom Phelps

      Tom Phelps - 2004-05-02

      If this just a resequencing of source pages, this can be done with the -page option, as in
         -page 8,1,2,7,6,3,4,5
         -page 0,1,2,0,10,3,4,9,8,5,6,7

      Does this do it?

    • Andrew Roach

      Andrew Roach - 2004-05-03

      I tried the following:

      java tool.pdf.Impose -page 0,1,2,7,6,3,4,5 -dim 2x1 -paper 297x210mm manual.pdf

      But that didn't resequnce the pages correctly, they were sequenced 0,0;  2,3; 6,7; 4,5 with two blanks on the first page instead of 0,1 (page 1 was not printed at all).

      When I split it into two commands, for example:

      java tool.pdf .Split -page 0,1,2,7,6,3,4,5 manual.pdf

      java tool.pdf.Impose -dim 2x1 -paper 297x210mm manual-x.pdf

      I get the desired result. Pity it has to be done in to calls though, because to me, logically "java tool.pdf.Impose -page 0,1,2,7,6,3,4,5 -dim 2x1 -paper 297x210mm manual.pdf" should have worked.

      In these examples, I have worked out the page ordering manually (for a few pages it is easy, for a lot of pages, it would be "nasty"). I was wondering if an extension to -page, for example something like "-page facingbooklet" could be added as a short-hand to calculate "-page 0,1,2,0,10,3,4,9,8,5,6,7"; that would be especially useful for very large documents.


    • Tom Phelps

      Tom Phelps - 2004-05-03

      There was a bug in Impose's page indexing, which has been fixed and will be in the next version.

      I'd love to have a set of patterns like "facingbooklet".  Is there a standard set somewhere?

      • Andrew Roach

        Andrew Roach - 2004-05-06

        I do not know about any standards as such, but I have worked up a little bit of c code (sorry, I don't know java) which will calculate the sequencing of the pages, which might help a little. It assumes that the layout will be two facing pages per physical page (left and right), and two sides to each physical page (odd and even).


        int main(int argc, char *argv[])
        int i,n;
        int num_pages=atoi(argv[1]);
        int req_physical_pages, last_page, first_page=1;
        int odd_left,odd_right,even_left,even_right;




        for (n=0;n<req_physical_pages;n++)
        printf("%d %d %d %d ",(odd_left > num_pages ? 0 : odd_left),odd_right,even_left,(even_right > num_pages ? 0 : even_right));
        odd_right+=2; /* first page */



    • Chris Meyer

      Chris Meyer - 2004-05-27

      I'm willing to add this capabiltiy if I can find the source code to this project. Assuming that my other support question gets resolved and I eventually can find the source code, would the admin's accept a patch for this?

    • Tom Phelps

      Tom Phelps - 2004-05-27

      Where's your other support question?

      It would be nice to have a predefined set of popular booklet patterns, including page resequencing.  Just adding some code or making other such computations is no problem, but without a framework I fear they would amount to special cases that would be hard/lengthy to document and therefore not usable by others.

    • Chris Meyer

      Chris Meyer - 2004-06-01

      My other question was: where to find the source... it was answered already.

      As for special cases: you're correct that it may lead to a bunch of special cases. On the other hand a few popular formats such as 2-pages to a side, double-sided, and that kind of thing would still be nice. I'll just use explicit page numbering for now. It'll be kind of tedious but it will get the job done.

    • Tom Phelps

      Tom Phelps - 2004-06-02

      As I say, I'd love to see a list of popular formats.

      I think the 2-pages to a side is already covered by the -nup option.

      By double-sided printing, do you mean printing on a non-duplex printer all the front sides in reverse order, manually turning the stack of paper over, and then all the backs (possibly with an additional black page to match up with number of fronts)?  This means two PDF files, one for the fronts and one for the backs.  That sounds generally useful and it's specified at a level of detail that can be implemented.

    • Tom Phelps

      Tom Phelps - 2004-06-02

      Actually for double-sided printing on a non-duplex printer, you don't want to reverse the front sides.  I think you can already do this conveniently now:

      java tool.pdf.Impose [options] doc.pdf
      java tool.pdf.Split -pages odd doc-up.pdf
      print doc-up-x.pdf
      turn stack of printed pages upside down and resubmit to printer
      java tool.pdf.Split -pages even doc-up.pdf
      print even pages

      If there is an odd number of pages in doc.pdf and therefore one more odd page than even, the following will match the numbers:
      java tool.pdf.Split -pages even,0 doc-up.pdf

      I'll add an -doublesided option Split to generate front sides and back sides.  (Note that there is presently a bug in Split that manifests itself on PDFs without outlines; it has been fixed and will be distributed in the next version.)

      Will that do it for 2-pages to a side and double-sided?  What are some other popular formats?

    • Bill L

      Bill L - 2004-06-03

      I'd just like to chime in with a related enhancement.  When printing booklets, a common function is something that calculates "page creep."  Page creep is caused by the thickness of the paper coupled with triming the edges of the booklet.  For example, lets say I have a booklet with 20 sheets (signatures of four pages each).  When gathered, folded and stapled, the inner pages stick out at the sides further than the cover page, with each page sticking out a little further as the sheets progress to the innermost sheet.  After trimming the edges, this has the effect of making the outer margins of each page slightly shorter as we go toward the center of the book. 

      A great booklet feature would be a setting that would take into account the page thickness, probably based on the paper weight, and automatically shift the page images to compensate for creep.

      Thanks again for this great application.

    • Tom Phelps

      Tom Phelps - 2004-06-08

      Supporting page creep is a good idea.  But what is the user interface to specify it?  Impose can reorder pages, place them on a page grid in another sequence, and rotate them.  Impose doesn't know how the printed pages will be cut up or folded.  Page creep might need to be applied in different ways to different sides in increasing or decreasing amounts for every page imposed on the new page to be printed.  What should the controls look like?

    • Bill L

      Bill L - 2004-06-11

      I should think that you need to set two parameters at a minimum:

      The thickness of the sheet, probably for standard page stock weights, e.g., 60lb, 65lb, etc.  I would also specify the number of pages in either a booklet or a "gather of sgnatures" for perfect binding. 


Log in to post a comment.