none
Placing the view of a PDF document on a Custom List Form RRS feed

  • Question

  • Hello All,

    I have a Custom SharePoint Library Form with documents uploaded. I want to show the view of the PDF document that's uploaded for the item on the custom list/library form. Any help will be appreciated.

    Mike W


    SharePoint Engineer - Mike


    Wednesday, September 4, 2019 7:48 PM

All replies

  • Hi Mike,

    Use iframe tag in the custom library form to display the Pdf content like this:

    <iframe width="560" height="345" src="FileUrl" frameborder="0" ></iframe>

    Reference:

    SharePoint 2010: How to Embed PDF and Text File Contents into Pages

    Thanks

    Best Regards


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Thursday, September 5, 2019 2:59 AM
  • This is possible using Page Viewer Web Part in SharePoint to show the document file on any SharePoint Page.

    But, I am not sure if there is any Page Viewer Web Part available in SharePoint 2010?

    If it is available then you can follow below steps to add File on SharePoint Page using Page Viewer Web Part:

    1. Go to your SharePoint page.
    2. Add web part from : Media and Content > Page Viewer Web Part > Insert
    3. Edit web part properties.
    4. Keep web part settings as "Web Page"(first option in web part properties).
    5. Copy the link of a document file in a document library from the ellipsis(...) with ?Web=1.
    6. Paste URL in the Link field of web part.
    7. Click Apply.
    8. Resize web part height from "Appearance" if needed.
    9. Save page.

    Note:

    1. The URL to the Word/PDF file will end with the parameter ?Web=1 after the file name as this is what makes a office document open in Office Web Apps. So keep it as it is.

    2. If the office Web Apps installed and connected to your SharePoint farm then it will render the document file on the web page inside Word Web App.

    You can find the detailed answer in below link:

    How do I open a document in a web part

    Thursday, September 5, 2019 4:51 AM
  • Thanks. However it needs to be the current pdf uploaded to the library item form which shows on the Edit Form and Display form, not just any form.

    SharePoint Engineer - Mike


    Thursday, September 5, 2019 1:46 PM
  • Thanks. However it needs to be the current document library item that's uploaded to the library item which shows on the Edit form and Display Form.

    


    SharePoint Engineer - Mike


    Thursday, September 5, 2019 1:47 PM
  • Hi Mike, 

    You can create a new list new/edit form and customize based on your requirement, then using SharePoint Designer and set as default list edit/display form, then you can get the current uploaded file name from Name control:

    <script type="text/javascript" src="https://code.jquery.com/jquery-3.4.1.js"></script>
    <script type="text/javascript">
    $(document).ready(function(){
    
    var fileurl=_spPageContextInfo.webAbsoluteUrl+"/shared documents/"+$("input[title='Name Required Field']").val()+".pdf";
    console.log(fileurl);
    
    });
    </script>
    

    Then use this url in iframe to display the uploaded pdf content.

    Thanks

    Best Regards


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Friday, September 6, 2019 1:17 AM
  • Customizing the form with Designer is not the way I would like to go. I would like to use JQuery or something out the box. Any help you can give would be appreciated. Thank you.

    SharePoint Engineer - Mike


    Friday, September 6, 2019 11:29 PM
  • Hi Mike,

    If you want to use Jquery code to customize something, you could also use SharePoint Designer, add into list form directly,here is a demo to use Jquery in list form:

    Using jQuery in SharePoint List Form

    Thanks

    Best Regards


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.


    Saturday, September 7, 2019 2:24 AM
  • Sure. I'll give it a try, but can you give me a few more steps so I can set this up? We do plan to migrate to SharePoint 2016 in 3 months, but needs this solution up and running.

    Mike W


    SharePoint Engineer - Mike

    Saturday, September 7, 2019 7:27 AM
  • Hi Mike,

    You can refer the following demo, I tested in libray default display form with iframe to show the pdf file:

    <script type="text/javascript" src="https://code.jquery.com/jquery-3.4.1.js"></script>
    <script type="text/javascript">
    $(document).ready(function(){
    
    var fileurl=$("#SPFieldFile>a").attr("href");
    $("#pdfiframe").attr("src", fileurl);
    
    });
    </script>
    <iframe width="560" height="345" src= "" frameborder="0" id="pdfiframe" ></iframe>
    

    Pdf file url comes from the file name <a> href attribute, you can check with Developer Tool:

    iframe display the test Pdf in myside like this in Chrome:

    About adding the code to the display form, open the page using SharePoint Designer and add the code snippet under PlaceHolderMain tag:

    Hope these steps will be helpful to you.

    Thanks

    Best Regards


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Saturday, September 7, 2019 2:12 PM
  • Hi Mike,

    Would you please provide a update of this question ?

    Thanks

    Best Regards


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Wednesday, September 11, 2019 6:25 AM