![]() Headers specify "content-type: application/pdf" Mangled output in the browser: Be sure that your HTTP response Root_url configuration may be what you are looking for change your HTML source make sure you use complete paths (either file paths or If you are using PDFKit to generate PDFs from a raw ![]() Make sure you are using absolute paths (start with forward slash) to To the fact that wkhtmltopdf does not know where to find those files. Resources aren't included in the PDF: Images, CSS, or JavaScriptĭoes not seem to be downloading correctly in the PDF. Then to run the app unicorn_rails -c config/nf (from rails_root) Group in your Gemfile gem 'unicorn' then run bundle. Like Passenger or try to embed your resources within your HTML toĮxample solution (rails / bundler), add unicorn to the development To getĪround this issue you may want to run a server with multiple workers This is usually not an issue in a production environment. Request and the initial request will be waiting on the resource This is because the resource requests will get blocked by the initial Requires wkhtmltopdf to hit your server again (for images, js, css). This can cause issues when rendering your pdf Single thread issue: In development environments it is common to run a The PDFKit-save-pdf header is never sent back to the client. If the path is not writable/non-existent the write will fail silently. pdf to be saved to path/to/saved.pdf in addition to being sent back to the client. ( ///site.css) that need to be resolved, you can pass :root_url If the source HTML has relative URLs ( /images/cat.png) or stylesheets
new ( html, :page_size => 'Letter' ) kit. format ( exit_code, stderr )) OSError : wkhtmltopdf exited with non - zero code - 11.# PDFKit.new takes the HTML and any options for wkhtmltopdf # run `wkhtmltopdf -extended-help` for a full list of options kit = PDFKit. to_pdf ( output_path ) File "/home/varand/.virtualenvs/intrudevenv/lib/python3.8/site-packages/pdfkit/pdfkit.py", line 159, in to_pdf raise IOError ( "wkhtmltopdf exited with non-zero code ". from_string ( html, False ) File "/home/varand/.virtualenvs/intrudevenv/lib/python3.8/site-packages/pdfkit/api.py", line 72, in from_string return r. raise_uncaught_exception ( exc ) File "/home/varand/.virtualenvs/intrudevenv/lib/python3.8/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception raise exc File "/home/varand/.virtualenvs/intrudevenv/lib/python3.8/site-packages/rest_framework/views.py", line 506, in dispatch response = handler ( request, * args, ** kwargs ) File "/home/varand/Intrude/tools_api/views.py", line 418, in generate pdf = pdfkit. handle_exception ( exc ) File "/home/varand/.virtualenvs/intrudevenv/lib/python3.8/site-packages/rest_framework/views.py", line 469, in handle_exception self. dispatch ( request, * args, ** kwargs ) File "/home/varand/.virtualenvs/intrudevenv/lib/python3.8/site-packages/rest_framework/views.py", line 509, in dispatch response = self. Traceback ( most recent call last ): File "/home/varand/.virtualenvs/intrudevenv/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner response = get_response ( request ) File "/home/varand/.virtualenvs/intrudevenv/lib/python3.8/site-packages/django/core/handlers/base.py", line 179, in _get_response response = wrapped_callback ( request, * callback_args, ** callback_kwargs ) File "/home/varand/.virtualenvs/intrudevenv/lib/python3.8/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view return view_func ( * args, ** kwargs ) File "/home/varand/.virtualenvs/intrudevenv/lib/python3.8/site-packages/rest_framework/viewsets.py", line 125, in view return self.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |