catalyst / moodle-tool_pdfpages

A Moodle plugin for converting web pages to PDFs using various headless browser drivers
3 stars 2 forks source link

Blank PDF generation #36

Open matthewhilton opened 2 years ago

matthewhilton commented 2 years ago

I'm using the chromium generator, and can't seem to actually get any pages to generate properly. They are always blank.

I've tried both the test.php script as well as calling it from other scripts:

$url = new moodle_url("http://mysite.localhost/course/index.php?categoryid=13");
$file = $converter->convert_moodle_url_to_pdf($url, 'course1337.pdf', [], true);
http://mysite.localhost/admin/tool/pdfpages/test.php?url=http://mysite.localhost/mod/quiz/review.php?attempt=126558

When I try to run chromium just from the terminal, i get the following, which may or may not be related: /usr/bin/google-chrome-stable [62402:62402:0705/030126.228260:ERROR:zygote_host_impl_linux.cc(90)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.

matthewhilton commented 2 years ago

Digging into it a bit more, I've found its likely something to do with the proxy urls.

For example, if I change the file converter_chromium.php to navgiate to a random url e.g. https://google.com and take a screenshot or output to pdf, the webpage is shown correctly. But if I navigate to the proxy url, it is a blank page.

Fuurthermore setting the url as a public moodle site's homepage works, but setting as my local sites homepage does not.