DEV Community

Cover image for How i struggle with exporting DeepSeek to PDF and make my own solution
slava
slava

Posted on

How i struggle with exporting DeepSeek to PDF and make my own solution

Why I decide to built a better DeepSeek to PDF Converter

Hey everyone! I ran into the problem of exporting DeepSeek chats to PDF, looked at existing solutions, and realized that everything currently on the market is half-baked, even though there's clear demand for this solution. All the top extensions right now can only convert chats into images and then put them into PDFs, which is inconvenient because you can't select text, and the text cutoffs at page breaks are the main pain point of such solutions. So I decided I needed to make my own.

Dev time

I opened Cursor, googled some libraries, found html2pdf and thought "This is it! We'll make it nice now." But I quickly realized I was just going down the same path as everyone else. All html2pdf does is convert an HTML page to canvas and then add it to PDF. The result is crooked, slanted and ugly. I decided to do PDF export on the server using another library that spins up its own headless Chrome for PDF export. Does it work? Yes. Is it convenient for users? Yes. Will it cause scaling problems in the future? Also yes. Not an option.

The climax

It turns out that the same library doesn't need to spin up a separate Chrome at all - you can just extract its core and connect to the user's browser through Chrome's built-in debugger. After a couple hours and several rebuilds, it happened - DeepSeek to PDF

Fully client-side, without awkward text cutoffs, without hacky image insertion into the code. A full-fledged PDF with selectable text. If anyone is facing the problem of exporting DeepSeek to PDF, I recommend trying: DeepSeek to PDF Export

Top comments (0)