fundevogel/pcbis2pdf

This package is abandoned and no longer maintained. No replacement package was suggested.

pcbis.de helper for use with DTP software

1.0.2 2019-05-11 23:03 UTC

This package is auto-updated.

Last update: 2021-03-12 03:49:21 UTC


README

Release License Issues Status

What

This small library powers our example workflow for collecting information from CSV files, exported from pcbis.de, and gathering some more through wholesale book distributor KNV's API (with built-in Google Books API & OpenLibrary Books API support). For the documentation on their WSDL interface, see here.

Despite its name, pcbis2pdf probably won't ever make the step from collected data to print-ready PDF at one fell swoop (don't be fooled), but rather aid as much as possible in the process (speaking asymptotically, if you will) - it's more of a pcbis2dtp right now, really.

Why

In the future, this script should power the automatized generation of our list of recommendations (~ 300 books), which gets published biannually. For now, it gathers information (caching them locally), downloads book covers (from the German National Library) and exports everything back to CSV. From there, you might want to pass you results to the DTP software of your choice (eg Scribus, InDesign, QuarkXPress and others).

How

This is a "living", constantly changing boilerplate - feel free to adapt it to suit your needs. It's available for Composer. Without passing any options, pcbis2pdf assumes the following project structure:

├── ..
├── index.php
├── composer.json
├── knv.login.json
├── src
│   ├── dataList.sla
│   ├── Titelexport.csv
│   └── csv
│       ├── raw_one.csv
│       ├── raw_two.csv
│       └── ..
├── dist
│   ├── data.csv
│   ├── result.sla
│   └── images
│       ├── cover_one.jpg
│       ├── cover_two.jpg
│       └── ..
└── vendor
    ├── ..
    └── ..

Note: The dist directory gets filled up after running index.php, but for presentiveness, results are included above as well.

Basic workflow

Make sure to provide your API credentials (see example *.login.json files inside the example directory). Given this structure, you may automagically download book covers to dist/images and generate dist/data.csv by running php index.php or have a look first.

Advanced workflow

Taking things one step further, you might want to inject the generated dist/data.csv and all downloaded images into a DTP template. There's a usage example inside the example directory, which is using Scribus, an open source desktop publishing software compatible with Windows, macOS & GNU/Linux.

Working with this library over some time, you may want to add the following commands to your composer.json to automatize things even further (while executing them directly is fine as well):

"scripts": {
    "start": "php index.php",
    "print": "./vendor/berteh/scribusgenerator/ScribusGeneratorCLI.py --single -c ./dist/data.csv -o dist -n result src/dataList.sla",
}

Going beyond

If you want to take things to a whole other level, you might enjoy this gist, generating optimized PDF files from just CSV files and corresponding SLA files (Scribus documents), sorted by issue / year / you-name-it.

Credits

Most of the helper functions were taken from Kirby's excellent toolkit package by Bastian Allgeier (who's just awesome, btw).

Happy coding!

©️ Fundevogel Kinder- und Jugendbuchhandlung