Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • mikkel 143 posts 365 karma points
    Mar 11, 2019 @ 08:38
    mikkel
    0

    How do i make a link to a pdf file so my users can read from front end

    Hi every one. I'm about to make a page for a sports club. They have a lot of documents in pdf format, which they would like a page with where it is possible to see them, but how do i link to a pdf document? . Now I have tried to find a solution to google and I cannot find anyone. Perhaps I have search wrong, but how to do it?

  • Dirk De Grave 4537 posts 6006 karma points MVP 3x admin c-trib
    Mar 11, 2019 @ 09:14
    Dirk De Grave
    100

    Hi mikkel,

    Upload the pdf in media section (as a result, it's a media item), and use this guideline to fetch the media item and render it in a view

    https://our.umbraco.com/Documentation/Getting-Started/Design/Rendering-Media/

    --Dirk

  • mikkel 143 posts 365 karma points
    Mar 11, 2019 @ 10:21
    mikkel
    0

    Hi Dirk Thanks i Will try that 👍🏻

  • mikkel 143 posts 365 karma points
    Mar 11, 2019 @ 11:38
    mikkel
    1

    Thanks for your help :D i solved it with this code here

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage<ContentModels.Vedtaegter>
    @using ContentModels = Umbraco.Web.PublishedContentModels;
    @{
        Layout = "master.cshtml";
        var selection = Model.Content.Site().FirstChild("vedtaegter").Children().OrderBy("CreateDate desc");
    
    }
    <ul>
        @foreach (var item in selection)
        {
            <li>
                <a href="@Umbraco.TypedMedia(item.GetPropertyValue<int>("vedtaegtNy")).Url">@item.Name</a>
            </li>
        }
    </ul>
    
  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies