单击锚标记后,打开一个嵌入式PDF链接

时间:2018-12-27 11:39:54

标签: laravel pdf cross-browser embed

我正在一个Laravel项目中,正在从API获取一些响应并将其存储在变量中。基本上,响应是pdf文档代码,单击该代码将在浏览器中将其打开为PDF文档,

提取后,将其存储在变量中,然后传递给视图。在视图上,我创建了一个 anchor标记,单击该标记时应打开嵌入式文档,但它不能按预期工作

控制器点击API并获取响应

public function createQuote(){
    $dat = [
        'sts_quote_number' => $quoteRef
    ];

    //STS PDF Quote
    $quotePdf= $this->global_Curl_Meta(
        $dat, 'api/v1/travel/sts-quote-doc')->data;

    //dd($quotePdf);

    $quote_data = view("B2C::travel.quote", compact('quotePdf'))->render();
}

响应dd($ quotePdf)

data:application/pdf;base64,JVBERi0xLjQKJaqrrK0KNCAwIG9iago8PAovQ3JlYXRvciAoQXBhY2hlIEZPUCBWZXJzaW9uIFNWTiB0YWdzL2ZvcC0xXzEpCi9Qcm9kdWNlciAoQXBhY2hlIEZPUCBWZXJzaW9uIFNWTiB0YWdzL2ZvcC0xXzEpCi9DcmVhdGlvbkRhdGUgKEQ6MjAxODEyMjcxMTQwMDYrMDInMDAnKQo+PgplbmRvYmoKNSAwIG9iago8PAogIC9OIDMKICAvTGVuZ3RoIDExIDAgUgogIC9GaWx0ZXIgL0ZsYXRlRGVjb2RlCj4+CnN0cmVhbQp4nJ2Wd1RU1xaHz713eqHNMNIZeu9tAOldQHoVhWFmgKEMMMwAIjZEVCCiiIhgAwkKGDAaisSKKBaCggL2gAQBJQaj2FDJjKyV+PLy3svL7497v7XP3ueeXc5aFwCSdyorLQuWAiCNJ+AHe7nSI6Oi6dh+AAM8wAAzAJisrAz/EM9QIJKPhxs9S+QE/kWvhwEkft8yEu8F/j9JszL4AgCgQBFbsDlZLBEXijg1R5Ahts+KmBqfImYYJWa+6IAilhNz4iIbfvZZZGcxs9N4bBGLz5zBTmOLuUfEW7OFHBEjfiIuyuZyckR8W8SaqcI0rojfimPTOExRDiiS2C7gsJJEbCpiEj802E3ESwHAkRK/4PgvWMDJFYiTckvPWM3nJiYJ6LosPbqZrS2D7s3JSeUIBEaBTFYKk8+mu6WnZTB5qwFYzPmzZMS1pYuKbG1ma21tZG5s9kWh/uvi35S4t4v0MuhzzyBa3x+2v/.....

viw上的锚标记,单击该标记时应打开包含嵌入式PDF的div

<td colspan="2">
      <i class="fas fa-print quote"></i> 
      <!--Anchor tag to click-->
      <a href="#d">Print Quote</a>

      <!--The div to open-->
      <div id="d"><embed src="{{ $quotePdf }}" height="750px" width="750px"></div>
</td>

0 个答案:

没有答案