Open straup opened 4 years ago
FYI, I've broken things in to two separate packages:
The former is basically webster
and the latter is webster
as a generic Swift package. The thinking is that it would be nice to also have a simple "HTTP pony" version of the code that returns (PDF) data over the wire rather than writing a file to disk.
This decision has introduced an unfortunate degree of inefficiently. Specifically: Under the hood this package is using NSPrintOperation
to render a WebView. Ideally I would like NSPrintOperation to print directly to a Data instance but it's unclear to me whether this is possible or how to do it.
Instead the render method creates a temporary file, writes to it, reads the data and removes the temporary file on exit. This introduces extra overhead but, hopefully, keeps the interface a little more agnostic about how the resultant PDF document is used.
Caught up on all that. So I think at this point you've gone far enough down the rabbit hole that it doesn't make sense to PR back to this repo. I'll update the readme here and point to your work if anyone happens across my version first if you want / think it appropriate?
As for NSPrintOperation -> Data yeah that class is very file focused unfortunately, so I think the temporary file approach is fine. I'll try to take a deeper look over the weekend here and see if I can provide any further insights.
webster
also now has proper command line flags for specifying dimensions, source URL and target destination.The only reason this is a separate package and not a PR is because
aaronland/webster
is full of Swift Package Manager -isms and I am not sure how best to make a PR that also make XCode happy.If you can advise I would gladly submit a PR here and retire
aaronland/webster
.