Type something to search...
The Print Shop in My Head: Pricing Documents by Gut Feel

The Print Shop in My Head: Pricing Documents by Gut Feel

Machine Learning XGBoost Python Story
On this page

In college I ran a tiny printing business out of my room. Friends sent assignments, I printed them, they paid. I priced every sheet by hand, flipping through each page and then going on gut instinct. The work needed full focus and no interruptions — at least for me, a person who cannot multitask. The moment someone called my name, the running total reset and I had to start over. Ugh. Exhausting work.

A ten-page PDF, mostly text: Rp500. Next. Page two has an image and some text, clearly pricier: Rp1.000. Page three is mostly a picture with a little colored text — but how much? The queue piled up in the group chat and there was no time to calculate. So I guessed, fast, and hoped I’d still turn a profit to buy paper and ink.

The guess had a shape

Years later I looked back and realized the guessing had rules. I was scanning each page and sorting it into categories: plain text, light graphics, heavy color, full-page photo. Five categories, roughly. The price came from the category, not from any calculation.

That observation became Print-Cost. If my eyes could sort pages into five categories, a classifier could too.

Teaching the machine to see ink

The pipeline is simple enough to explain over coffee. Each PDF page becomes an image, converted from RGB into CMYK, the color space printers actually use. From there I measured how much cyan, magenta, yellow and black ink each page needs.

Labels were the hard part. The data was 884 pages from the Statistik Indonesia yearbook (a public BPS publication) — a mix of text pages, tables, infographics and full-color covers, none of it labeled. So I clustered it with K-Means into 6 groups by visual similarity, then mapped those groups by hand onto the same five price categories I used in college. Hand-labeling everything would have taken days. This way I only had to label 6 clusters instead of 884 pages: about 147 times less work.

K-Means clustering into 6 classes: text pages, tables, infographics, and full-color covers

Each labeled page I exported as an image at different resolutions: 1, 5, 6, 7, 20, 50, 100 and 150 DPI.

The tinkering

The data now had features C, M, Y, K and DPI, with price as the target. Since a page’s cost is driven by how much color it carries, I built new features: cmy (cyan + magenta + yellow combined) and cmyk (all channels total), alongside k (black ink). The hope was these would help the model learn the pattern and lift accuracy.

Then I compared three models: XGBoost, Decision Tree, and SVM. XGBoost happened to win. After a few rounds of tweaking image quality, 7 DPI came out on top. To the human eye 7 DPI is hopelessly blurry, but the model — from my experiments — needed nothing more to predict a print price. Higher resolution bought a touch more accuracy but made exporting pages to images much slower. 7 DPI was the sweet spot: barely any performance loss, far faster extraction. An 884-page document prices in about 8 seconds, 109 times faster than me calculating by hand, error-prone and, frankly, exhausted.

It scores 99% F1, with one deliberate bias. When it gets it wrong, it leans toward underpricing rather than overcharging. A shop that overcharges loses the customer standing in front of it, so I chose to put the risk of error on my side as the shop owner.

What it cannot do

The model knows five categories and nothing else. It cannot answer a customer’s question, cannot check stock, cannot describe a product in detail.

Print-Cost answers exactly one question: which category each page belongs to, and what that costs. The day someone asked whether spiral binding fits a thesis, it had nothing to say. That limitation is the reason the Dokuprint agent exists.

Related Posts

Creating Learner Progress Monitoring Using Python, Pandas and Streamlit
Article

Creating Learner Progress Monitoring Using Python, Pandas and Streamlit

Python Pandas Streamlit

How I built an automated learner progress dashboard with Python, Pandas and Streamlit, tracking assessment scores and participation across Canvas LMS cohorts.

4 min read 04 Apr, 2022
Read
My Pricing Machine Could Not Answer Questions, So I Built It a Brain
Article

My Pricing Machine Could Not Answer Questions, So I Built It a Brain

AI Agent RAG Python

Print-Cost priced documents but went silent otherwise. The story of giving it a voice: an assistant that answers shop questions and never invents a price.

3 min read 23 Sep, 2026
Read
Building a Scalable ETL Pipeline with AWS Glue (CSV to Parquet + Partitioning)
Article

Building a Scalable ETL Pipeline with AWS Glue (CSV to Parquet + Partitioning)

AWS Glue ETL

A hands-on walkthrough of a serverless ETL pipeline with AWS Glue, PySpark and Athena: raw CSV into partitioned Parquet for fast queries at scale.

6 min read 08 Apr, 2026
Read