Page 1 of 1

joinpdf: merge images with different extensions in one pdf

Posted: 17 Jan 2015, 17:24
by dingodog
I discovered some time ago this interesting page:
http://onetransistor.blogspot.it/2014/1 ... -size.html

regarding book scanning workflows

this page contained a snippet of C code based on leptonica library that makes able to build a binary utility able to merge together into ine pdf, files with different extension at once

Code: Select all

#include <leptonica/allheaders.h>
#include <stdio.h>

int main(int argc, char *argv[]){
    if (argc < 3) {
        printf("Not enough arguments specified!\njoinpdf <input_folder> <output_pdf>\n");
        exit(1);
        }
    if (argc > 3) printf ("Too many arguments!\nOnly the first two will be taken into account.\n");

    int r = convertFilesToPdf(argv[1], NULL, 0, 1, 0, 0, NULL, argv[2]);
    if (r == 0) printf ("%s successfully written!\n", argv[2]);
    else printf("Conversion failed");
}

for people unable to compile I compiled a binary (made portable with magicermine that I own a pro license) that hopefully is working into any linux environment that i attach to my post on forum

joinpdf-portable
md5sum
6a30df415fbc87ecc7fc2d56d9704ad0 joinpdf-portable.bz2
sha1
0ccbe40235120843318e72538344d19848eff637 joinpdf-portable.bz2

I compiled leptonica library with

jpeg, png, gif, tiff, jpeg-2000 support (via openjpeg2)

so my binary is able to put all these file extension in a pdf

syntax:

Code: Select all

joinpdf <input_folder> <output_pdf>