Giter VIP home page Giter VIP logo

hornpenguin / booklet Goto Github PK

View Code? Open in Web Editor NEW
22.0 0.0 2.0 477.32 MB

Making Booklet file from your own PDF

Home Page: https://docs.hornpenguin.com/projects/booklet/en/latest/index.html

License: BSD 3-Clause "New" or "Revised" License

Python 53.93% Tcl 4.82% Jupyter Notebook 40.91% Makefile 0.15% Batchfile 0.18%
book bookbinding signatures booklet booklet-format pdf pdf-service gui python section

booklet's Introduction

HornPenguin Booklet

Version 0.0.2

HornPenguin Booklet is a simple software generating booklet and signature for bookbinding from your pdf files. You can print your own book signatures and simple pamplet with your home printer.

  • Support diffence signature size from 4 to 32.
  • Imposition layouts are supported for each type of signature.
  • Change page size during generating signature.
  • Left riffling direction is supported for old asian bookbinding.
  • Printing markers; trim, CMYK, signature proof, ... .

See further details and usage examples in project documents.

Download HornPenguin Booklet

Quick Usage

See detailed descriptions in Documentation

Execution

The executable files are in dist directory.

There are two options onefile execution file and the compressed onedir file. The project supports for Windows, Linux, and OSX. You must notice that the onefile files requires some time to execute at initial stage. To inform the executation, there is a splash window in the each onefile files, thanks to splash routine in pyinstaller.

pip install pyinstaller

and execute the build.py. The file would automatically generate executable file and the documentations.

  • Windows

    booklet.exe # console program
    bbokletw.exe # GUI program
    
  • Linux

    booklet # console program
    bbokletw # GUI program
    
  • OSX

    No, but you can excute python source code.

or you can directly execute main.py or mainw.py with your python environment. Just check the prerequists in Dependencies section. It is recommended if there are some errors in the execution files or you are using OSX. (I don't have Mac yet.)

UI

Dependencies

Install them with next command

pip install PyPDF2 reportlab Pillow pdf2image simpleaudio

For simpleaudio, it requires compilers, build tools and prerequest library libasound2-dev to install the module. If you are using Ubuntu you can install build-essential from repository.

sudo apt install build-essential libasound2-dev

Contribution

See guides and rules in Developer guide document

Further routines

Further routines for next version

Simple

  • Add more color markers - Done
  • Precious setting of rectangle object -Done

Little troublesome

  • Converting PDF with image before transformation.(some pdfs are broken in their fonts or positions of elements during transformation) -Done Additional libraries are too heavy...

Annoying

  1. Dealing multiple PDFs at once.
  2. PDF preview for original and signature(UI.... :<).

License

This program distributed under BSD 3-clause license See detail license text in LICENSE file in repository.

booklet's People

Contributors

hyunseong-kim avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

rickbgs pau1ie

booklet's Issues

Collection mark for inserted paper sections

Collection mark is supported to identifying sections in collection.
If one section is composed of multiple inserted sub sections, the primary section, wihch is visible section from back, section is the only one get collection mark.
However, inserted sections must have an order identifiers not to be confused other subsections in gathering process.

TODO

  • Add sub collection marks for each inserted sections.
    • Design indicator shape.

Full Imposition Support algorithm development

Current

v 0.0.2
Current imposition routine

  • Standard imposition, $2^n$ leaves : Generation algorithm is implemented
  • 6, 12 leaves : Supported as pefixed setting

Further Plan

For perpendicular and parallel creasing patterns of paper, its right order layout algorithm will be implemneted.
Thus, all kinds of sections folding types will be supported if they are possible, physically.

Review of previous studies

Determining such works are proved as NP-Hard problem if we started from creasing pattern of the paper.
Without loss of generality, we will start from fold sequence. It is not only enough for representing all types of section folding, at least equivalent, moreover, this makes us to avoid such NP-Hard probelm in implmentation and to focus on real layout algorithm development.

Resources

  • Y Jia, J Mitani, R Uehara, 2020, Valid orderings of layers when simple-folding a map, Journal of Inofrmation Processing.
  • Erik D. Demaine, Joseph O'Rourke, Geometric Folding Algorthms: Linkages, Origami, Polyhedra, Cambridge University Press, 2007.
  • Lang, Robert J, Twists, tilings, and tessellations : mathematical methods for geometric origami

Repeating imposition

Current Imposition routines is aming to be used in bookbinding or pamplet printing.
However, repeated imposition is widely used in printing, for example, business card prinitng.

Features

  • Modifying gaps in x and y direction each.
  • Fit to frame or expand whole pages to cover repeated contents
  • Find full cover layout calculation.

UI improvement with progress bar

Version 0.0.1 has a progress bar routine in GUI mode but it is deprecated after 0.0.2, since there was lots of changes in structure.
New progress routines is needed for better user experience but, it does not need to be same with previous one.

Improved version will be more represent the full routines of Project and can visually show step by step progress of manuscript.
It will show pipe filter activation, deactivation and selected filters in setting.

Requirements load and save routines

Processing works of document require various settings for each steps of work.
Save and load requirements setting could prevent tedious typing works for users.

Jobs:

  • Choose requirements file format
  • Routine001: Converts to UI variables and displaying
  • Routine002: Converts UI settings to requirements settings
  • Routines003: Parsing requirements arguments to CLI

Setting file exporting and importing routines

Settings for converting are very large, so it is imposible for users to type all the setting by typing on console terminal.
Including
Yaml file will be applicable for srtting format.

Features

  • GUI: Export, import settings.
  • CUI: Add export setting in state and importing setting routine add.

Note utils

It will be implemented with Template class

Needed features

  • Manuscript expanding: 1/ 2 pages to the given number of pages
  • Header, Footer text add:
    • Page numbering: Each pages, only odd, or even, count all but note only odd or even ...
    • Indicating header-header, footer footer, header/footer alternatively per each 2 pags.
    • Align contents, if overlapped with numbering how can we set orders?

Requiring features: Text width calculation for the given string in pdf.

Done

Basic interface design is done

    Note Mode : On/Off
    Note Pages: Total number of Note <- Must be a multiple of 4
    Page numbering: 
      None, 
      {[Header, Footer], [HF, FH]}, 
      [Both, ODD(n), ODD(y), EVEN(n), EVEN(y)], 
      {[L ,R ,C], [LR, LL, LC, RR, RL ,RC, CC, CR, CL]}
    Header: None, [Both, Odd, Even], [Align], size, repeat by
    Footer: None, [Both, Odd, Even], [Align], size, repeat by

Remains

All

Measuring text width per given height and string

Text width measuring

In writing texts in template pdf file, its precise dimension is required before applying to real pdf page.
Overlapping objects on result pdf could not be desired result for all situations.
Now its routine is only required by Note utils but further routines would require this feature.

Previous works

Using Pillow's text string method is popular on stackoverflow and the other sites.

  • Help me

I implmented prototype version and tested it but pts and point conversion has an issue.

from PIL import Image, ImageDraw, ImageFont
def get_text_dim(string, font_file: str, size):
    im_width = len(string) * size
    im_height = size
    bg_color = (0, 0, 0)

    # Generate string as image
    im = Image.new("RGB", (im_width, im_height), bg_color)
    draw = ImageDraw.Draw(im)
    font_PIL = ImageFont.truetype(font_file, size)
    draw.text((0, 0), string, font=font_PIL, fill=(255, 255, 255))
    bbox = im.getbbox()  # left, upper, right, and lower pixel coordinate

    width = bbox[2] + bbox[0]
    height = bbox[3] + int(bbox[1] / 2)
    return width, height

Others

Done

  • Basic font routines are implemented:
    • Load system fonts
    • points <-> pixel conversion for general setting.

Remains

  • Fonts routine wapper class implement compatible with fonttools library.
  • Measuring dpi for reportlab pdfgen routine.
  • Write width measuring based on reportlab routines.

Multi-language support

Default language is English now but, maybe it will be wise to save all texts in UI as seperate resources to add translation.

Support for duplex printer

Duplex printer

The duplex printer printing contents on both side per each page.
It depends on printing devices but, the duplex printing does not perfectly fit.
Considering rotation during printing, rotatting even pages with $180^{\circ}$ angle is commonly supported.
However, addtional transformations, translation and rotation are required for perfect fitting of printing.
In addition, new printing mark is needed for measuing geometrical inbalance of front and back contents.

Done

  • New duplex measuring marker routine is implemented in PrintingMark class.
  • New converter class Duplex is implemented.

Remains

  • UIs need to be updated for using new features
  • Documentation of Duplex routine

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.