Is it possible to get pdf page using pyppeteer?
import asyncio
import pyppeteer
import logging
from pyppeteer import launch
pyppeteer.DEBUG = True
for name in logging.root.manager.loggerDict:
logging.getLogger(name).disabled = True
async def main():
browser = await launch(headless = False)
page = await browser.newPage()
await page.setJavaScriptEnabled(True)
response = await page.goto('http://www.africau.edu/images/default/sample.pdf',
time = 3000, waitUntil = ['domcontentloaded', 'load', 'networkidle0'])
content = await response.buffer()
print(content)
await browser.close()
asyncio.get_event_loop().run_until_complete(main())
expected output: content of http://www.africau.edu/images/default/sample.pdf
got output: b'df48fcc4-a0b0-4e86-b52e-0ec012ee791e'
Python 3,Linux Ubuntu
from Recent Questions - Stack Overflow https://ift.tt/3IdHNsu
https://ift.tt/eA8V8J
Comments
Post a Comment