'How to specify ink usage in a pdf file?

I'm just asking if there's a way to specify the ink consumption in a pdf file whether color or black in percentage by python?

Example of the case: i have an invoice.pdf contains black text, so i want to know how much black color consumed in the file in percentage, desired output (this file consumes 30% of the page ).

i really appreciate your efforts.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source