Hi, I will be helping in a Training Camp soon, we are going to use vjudge to use problems from various OJs like Codeforces, AtCoder, SPOJ, etc., and I noticed that there doesn't seem to exist a tool to transform problem statements into PDFs (which is really useful if you are trying to compose a problemset), the ones that exist are usually specifically tailored to a single platform, and some have problems with images, etc.
So I composed some quick and dirty (but simple) solutions, this is not a tool, but with enough effort it could be converted into one. This is the Github repo if you want to read it with Github's markdown, or if you want to contribute something. I will (almost) mirror what's the repo in this post, so you don't have to bother with that extra click.
Also, if you know a better tool, I would be glad to hear that I wasted my time because this is already done, so please tell me.
How to use
Go to the problem page, open the developer tools (F12 in Chrome), go to console, and paste the respective payload below, this will allow you to print the problem statement (you can then select to print it to PDF). All of these preserve images.
These codes delete the prefix letter of the problem since they might cause users to guess the difficulty of the problem, to make this completely effective, make sure to turn off priting "headers and footers".
var x = document.getElementById('main-container').children.children.children.innerHTML; var y = document.getElementById('task-statement').children.children; y.removeChild(y.children); document.body.innerHTML = '<h1>' + x.substr(x.indexOf('-') + 2) + '</h1>' + y.innerHTML; window.print();
var x = document.getElementById('pageContent'); var y = x.children.children.children.children.children.innerHTML; x.children.children.children.children.children.innerHTML = y.substr(y.indexOf('.') + 2); document.body.innerHTML = x.innerHTML; window.print();
var x = document.getElementById('problem-name').innerHTML; var y = document.getElementById('problem-body').innerHTML; document.body.innerHTML = '<h1>' + x + '</h1>' + y; window.print();
For SPOJ and AtCoder, it doesn't report the time and memory limits, since I'm planning on using vjudge, and that tells you those limits, I plan on getting people watch the limits from there, but you get the idea of how to extend this if you want to, I would, of course, welcome PRs.
I need support for other OJs, feel free to add yours.