pdfrx icon indicating copy to clipboard operation
pdfrx copied to clipboard

Please add docs about the performance considerations.

Open videni opened this issue 11 months ago • 2 comments

This library is truly a great work. I am pretty concerned about the performance, could you explain the performance a bit, for example ? Does this library draw PDF primitives with Flutter graphics API , or raster pdf pages to image , then render the image with Flutter ways?

I checked the source. It seems it uses the CustomPainter to draw PDF pages. I am new and not able to understand all the nitty-gritties.

I am trying to bring the pdf-rs/pdf_render to Flutter. I'd like to try this one if there is no performance issue here.

videni avatar Jan 05 '25 09:01 videni

What do you mean by the performance? And why are you so concern about the performance?

I think the PDF engine, pdfium is one of the fastest PDF framework over the world.

And, because pdfrx is running on Flutter, there's of course certain performance bottleneck inside the implementation.

But on the overall performance, user can accept the current implementation.

And I don't know much about pdf-rs but it seems lack of many of the features that pdfrx uses...

espresso3389 avatar Jan 05 '25 12:01 espresso3389

@espresso3389 Thanks for help. In our case, fast rendering and text selection are must-have features. Others are optional. Our customers are very critical about fast rendering. pdf_render.rs is suitable for our case, which renders PDF with webGPU directly. I refactored the code and made it 2d backend agnostic. I thought it was able to implement a backend on the Flutter side. After lots of research, I found out there are no 2D Graphics APIs exposed , also, the Canvas of CustomPainter seems not efficient to draw lots of PDF primitives.

As I know, Skia has an internal PDF renderer which is based on Pdfium. It is odd that this feature is not natively available in Flutter.

videni avatar Jan 05 '25 14:01 videni