Switch from casparser
casparser is a free, MIT-licensed Python library for reading CAS PDFs. Our reader returns its JSON shape, so code written for casparser keeps working.
Credit
casparser is the reference we check against. Its detection markers and several parsing ideas informed our reader, which is our own code in TypeScript. casparser is MIT-licensed; its licence and copyright stay with its authors. We compared against casparser 1.4.1.
What maps one to one
| casparser | Sachfolio |
|---|---|
CAMS and KFintech CASData JSON | toCasparser(cas): same keys, same transaction types, amounts as exact decimal strings |
NSDL and CDSL NSDLCASData JSON | toCasparserDemat(cas) (mutual funds only) |
read_cas_pdf(path, password) | readCas(bytes, { password }), or read_cas_pdf from examples/python/read_cas.py, which calls our command line |
casparser file.pdf -p … | npx sachfolio-cas file.pdf --format casparser, with the password on stdin |
| The same shape over HTTP | POST /v1/parse?format=casparser, or GET /v1/samples/{name}.casparser without a key |
Documented differences
amfiandtypearenull. casparser fills them from its own ISIN database.- Transaction types casparser has no name for are folded in: systematic withdrawals and pledge invocations become
REDEMPTION; bonus units, transfers, pledges and unit adjustments becomeMISC. parse_warningslists every check that failed, not only unit-balance breaks.- For NSDL and CDSL,
equities,bondsandownersare empty, and an account'sbalanceis the mutual fund value read, not the statement's account total. - Page references and checks are not in casparser's shape. Keep the
CasDocumentif you want them.
What Sachfolio adds
- Page tags: every number carries the page and line it was printed on.
- Checks: units, running balance, units × NAV, ISIN and the printed total, each
pass,failorunavailable. A holding that doesn't add up is skipped and counted incoverage, never guessed. - Exact decimals: amounts are decimal strings, never floats.
- Runs in the browser: the PDF and its password stay on your user's device, with no server of yours in the path.
- Extras: XIRR, capital gains lot by lot,
redactCas(), CSV export and a JSON Schema for the output.
What casparser does that we don't
- It is a Python package:
pip installand call it in-process. Ours is JavaScript and TypeScript; from Python you call our command line. - It fills
amfiand schemetypefrom its ISIN data. - For NSDL and CDSL it reads more than mutual funds, such as equities and bonds. We read mutual fund units and ETFs and name the rest in
warnings. - It is free for any use under MIT. Our package is under BUSL-1.1: personal use and evaluation are free; a product needs a commercial licence.
Try it
curl https://api.sachfolio.com/v1/samples/dev-sample.casparser
No key and no sign-up. The full steps are on the developers page, and the API is described in the OpenAPI file.