Open an embedded PDF link after click of an anchor tag












1














Am working on a Laravel project whereby am fetching some response from an API and storing in a variable. Basically the response is pdf document code which when clicked will open as a PDF document on the browser,,



After fetching it am storing in a variable and then passing to the view. On the view I Have created an anchor tag which when clicked the embedded document should open but it aint working as expected



Controller Hitting the API and getting the response



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();
}


Response after dd($quotePdf)



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


Anchor tag on the viw which when clicked the div containing embedded PDF should open



<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>









share|improve this question





























    1














    Am working on a Laravel project whereby am fetching some response from an API and storing in a variable. Basically the response is pdf document code which when clicked will open as a PDF document on the browser,,



    After fetching it am storing in a variable and then passing to the view. On the view I Have created an anchor tag which when clicked the embedded document should open but it aint working as expected



    Controller Hitting the API and getting the response



    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();
    }


    Response after dd($quotePdf)



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


    Anchor tag on the viw which when clicked the div containing embedded PDF should open



    <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>









    share|improve this question



























      1












      1








      1







      Am working on a Laravel project whereby am fetching some response from an API and storing in a variable. Basically the response is pdf document code which when clicked will open as a PDF document on the browser,,



      After fetching it am storing in a variable and then passing to the view. On the view I Have created an anchor tag which when clicked the embedded document should open but it aint working as expected



      Controller Hitting the API and getting the response



      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();
      }


      Response after dd($quotePdf)



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


      Anchor tag on the viw which when clicked the div containing embedded PDF should open



      <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>









      share|improve this question















      Am working on a Laravel project whereby am fetching some response from an API and storing in a variable. Basically the response is pdf document code which when clicked will open as a PDF document on the browser,,



      After fetching it am storing in a variable and then passing to the view. On the view I Have created an anchor tag which when clicked the embedded document should open but it aint working as expected



      Controller Hitting the API and getting the response



      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();
      }


      Response after dd($quotePdf)



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


      Anchor tag on the viw which when clicked the div containing embedded PDF should open



      <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>






      laravel pdf cross-browser embed






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited yesterday

























      asked yesterday









      Martin

      110110




      110110





























          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53944475%2fopen-an-embedded-pdf-link-after-click-of-an-anchor-tag%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown






























          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53944475%2fopen-an-embedded-pdf-link-after-click-of-an-anchor-tag%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Monofisismo

          Angular Downloading a file using contenturl with Basic Authentication

          Olmecas