我有我需要從我的Rails應用程序中包括頁眉和頁腳的HTML轉換PDFs。這給我留下了wkhtmltopdf(如果還有其他選擇,請讓我知道!)對於較小的PDF,這種解決方案運行良好 - 但較大的PDF成爲一個問題。我現在使用一個delayed_job工作人員在後臺運行一個愛好者工具dyno - 這需要一段時間,但有時會起作用。對於較大的PDF(或有很多圖像的),我從來沒有得到結果。挖入日誌工人,我看到以下內容:wkhtmltopdf在Heroku工作時間運行時運行
2017-05-05T03:36:18.164514+00:00 heroku[worker.1]: Process running mem=666M(130.1%)
2017-05-05T03:36:18.164514+00:00 heroku[worker.1]: Error R14 (Memory quota exceeded)
2017-05-05T03:36:37.951774+00:00 heroku[worker.1]: Process running mem=804M(157.0%)
2017-05-05T03:36:37.951813+00:00 heroku[worker.1]: Error R14 (Memory quota exceeded)
2017-05-05T03:36:57.964496+00:00 heroku[worker.1]: Process running mem=944M(184.6%)
2017-05-05T03:36:57.964542+00:00 heroku[worker.1]: Error R14 (Memory quota exceeded)
2017-05-05T03:37:37.826785+00:00 heroku[worker.1]: Process running mem=1040M(203.2%)
2017-05-05T03:37:37.826861+00:00 heroku[worker.1]: Error R15 (Memory quota vastly exceeded)
2017-05-05T03:37:37.826932+00:00 heroku[worker.1]: Stopping process with SIGKILL
2017-05-05T03:37:37.985631+00:00 heroku[worker.1]: Process exited with status 137
2017-05-05T03:37:37.998614+00:00 heroku[worker.1]: State changed from up to crashed
2017-05-05T03:37:38.000020+00:00 heroku[worker.1]: State changed from crashed to starting
2017-05-05T03:37:45.825684+00:00 heroku[worker.1]: Starting process with command `rake jobs:work`
2017-05-05T03:37:46.532529+00:00 heroku[worker.1]: State changed from starting to up
2017-05-05T03:37:50.758067+00:00 app[worker.1]: [Worker(host:a5db76f8-58b3-4585-b664-eee04efb8a96 pid:4)] Starting job worker
2017-05-05T03:37:50.758157+00:00 app[worker.1]: I, [2017-05-05T03:37:50.758063 #4] INFO -- : 2017-05-05T03:37:50+0000: [Worker(host:a5db76f8-58b3-4585-b664-eee04efb8a96 pid:4)] Starting job worker
我清楚地運行到一個存儲牆(不知道如何解決這個問題,而不必購買更昂貴的測功機),但我認爲是好的...它應該只是分頁到磁盤,並採取更長的時間,對吧?我有一個在cloud9上使用相同配置設置的私有實例,這是它在那裏做的。有沒有辦法設置分頁選項?
那麼我該怎麼辦?我不在乎PDF是否需要2-3分鐘才能生成,我只是不想被終止!
謝謝!