innoveit / play2-pdf

A PDF module for Play Framework 2
MIT License
77 stars 22 forks source link

Is it really needed to use all Play dependencies? #46

Open felipebonezi opened 1 year ago

felipebonezi commented 1 year ago

I was reviewing the project and realized that we're using all Play modules defined into project/plugin.sbt.

We could improve our dependency to Play only using the exact module that we need. The two main problems we will suffer is that we use Results.Result as the main return from PdfGenerator.ok(...) as we can see at here and play.Environment as the helper class to get all resources (e.g. Images, CSS, etc) files from public folder.

From my research I see that we're using the following modules:

I believe that we could remove this method and return only byte[] and InputStream as the available returns to render the PDF and implement another way to get the resources from the public folder (maybe using something very similar to play.Environment implementation).

The benefits we could have are:

Hope to hear more opinions.

braviusconolly commented 1 year ago

I agree and would say that we could use a helper class to get resources files using java.util.File from public folder. It seems to be a very simple implementation...