So I have some Rails 3.2.x code that takes an HTML view page and outputs it to PDF using the docraptor print service. The only issue is that it doesn't shrink the contents to fit on the PDF page, so there's overrun.
I initially tried to do a media query to inject some css for printing, but that didn't seem to do anything.
What are my options to try and make this work?
1) I thought about making a separate print style sheet (instead of media query) but I'm not sure docraptor is treating the HTML document in "print mode" when I send it to docraptor via a POST request.
2) I could also make a separate Rails view to print out with a narrower width (say 500 px), to ensure all the contents fits on the PDF page when outputted. This is more work, so I'm trying to make something like #1 work but I haven't had any luck.
class PdfMaker
include HTTParty
def make_pdf
options = {
:document_url => url,
:document_type => "pdf",
:name => "mydocument.pdf",
:test => false,
:async => false,
:prince_options => {:baseurl => 'http://www.example.com'}
}
response = post("/docs", :body => {:doc => options}, :basic_auth =>{:username => "secure_stringXXXX"})
end
end