2017-06-15 65 views
0

PDFKit工作正常,直到我把它變成ajax。現在JavaScript不會在PDF完成之前加載圖表圖表。我已經找到了一些關於如何解決這個問題的例子,但是當我嘗試它時卻無法解決問題。pdfkit與ajax不工作

PDFkit代碼

我發現這個論壇上說,使用window_status但是當我做窗口狀態只是掛在加載頁面(1/6) [============ ================================================] 100 %

PDFKit.configure do |config| 
    config.default_options = { 
    orientation: 'Landscape', 
    javascript_delay: 5000, 
    print_media_type: true 
    } 
end 

javascript_delay只有當它不在ajax中才有效。

no_stop_slow_script我不知道甚至會發生什麼。

在我看來,window.status可能是我唯一的選擇,只要我能讓它停止掛。 任何人都可以幫忙嗎?

鏈接,我發現這個想法會幫助,並解釋了更好的我的要求: https://groups.google.com/forum/#!msg/wkhtmltopdf-general/vWDe5hUAyJ8/2XbXM2g1ZtYJ

回答

0

怎麼樣在你的Ajax設置window.status = 'ready'成功方法裏面,並添加window_status: 'ready'pdfkit.rb

+0

這不提供這個問題的答案。一旦你有足夠的[聲譽](https://stackoverflow.com/help/whats-reputation),你將可以[對任何帖子發表評論](https://stackoverflow.com/help/privileges/comment);相反,[提供不需要提問者澄清的答案](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-c​​an- I-DO-代替)。 - [來自評論](/ review/low-quality-posts/18226282) – Jodocus