pcbis.de helper for use with DTP software
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
Martin Folkers 6d50e5a9f0 Reinstating proper example index.php 3 years ago
example Improving 'Getting Started' section 3 years ago
languages Updating DE translation 3 years ago
lib Fixing Travis CI 3 years ago
tests Fixing Travis CI 3 years ago
.gitignore Improving .gitignore 3 years ago
.php_cs Releasing v1.0.0-beta.2 🎉 3 years ago
.travis.yml Removing PHP versions incompatible with PHPUnit v8 3 years ago
LICENSE Initial commit 3 years ago
README.md Removing getkirby/toolkit as dependency 3 years ago
composer.json Removing getkirby/toolkit as dependency 3 years ago
index.php Reinstating proper example index.php 3 years ago
phpunit.xml Adding PHPUnit tests (fixes #10) 3 years ago

README.md

pcbis2pdf

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