Ask Your Question

How to create booklet differently (stacked)?

asked 2016-07-07 11:01:46 +0100

Pedja gravatar image

I want to print user manual as booklet. I used booklet option in LibreOffice and it works as it was supposed to.

But there is a glitch.

This option assumes user wants to insert folded pages one into another forming a book. This is fine when you have to create few pages booklet.

If booklet is larger (dozen pagers or so), pages inserted in middle tend to stick out (due to paper and folding thickness), and you need some serious paper cutting to fix it.

What I would like is to print booklet in a manner that folded pages are not inserted in but stacked one on top of other.

Here is the illustration

image description

On the left is standard booklet page insertion that user must implement to make booklet. On the right is stacked booklet I would like to get. Stacked is nice and tidy and much easier to make good looking booklet in home made conditions, with no need for cutting.

I could not find any info if this alternative booklet printing is possible with LibreOffice. Hints how to achieve this would be appreciated.

edit retag flag offensive close merge delete

4 Answers

Sort by » oldest newest most voted

answered 2016-07-07 12:12:54 +0100

pierre-yves samyn gravatar image

updated 2016-07-09 08:09:24 +0100

If I understand well the only way I see is to tick FilePrintPage LayoutBrochure and print successively:

  • General tab▸Range and CopiesPages: 1-4
  • General tab▸Range and CopiesPages: 5-8



You can use a macro like:

option explicit

dim oDoc as object
dim Props(0) as New

Sub Main

dim oCursor as object
dim i as integer, iPages as integer

oDoc = thiscomponent
oCursor = oDoc.currentcontroller.viewCursor

iPages =  oCursor.getPage()

Props(0).Name = "Pages"

for i = 1 to iPages step 4
    PysPrint(i, i + 3)
next i

End Sub

sub PysPrint(PageStart, PageEnd)

Props(0).Value = PageStart & "-" & PageEnd

end sub

Note: the macro does not set the brochure parameter that must be done manually before running the macro.


edit flag offensive delete link more



I guess that would do (will try), but that is far to much manual settings as I have documents with large nmber of pages, and I would have to repeat setting each time I want to print (I do frequent updates of the documents).

I was looking for something like standard printing, just set it and run print. is it possible to create some macro that would do this?

Pedja gravatar imagePedja ( 2016-07-07 15:16:59 +0100 )edit

This macro works. There is some manual work involved but it pays of.

For some reason I could not print directly, I had to print to PDF, then merge PDF files into one and print. Using PDF is ok, since my intention is to share documents online.

Pedja gravatar imagePedja ( 2016-07-11 17:06:21 +0100 )edit

answered 2017-07-12 17:03:56 +0100

Pedja gravatar image

updated 2017-07-12 18:47:54 +0100

librebel gravatar image

I had some progress with this problem. I managed to make script that recombines pages printing order so booklet print ends up with needed result. It is not complete and easy to use but it does work.

Idea of a script is to set printing order for pages in such manner that when printer is set to print booklet order of pages in print is suitable for simple folding. Sadly, default printer has to be set specifically for this purpose each time you want to use script.

I actually gave up trying to solve this using LibreOffice and wrote standalone C# application that does this job.

If someone is interested here is code:

REM Booklet page sort 
REM by Predrag Supurovic,
REM Date: 2017-02-13
REM Reorders booklet page printing so pages are simply folded to a book.
REM Usage:
REM - Open document you want to print as booklet
REM - Select printer and setup booklet printing but do not print
REM - Run this macro to print booklet instead of usual booklet printing 
REM - As page is printed on both sites fold it adn stack adjacent pages toforma book
REM Hints: 
REM - Test with printing to PDF printer first so you can check if everything 
REM   goes as expected
REM - If you want to repeadetly print the same booklet it is better to print booklet 
REM   into PDF and then repeadetly print from that PDF

option explicit

dim mDoc as object
dim Props(0) as New

Sub Main

    dim mDocCursor as object
    dim mDocPageCount as integer
    dim mPrintPageCount as integer
    dim mBookletPages as integer
    dim i,j as integer
    dim mBookletOrder as string
    dim mBookletPage1 as integer
    dim mBookletPage2 as integer
    dim mBookletPage3 as integer
    dim mBookletPage4 as integer
    dim mPages() as integer

    mDoc = thiscomponent
    mDocCursor = mDoc.currentcontroller.viewCursor

    mDocPageCount = mDocCursor.getPage()

    mBookletPages = INT (mDocPageCount / 4)

    if ((mDocPageCount mod 4) = 0) then 

        mPrintPageCount = mBookletPages * 4

        redim mPages(mPrintPageCount) as integer

        for i = 1 to mBookletPages

            mBookletPage1 = (mBookletPages*4)-(i-1)*2
            mPages(mBookletPage1) = (i*4)

            mBookletPage2 = (i*2)-1 
            mPages(mBookletPage2) = (i*4)-3

            mBookletPage3 = i*2
            mPages(mBookletPage3) = (i*4)-2

            mBookletPage4 = (mBookletPages*4)-(i-1)*2-1     
            mPages(mBookletPage4) = (i*4)-1

        next i

        mBookletOrder = ""  
        for j = 1 to mPrintPageCount

            if mBookletOrder <> "" then
                mBookletOrder = mBookletOrder + ", "

            mBookletOrder = mBookletOrder & mPages(j)

        next j

        Props(0).Name = "Pages" 
        Props(0).Value = mBookletOrder 
        mBookletPages = mBookletPages + 1
        msgbox ("Document contains " & mDocPageCount & " pages. " &  (mBookletPages)*4 & " pages are required for booklet print." & chr(13) & "Printing aborted!", 0, "Booklet printing error")

end Sub
edit flag offensive delete link more


Sorry for the formatting. Site editor is very limited and refuses to format code properly (or I am too dumb to use it).

Pedja gravatar imagePedja ( 2017-07-12 17:05:17 +0100 )edit

reformatted, +1 for added functionality

librebel gravatar imagelibrebel ( 2017-07-12 18:54:07 +0100 )edit

answered 2016-07-09 15:33:30 +0100

Craig22 gravatar image


I found this extension: print-brochure-for-writer

Maybe this is you are looking for.

I didn't try it.


edit flag offensive delete link more

answered 2016-07-11 12:20:43 +0100

Lupp gravatar image

updated 2016-07-12 10:57:36 +0100

(Deleted by the author; bad advice)

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2016-07-07 11:01:46 +0100

Seen: 521 times

Last updated: Jul 12 '17