Krisenter - A plugin for viewing (and annotating) pdf's in Krita

Hello.

I’m a newbie as a developer (and user) to Krita. I started working on “Krisenter” - a plugin for viewing (and annotating) pdf slide presentations from within Krita.

I have some developer questions. Is there a API for dynamically adding (and removing) key-bindings? I’d like to override Left and Right within my plugin when “loading a pdf file” and restore them to their previous values at the end of the “presentation”. Is that possible?

Is there any library in Krita for converting a list of images into a multi-page pdf file? I am familiar with the cairo python binding, but I’d rather not pull in another dependency if there already is support in the Krita code base.

Hi

No

But Krita scripting can use PyQt5, and then you can generate PDF files from other files…
But it need some work :slight_smile:

I’ve implemented a function in BuliCommander to generate PDF files with multiple pages from file list.

Here a screenshot example (from release 0.4.0a)

If it can help you, the PDF export part is defined in bcexportfiles.py file.

Grum999

1 Like

Thanks for the tip and the code. After reading up some more on python pdf libraries I think that I’ll add the external dependency pikepdf though, as it has the advantage of allowing adding annotations to the existing pdf structure, without having to turn the input pages to raster. This suits better my usecase of adding annotations to an existing pdf file.

1 Like

:thinking:
Currently, only images are raster.
Text in generated PDF is vector and can be selected for copy/paste action…

Grum999

Ok. But that is still not enough for what I need, as I plan to read an already existing pdf file and then drawing overlays on top of the existing pages. Your use case is different as you are creating pdf files from scratch based on info within Krita.

Yes

But question on which I provide an answer was Is there any library in Krita for converting a list of images into a multi-page pdf file? :yum:

I never tried to read PDF file with Qt, don’t know if it’s easy or not…
Qt provides many classes to read/write PDF.
https://wiki.qt.io/Handling_PDF

Anyway, if you find a way to import an external library that can be used in Window/Linux/MacOS without need for user to manually install a third party software on system, I’m interested :slight_smile:

Grum999

I don’t know if it will help you but you can check out the comic manager plugin which is shipped with Krita. It takes multiple kra files and exports them to epub or cbz etc.

@Grum999 : You’re absolutely correct. I changed my requirements yesterday as the evening progressed. :wink:

As a reference I got a great answer from the author of qpdf about how to add an image overlay to a page of a pdf file. This is exactly what I was looking for, for saving the user annotations to a pdf file. Note that pikepdf is the python binding to qpdf.

1 Like