Consistent Commands, Meaningful Exit Codes and Custom Branding in the PDFParser
With version 4.0.5, the CATweasel Toolkit receives numerous improvements in integration into existing workflows, in configuration and in the reliability of the analysis results. This makes the toolkit even easier to control from scripts and other programs.
The focus is on consistent naming of the commands, exit codes following an established convention, custom branding for the result PDFs and a stable, reproducible sorting of terminals and devices.
Consistent Commands and Better Integration
Commands with the Prefix ctw-
The commands of the toolkit now start with ctw-. This avoids conflicts with commands of the same name from other programs. The PDFParser, for example, is called like this:
ctw-pdfparser schematic.pdf
The previous command pdfparser keeps working for now, but shows a deprecation notice and will be removed in a later version. Scripts that use it should therefore be updated. Shortcuts, the “Send to” menu and the “Open with” entry are updated automatically by the installer.
Exit Codes for Calling Programs
The applications now report what went wrong through their exit code. Calling programs and scripts can thus react specifically to the type of error instead of only distinguishing between “successful” and “failed”. The codes follow the common sysexits.h convention, for example:
64incorrect usage66input file not found73output file cannot be written78configuration error130cancelled by the user
The complete list can be found in the manual of each application (--man). The start scripts such as ctw-pdfparser.cmd and catweasel.cmd now also pass the exit code on to the caller; previously they always returned 0. In addition, error messages are now shown only once.
Selecting the Parser for a Single Run
The parser used by the PDFParser can be specified for a single run, for example when the PDFParser is started by another program. The parser selection is then not shown:
ctw-pdfparser --DefaultParser=SignedPageDeviceCounter schematic.pdf
Alternatively, the environment variable CATWEASEL_DefaultParser can be used. An unknown name is rejected with a list of the configured parsers.
Stricter Command-Line Checks
Options must now be written out in full. Abbreviations such as --log for --log-level are no longer accepted. The PDFParser expects exactly one PDF file. File names containing spaces must be enclosed in quotation marks when calling the program directly. Calling it via drag and drop or the “Send to” menu is not affected.
Custom Branding in the Result PDF
The PDFParser can place a watermark and a stamp on every page of the result PDF, for example your own company logo. Both are stored as PDF files:
var/custom/branding/watermark.pdfis scaled to the page size and displayed semi-transparently.var/custom/branding/stamp.pdfkeeps its size and is placed in a corner.
If the files exist, they are used automatically. Other files, the opacity and the corner of the stamp can be set in the new <Branding> block of pdfparser.cfg. The test version contains a watermark and a stamp with a QR code for requesting the full version. The installer of the full version removes them again; your own files are kept.
More Reliable Configuration
Relative Paths and Environment Variables
Relative paths in the configuration, for example for FilterConfig or a <Target> folder, now always refer to the installation directory, regardless of where the PDFParser is started from. In addition, environment variables can be used in paths:
<Target "$PUBLIC\Documents\CATweasel">
A missing filter file is reported as a configuration error with its full path.
Renamed and Additional Parsers
The preinstalled parsers are now named after what they detect. “Standardfilter IEC81346” becomes SignedPageDeviceCounter, and “Sonderfilter EXAMPLE” becomes PageDeviceCounter. The filter rules themselves remain unchanged. On update, the installer adapts the configuration and keeps the previous files as .old, so that your own adjustments can be transferred.
In addition, there is the new parser SignedDeviceCounter for device tags such as -K1 without a page number. The comments of the parser configurations have been revised, and all parameters are documented centrally in _example.cfg.tmpl.
Stable and Reproducible Sorting
Terminals that combine digits and letters, such as 1A, 11C or 24VDC, are now sorted naturally, for example 1A, 1B, 4A, 11A. Previously, their order could vary from run to run. The same schematic now always produces the same result.
In addition, PA and SH terminals are placed at the end of the terminal strip behind PE, as described in the manual. Devices without a number, such as -K, appear directly before the numbered devices with the same letters (-K, -K1, -K2) instead of in a separate block.
Bug Fixes
- Before the analysis, the PDFParser checks whether the result PDF and the export files can be written. If a file is still open, for example in the PDF viewer or in Excel, it stops immediately and names the file, instead of failing only after the complete analysis.
- Parsers with the same
SortCriteriawere missing from the parser selection. All parsers are now offered. - If only one parser is configured, it is used directly instead of causing an internal error.
- Leaving the parser selection without a choice is now treated as cancellation by the user.
- PDF files with an exclamation mark in their name are found again when passed via drag and drop or “Send to”.
- Starting without a file, for example from the Start menu, no longer closes the window immediately but shows the error message.
Outlook
The applications now support subcommands with their own options and their own help. This structure forms the basis for the newly developed Lagerist module for managing material data and bills of materials, which will be presented in an upcoming version.
Summary
Version 4.0.5 makes the CATweasel Toolkit more robust and easier to integrate into existing workflows:
- Consistent commands with the prefix
ctw-avoid conflicts with other programs. - Meaningful exit codes allow calling programs to handle errors specifically.
- Custom branding with watermark and stamp in the result PDF.
- More reliable configuration thanks to consistent relative paths and environment variables.
- Reproducible results thanks to stable sorting of terminals and devices.
- Early error detection if result files are still open.
If you call pdfparser in your own scripts, you should switch to ctw-pdfparser and take the new exit codes into account.

