aboutsummaryrefslogtreecommitdiffstats
path: root/wkhtmltopdf/utils.py
Commit message (Collapse)AuthorAgeFilesLines
* PDFTemplateView.cmd_options contains all the options to pass to wkhtmltopdfSimon Law2012-07-241-0/+8
| | | | | | | | | | | | | | | | | | | | Before, command-line arguments were class-based. Unfortunately, this means that you cannot add new command-line arguments without subclassing. Instead, PDFTemplateView.cmd_options is a dictionary of all command-line arguments. PDFTemplateView.as_view(cmd_options={...}) now works as expected. !!!! WARNING !!!! cmd_options is now empty, leaving wkhtmltopdf with its default behaviour. Explicitly add the options you want. Existing subclasses of PDFTemplateView will now break, but a PendingDeprecationWarning will be issued. Margins will now be wkhtmltopdf's default of 10mm. PdfTemplateView contains a compatibility shim with the old default values for margins and orientation.
* PDFTemplateResponse and PDFTemplateView now match Django's implementationsSimon Law2012-07-241-0/+55
| | | | | | | | | PDFTemplateResponse is like TemplateResponse in that it does dynamic rendering of a template on the fly. PDFTemplateView has a much smaller implementation, relying on PDFTemplateResponse to do the rendering for it. It also knows about the standard TemplateResponse when it needs to render the HTML version.
* PDFResponse is more robust:Simon Law2012-07-231-0/+30
| | | | | | | * Now matches HttpResponse in function signature. * Modern Django content_type/mimetype handling. * Sanitizes and quotes filenames in Content-Disposition header. * Tests.
* settings.WKHTMLTOPDF_CMD_OPTIONS sets default command-line options.Simon Law2012-07-201-3/+6
|
* settings.WKHTMLTOPDF_CMD is loaded on-the-fly, not at the module level.Simon Law2012-07-201-3/+2
| | | | This allows overriding this configuration option at run-time.
* Reliable command-line argument parsing for wkhtmltopdf().Simon Law2012-07-201-18/+37
| | | | | | The API for wkhtmltopdf has changed. Long arguments that take no parameters now use True and not the empty string. In addition, argument-parameters may now be Unicode.
* wkhtmltopdf() uses subprocess.check_output() instead of a custom Popen call.Simon Law2012-07-201-11/+5
|
* Be clear with template_to_temp_file's argumentsJames Turnbull2012-03-091-2/+2
| | | | | | | | | | | It's not obvious what template_to_temp_file is doing with its undefined arguments. The Zen of Python states: Explicit is better than implicit. Readability counts. An alternative solution would be to rename the function to loader_render_to_tempfile or similar, but this fix is more backwards-compatible.
* Refactor the main render method into a class based viewGeorge Hickman2011-10-301-30/+1
| | | | | | Use a PdfResponse to deal with the headers and response type. Make the margin_* and filename variables instance variables on the view with sane defaults.
* Code cleanupGeorge Hickman2011-10-301-3/+4
| | | | | Fix a spelling mistake Wrap a particularly long line
* Use with for file usageGeorge Hickman2011-10-301-6/+7
| | | | | Replace old style file open and close with a `with` block for clarity and it's error handling.
* Removed unised importv0.1.1Max Peterson2011-09-061-1/+0
|
* Added smart_strMax Peterson2011-09-061-1/+3
|
* fixed some bugs, added filename supportCharlie Denton2011-07-251-4/+10
|
* Added as newMax Peterson2011-07-081-0/+88