Okay
  Public Ticket #3114086
embedded PDF don't load in unit in WPLMS 4.4
Closed

Comments

  •  12
    MeesterGijs started the conversation

    Hello,


    My embedded PDF's don't load in a unit. Any idea why? Thisit what it looks like at live website. With this code underneath. Please help,

    [button url="https://meestergijs.nl/product/de-complete-uitleg/" class="other" bg="#ffd700" hover_bg="#1688b7" size="16px" color="#3f3f3f" hover_color="fff"  radius="0px" width="100%" height="0px" target="_blank"] >>  Wil je alle uitleg (slides en samenvattingen) op papier? Klik hier  << [/button]


    [pdf-embedder url="https://meestergijs.nl/PDF/Wederkerende-voornaamwoorden.pdf" title="Wederkerende voornaamwoorden"]


    <p> </p>


  •  390
    Ripul replied

    Since browsers natively support PDF's. A Better way would to use the IFrame shortcode.

    [iframe]https://meestergijs.nl/PDF/Wederkerende-voornaamwoorden.pdf[/iframe] since you are using third party shortcode it is possible it has some function which run on Page load, so page load of single unit while preview shows correct PDF when unit loaded via API it fails to initialise.

  •   MeesterGijs replied privately
  • [deleted] replied

    Hi in wplms v4 there is better way to embed pdf now with new front end editor which prevent user from downloading the pdf as well . 

    we can try checking your paid addon code it we can make it work . 

    Please share the plugin , we can check its code but it will need some time to check it .

  •   MeesterGijs replied privately
  • [deleted] replied

    Well can you please share the zip file of the plugin its premium plugin.

  •   MeesterGijs replied privately
  • [deleted] replied

    Hi made it work : 

    https://prnt.sc/RUwf1o1-mDOq


    had to add this code : 


    add_action('wp_head',function(){
    ?>

    <script type="text/javascript" id="pdfemb_embed_pdf_js-js-extra">
    /* <![CDATA[ */
    var pdfemb_trans = {"worker_src":"https:\/\/staging-meestergijs.kinsta.cloud\/wp-content\/plugins\/PDFEmbedder-premium\/js\/pdfjs\/pdf.worker.min.js","cmap_url":"https:\/\/staging-meestergijs.kinsta.cloud\/wp-content\/plugins\/PDFEmbedder-premium\/js\/pdfjs\/cmaps\/","objectL10n":{"loading":"Laden...","page":"Pagina","zoom":"Zoom","prev":"Vorige pagina","next":"Volgende pagina","zoomin":"Zoom In","zoomout":"Zoom Uit","secure":"Beveiligen","download":"Download PDF","fullscreen":"Volledig scherm","domainerror":"Fout: URL naar het PDF-bestand moet op precies hetzelfde domein als de huidige webpagina.","clickhereinfo":"Klik hier voor meer info","widthheightinvalid":"PDF-paginabreedte of hoogte zijn ongeldig","viewinfullscreen":"Weergave in volledig scherm"},"continousscroll":"","poweredby":"","ajaxurl":"https:\/\/staging-meestergijs.kinsta.cloud\/wp-admin\/admin-ajax.php"};
    /* ]]> */
    </script>
    <?php
    });
    add_filter('wplms_load_dynamic_scripts',function($scripts){

    $scripts[] = array('id'=>'pdf','src'=>plugins_url().'/vibebp/assets/js/pdfjs.js?ver=1.8.9.1');
        $scripts[] = array('id'=>'pdf','src'=>plugins_url().'/PDFEmbedder-premium/js/all-pdfemb-premium-5.0.2.min.js');
        $scripts[] = array('id'=>'pdf','src'=>plugins_url().'/PDFEmbedder-premium/js/pdfjs/pdf-5.0.2.min.js');
        
        return $scripts;
    });


  •  12
    MeesterGijs replied

    That's amazing! Thank you so much. That must have been a lot of work.

    I really appreciate it, thanks Alex. When I try to view the pdf I see this. Just that it's loading. No pdf. Even after a minute. What could that be?

    Gijs

  • [deleted] replied

    where exactly is this appearing in which course?

  •  12
    MeesterGijs replied

    This is the url: https://staging-meestergijs.kinsta.cloud/app/#component=course&action=course&id=6148

    It's the course Woordvolgorde, and the first unit; SAMENVATTING

  •  12
    MeesterGijs replied

    Dear Alex,

    I've tried two devices, three different IP addresses and still not loading. It works on your end, that's great. But what could it be? If it works on your pc, but not on mine pc.... Then what could fix it?

    Gijs

  • [deleted] replied

    Caching could be the reason .I checked with student creds and it was working for me .

  •  12
    MeesterGijs replied

    Still doesn't work. Ok,let's try something else. WPLMS also offers option to embedd pdf. But it gives my students the option to download and to print. How can I eliminate these options when embedding pdf? And how can I show just the pdf, 1 page at a time without the sidebar?

    Should I follow the advice you give here?

    Thanks

  • [deleted] replied

    N o please use the new front end editor , it will not provide users to download the pdf . 

    https://prnt.sc/iaJcVLsY4438


    also the fix I made is working when I check .

  •  12
    MeesterGijs replied

    I can now add PDF in front end editor. Thanks! But I prefer how it looks with the PDF embedder plugin; different feeling/look. How come you can see the pdf but I can't? After exiting the page and returning to it I was able to see the pdf. Any idea? Maybe we can fix that!

  • [deleted] replied

    I dont know there are other issues which I fixed and you are not seeing its effect on your side . 

    Please try with a different machine maybe .

    .


  •  12
    MeesterGijs replied

    Let's close for now. The first time I tried (two minutes ago) I got the same blank page and text.. When I clicked the unit again in the navigation on the left it DID load the PDF. And every other course I tried after that also loaded the PDF. So maybe it's fixed.

    Thanks!

  •  12
    MeesterGijs replied

    Hello, Alex.

    Sorry that I start this ticket again. But something is wrong... See this video: http://somup.com/c3QFq1UBhr

    So I'm thinking of embedding PDF's using front end course manager. And no longer use the paid plugin. And for that to be an option I need to get rid of the options to print and download PDF. How can I delete these two options?

    Thanks,

    Gijs

  • [deleted] replied

    this is how you have to add pdf : 

    https://somup.com/c3QqXGUB9M

  •  12
    MeesterGijs replied

    Thanks Alex. Looks much better.

    Any idea how I can change the background color and move the pdf navigation?


  • [deleted] replied

    sorry that is not possible as of now.

  •  12
    MeesterGijs replied

    Thanks for the help. Let's close