Forums | Mahara Community
Developers
/
Creating PDF of a Page
21 July 2014, 8:34
Hi Richard Lilleker,
I was wondering how you had got on with creating PDF of a page? Had you got it working?
I ask as this is something that would be good to get into core of Mahara.
If you were able to supply code for a working example that would be greatly appreciated.
And even if you are unable to supply code it would be good to know how you got around permission / session problems to get the pdf to contain the allowed html/images etc for a page.
Cheers
Robert
21 July 2014, 9:48
FYI
Whilst eagerly awaiting a pdf export function in Mahara I have been using PDFPenPro from http://smilesoftware.com/ to do that job - if I make a Collection then use the secret url for that Collection in PDFPen it will generate a nice looking pdf (of course, it helps if the author had pfd making in mind as then they can shape the page to work well, especially as a pdf that they might print from).
It is for Mac - don't know about PC.
21 July 2014, 10:09
Robert,
I write code for Moodle a few years back, using WKHthmlToPDF (IIRC) to generate PDFs. If nothing else has been done, I could see if I could do that for Mahara.
As far as I recall, the biggest problem was making sure required libraries were available in a PHP-FPM environment - the actual code to invoke the software was pretty straight forward.
Regards,
Nigel
21 July 2014, 13:53
Getting wkhtmltopdf and the phpwkhtmltopdf wrapper installed has been easy enough - the trick has come trying to get phphtmltopdf to send the right info to fetch a page as a logged in user.
I can easily generate a pdf of the login page :)
If there is anyone out there that has got a working example of wkhtmltopdf generating a pdf for a logged only page I'd be interested in seeing the code / process they used.
Did they need to use Curl or need to hack core files to get it to work?
Or is there some correct foo where the right wkhtmltopdf settings can be used to pass the session along?
Cheers
Robert
22 July 2014, 23:16
I wonder if these could be of any help? Especially the comments...
- http://stackoverflow.com/questions/4651148/wkhtmltopdf-log-in-to-asp-net-web-app
- https://code.google.com/p/wkhtmltopdf/issues/detail?id=356
- http://stackoverflow.com/questions/10414172/how-to-convert-secured-html-asp-net-mvc-3-page-to-pdf-using-wkhtmltopdf - Curl approach
HTH, Gregor
- «Previous page
- 1
- 2
- »Next page