django-hardcopy
django-hardcopy copied to clipboard
Plans to deal with future deprecation of the --print-to-pdf command arg
@ckinsey
Issue:
- currently using
--print-to-pdf
[4] gets the job done but it appears that in the future this will be deprecated [0] [1] , based on my reading of the linked discussion threads. - given this future removal is there any plans to move towards using pychrome [2] or other devtool python wrappers that would be able to replicate this functionality?
- using pychrome or other devtool wrapper would also have a big side benefit of allowing developers to access a lot more functionality provided by the print to pdf [3] as well.
Resources:
[0] https://superuser.com/questions/1281309/how-can-i-print-a-webpage-in-landscape-mode-using-headless-chromium-on-the-comma/1281535#1281535
[1] It is likely that this will lead to deprecation (and eventual removal) of --headless mode command line flags such as --print-to-pdf or --screenshot.
[2] https://github.com/fate0/pychrome
[3] https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-printToPDF
[4] https://github.com/loftylabs/django-hardcopy/blob/master/hardcopy/init.py#L31-L34
It looks to me like we'll have to use Puppeteer. But we'll have access to more options, too. It will require Node.js to run, though, which may be more than what many are willing to set up to get this to work.
This could be an option to avoid introducing the nodejs dependency https://github.com/miyakogi/pyppeteer/