• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Need a small program for Page Order Calculator

 
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm using the following web-sites for page order calculation

http://boooks.org/index.php?page=21&lng=1
https://www.gerv.net/software/booklet/  

Can someone help me with a sample java program to achieve via Java ?

Basically i will feed the number of pages in the book, it has to give me the booklet page order.......

Thanks.
 
Marshal
Posts: 69411
276
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you work out the algorithm for the order of pages? That is the hard part.
 
Sheriff
Posts: 7108
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you print on both sides of the paper?
 
Joseph Michael
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Option #1 - yes, Both sides of the Paper
Option #2 - No, single side of the Paper

Looking for a standalone swing program UI to accept input in text box and print the values like in the web...
 
Marshal
Posts: 25594
69
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Joseph Michael wrote:Looking for a standalone swing program UI to accept input in text box and print the values like in the web...



Well, I'm sure you could get somebody to write you a small Swing program to do that. As for the algorithm to order the pages, you can see a JavaScript version in the www.gerv.net version's page source.
 
Joseph Michael
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible for you to explain the javascript??? Is it possible for you to conver the javascript to java with standalone program ?
 
Paul Clapham
Marshal
Posts: 25594
69
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I spent some time going through the JavaScript, I could perhaps explain it. But writing a standalone program to convert the JavaScript to Java -- it would be easier for me to just convert it myself.
 
Joseph Michael
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, Carey Brown...Want to do the exact logic in java...Want to convert it to java and display the values in text box with any Standalone UI - swing
 
Campbell Ritchie
Marshal
Posts: 69411
276
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is bound to be a mathematical theory about paper folding. If you have a 32‑page booklet, that could be one sheet folded 4×4 but some pages will be reversed and some inverted by the folding process. Do some searching for pages and printing and bookbinding.
 
Paul Clapham
Marshal
Posts: 25594
69
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:There is bound to be a mathematical theory about paper folding.



Evidently there is, as the web sites referrred to by the OP use that theory. It should not be too hard to reverse-engineer that theory by trying various inputs to either of them and observing the changes in the output.
 
Marshal
Posts: 15630
264
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The double-sided printing sequence is just (back--), (front++), (front++), (back--) until back <= front

That is, assuming you have a multiple of 4 pages (and if not, you need to add empty pages to make it so) and page numbers go from 1..N where N is a multiple of 4, the sequence is N, 1, 2, N-1, N-2, 3, 4, N-3, N-4, 5, 6, N-5, N-6, 7, 8, N-7, N-8, 9, 10, ...

For single-sided printing, you just divide the sequence into pairs and use every other pair to print the first side, turn that pile over and use all the other pairs to print the second side.
 
Campbell Ritchie
Marshal
Posts: 69411
276
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Paul Clapham wrote:. . . reverse-engineer that theory by trying various inputs . . . the changes in the output.

Or by finding a Victorian printer's manual, which will show diagrams of sheet layouts for different numbers of pages.
 
Saloon Keeper
Posts: 22112
151
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:There is bound to be a mathematical theory about paper folding. If you have a 32‑page booklet, that could be one sheet folded 4×4 but some pages will be reversed and some inverted by the folding process. Do some searching for pages and printing and bookbinding.



I think it comes under Topology. Likely a sub-topic (e. g., folding).

The fun part is that there are several different ways to print and fold a sheet of paper for bookbinding. You can see the popular ones in the dropdown list on the first link. it's actually not just a matter of page order, though, as some of the pages may have to be rendered upside down.
 
The world's cheapest jedi mind trick: "Aw c'mon, why not read this tiny ad?"
Try Free Java/.NET Libraries for Word Excel PowerPoint and PDF
htttp://www.e-iceblue.com/free-apis.html
    Bookmark Topic Watch Topic
  • New Topic