[Proposal] CanvasKit PDF Support

38 views
Skip to first unread message

Pushp Parag Agarwal

unread,
Jul 18, 2025, 9:18:23 AMJul 18
to skia-discuss

Hi all,

Skia already provides robust support for PDF creation, but this functionality isn't currently exposed through CanvasKit. As part of my work, I’ve started implementing Emscripten bindings to enable PDF generation directly from CanvasKit.

While my primary motivation is project-specific, I believe this feature could benefit others in the community.

You can view the ongoing changes here:
🔗 https://github.com/google/skia/compare/main...pushpagarwal:skia:canvas-kit-pdf

The patch is relatively large, so I’d really appreciate any early feedback or guidance on direction, structure, or integration strategy.

Thanks,
Pushp

kjlu...@google.com

unread,
Jul 18, 2025, 9:23:01 AMJul 18
to skia-discuss
Some general feedback:
- I don't think having CanvasKit expose anything related to streams is particularly ergonomic for our JS users. Can this be re-worked so that an ArrayBuffer or similar is returned when someone is ready to "print" the PDF?
- Many of the changes in src/pdf that wrap skstrings should probably go in pdf_bindings. I'd like to keep changes to the core skia features minimal and free from "CanvasKit-isms" if we can help it.
- When you are ready to submit for further review, see https://skia.org/docs/dev/contrib/.

Kaylee

Pushp Parag Agarwal

unread,
Jul 18, 2025, 1:59:36 PMJul 18
to skia-discuss
Thanks for the feedback. Make sense. It would make JS interface simpler. 
I have made the changes. Please review again. 

kjlu...@google.com

unread,
Jul 18, 2025, 2:35:32 PMJul 18
to skia-discuss
Please follow the contribution guidelines so the change gets into our usual code review platform.

Kaylee

Reply all
Reply to author
Forward
0 new messages