This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pathlib | |
import click | |
from pypdf import PdfReader, PdfWriter | |
class ScalePdfError(click.ClickException): | |
pass | |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a GNU Make file specifically designed for building PDF books from a directory of images. | |
# It can process multiple images concurrently with `make --jobs=8`. | |
# | |
# Every book is different and has different processing requirements, | |
# and it often makes sense copying this file and adapting it for an individual book. | |
# Adapting usually involves modifying in non-trivial ways the targets for the individual pages. | |
# | |
# The script builds a PDF file with a table of contents and an OCR layer. | |
# I used to build DjVu files instead because of their better image compression, but I learned that | |
# it's better to provide a PDF myself than to let people use bad converters. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/+ dub.sdl: | |
name "pointer_arithmetic" | |
+/ | |
import std.traits : isPointer, PointerTarget; | |
template IndirectionCounter(T) | |
{ | |
static if (isPointer!T) | |
enum IndirectionCounter = 1 + IndirectionCounter!(PointerTarget!T); |