In Prince we need to do this a lot. The basic process is that the test suite compares generated output to expected output. The generated output is produced with a few flags to make the PDF easier to compare: --pdf-id= --no-producer --no-compress. Then the output is compared using a special (GNU) diff invocation:
Fun to read about some programatic working with pdfs. I've been meaning to investigate this for my personal accounting software I'm writing that parses bank statements. So far I've been working with just OFX files, but I want to tackle pdfs at some point because some institutions don't have an OFX export option and the CSV options often don't have as much info as the monthly pdf e-statements do.
wezm | 20 days ago
In Prince we need to do this a lot. The basic process is that the test suite compares generated output to expected output. The generated output is produced with a few flags to make the PDF easier to compare:
--pdf-id= --no-producer --no-compress. Then the output is compared using a special (GNU) diff invocation:If the output fails that comparison further files are generated as needed:
difffile for the pdfpdftotxtis compared and a diff of that output is generated if differentpdftoppm, and expected versus actual images are kept for each page that differs.This all works pretty well.
[OP] lvmbdv | 19 days ago
Thanks for sharing, Prince looks useful!
mxey | 20 days ago
I always enjoy some unusual tests.
jesseb34r | 20 days ago
Fun to read about some programatic working with pdfs. I've been meaning to investigate this for my personal accounting software I'm writing that parses bank statements. So far I've been working with just OFX files, but I want to tackle pdfs at some point because some institutions don't have an OFX export option and the CSV options often don't have as much info as the monthly pdf e-statements do.