Laravel:Laravel Snappy生成错误“退出状态代码'-1073741819'”

时间:2019-09-17 06:28:36

标签: php laravel wkhtmltopdf html-to-pdf laravel-snappy

我正在使用laravel-snappy生成html页面的pdf,但出现此错误:

The exit status code '-1073741819' says something went wrong:


stderr: "Loading pages (1/6)


[>                                                           ] 0%

[======>                                                     ] 10%

[======>                                                     ] 11%

Warning: Failed to load http://127.0.0.1:8000/css/app.css (ignore)

 ◀
Warning: Failed to load http://127.0.0.1:8000/fullcalendar/packages/core/main.css (ignore)


Warning: Failed to load http://127.0.0.1:8000/fullcalendar/packages/daygrid/main.css (ignore)


Warning: Failed to load http://127.0.0.1:8000/fullcalendar/packages/core/main.js (ignore)


Warning: Failed to load http://127.0.0.1:8000/fullcalendar/packages/interaction/main.js (ignore)


Warning: Failed to load http://127.0.0.1:8000/fullcalendar/packages/daygrid/main.js (ignore)


Warning: Failed to load http://127.0.0.1:8000/fullcalendar/packages/timegrid/main.js (ignore)


Error: Failed to load http://127.0.0.1:8000/js/jQuery.min.js, with network status code 99 and http status code 0 - Unknown error


"


stdout: ""


command: C:\xampp\htdocs\EDO_Roster\vendor\wemersonjanuario\wkhtmltopdf-windows\bin\wkhtmltopdf --lowquality --enable-javascript --javascript-delay "5000" --enable-smart-shrinking --no-stop-slow-scripts "C:\Users\razaz\AppData\Local\Temp\knp_snappy5d807944516442.29719528.html" "C:\Users\razaz\AppData\Local\Temp\knp_snappy5d80794451ccb4.67360917.pdf".

显然这是一个URL错误,我已经尝试了许多通过堆栈溢出可用的解决方案,但都是徒劳的。我的html页面如下:

<!DOCTYPE html>
<html>
<head>
    <title>EDO Roster</title>
    <link rel="stylesheet" href="{{ URL::asset('css/app.css') }}">          
    <link href='{{ URL::asset('fullcalendar/packages/core/main.css') }}' rel='stylesheet' />
    <link href='{{ URL::asset('fullcalendar/packages/daygrid/main.css') }}' rel='stylesheet' />
</head>
<body>


    <div class="col-md-9 m-lg-5">
          <div class="box box-primary p-sm-4">
            <div class="box-body">
              <!-- THE CALENDAR -->
                <h3>EDO Roster</h3>

                  <hr>
                  <div id="calendar" ></div>
            </div>
            <!-- /.box-body -->
          </div>
          <!-- /. box -->
        </div>

</body>
</html>
<script src="{{ URL::asset('fullcalendar/packages/core/main.js') }}"></script>
<script src="{{ URL::asset('fullcalendar/packages/interaction/main.js') }}"></script>
<script src="{{ URL::asset('fullcalendar/packages/daygrid/main.js') }}"></script>
<script src="{{ URL::asset('fullcalendar/packages/timegrid/main.js') }}"></script>
<script src="{{ URL::asset('js/jQuery.min.js') }}"></script>

<script>
$(document).ready(function() {
      var calendarEl = document.getElementById('calendar');
      var calendar = new FullCalendar.Calendar(calendarEl, {
          plugins: [ 'interaction', 'dayGrid', 'bootstrap', 'timeGrid' ],
          themeSystem: 'bootstrap',
           header: {
          left: false,
          center: 'title',
          },
          defaultView: 'dayGridMonth',
          validRange: {
            start: '2019-08-26',
            end: '2019-09-26',
          },   
          selectable: true,
          editable  : true,
          droppable : true,

          eventSources: [

            {
              url: '{{"roster/getEvents"}}',
              allDay: false,
              allDayMaintainDuration: false,
              textColor: 'black',

            },

            {
              url: '{{"roster/getGazette"}}',
              editable: false,
              id: 'a',
              overlap: false,
            },
          ],
        });

      calendar.render();
      });

</script>

我尝试给它提供一个硬编码的URL,但效果不佳。我假设laravel-snappy不会加载JS和CSS。请看一下,并在此方面为我提供帮助。

P.S:非常感谢html-to-pdf的任何建议。

1 个答案:

答案 0 :(得分:0)

没人回答这个问题,所以我继续努力,通过用URL::asset替换file:///complete-URL来减少错误,这样我摆脱了“未能加载错误”的问题,但仍然没有加载该文件只是为了检查页面上已删除的脚本,因此可以正常工作,因此问题出在脚本中,这是荒谬的,因为laravel-snappy应该可以使用javascript。

现在,由于该问题不再重要,因此我将关闭此问题。