Copied to clipboard

Flag this post as spam?

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


  • Levente Kosa 136 posts 352 karma points
    May 28, 2015 @ 20:57
    Levente Kosa
    0

    Download link on the site

    Hi,

    I'm just starting to use this plugin, but I have a problem/question.
    I would like to place a Download button on one of my cshtml page, with which the users can generate/download a part of the page, just images.

    How can I do that? I little help would be great.

    Thanks 

  • Darren Ferguson 1022 posts 3259 karma points MVP c-trib
    May 29, 2015 @ 13:53
    Darren Ferguson
    0

    Hi Levente - I'm not sure I understand the question.

    You want to create a PDF containing images that are part of the page?

    The samples that come with PDF creator should show how to do that. If they aren't helpful then please provide some more detail.

    Many Thanks.

  • Levente Kosa 136 posts 352 karma points
    Jun 01, 2015 @ 23:43
    Levente Kosa
    0

    For example I have a cshtml, within a foreach, which is generate an image list, e.g:

    foreach (var coverImage in coverImagesCollection.Where("Visible"))
    {
       <img src="@coverImage.Url" />
    }

    I would like to place a button to this page, which is generate a PDF with these images. How can I do this. I don't fully understand where should I place the FO code (same cshtml or somewhere else). If this should be in one file, how can I use together (my foreach and the FO code).

    I hope this helps.

    Thanks

  • Darren Ferguson 1022 posts 3259 karma points MVP c-trib
    Jun 02, 2015 @ 13:47
    Darren Ferguson
    0

    You'll need a separate Umbraco template to output the pdf and you can link to that from within your Umbraco page.

    There are some sample FO templates that come with PDF creator that should get you started. Have you read the manual and watched the video tutorials?

    Thanks.

  • Levente Kosa 136 posts 352 karma points
    Jun 02, 2015 @ 15:40
    Levente Kosa
    0

    OK, so I have a cshtml with my images, and I have another cshtml with the FO template, which is go through the images what I need.
    Just one thing I still don't know that how can I link the FO template to my normal cshtml page?

  • Darren Ferguson 1022 posts 3259 karma points MVP c-trib
    Jun 03, 2015 @ 08:54
    Darren Ferguson
    100

    You just pust the name of the template on the end of the URL e.g.

    /my/page/url/pdftemplate

    or use Umbraco altTemplate syntax e.g.

    /my/page/url?altTemplate=pdftemplate

  • Levente Kosa 136 posts 352 karma points
    Jun 03, 2015 @ 09:22
    Levente Kosa
    0

    Thank you.

    Probably something wrong in my code. I tried with the attached example template (PdfMvcHelloWord.cshtml), but I got 404.

    <a href="@CurrentPage.Url?altTemplate=PdfMvcHelloWorld">Pdf</a>

    or

    <a href="@CurrentPage.Url/PdfMvcHelloWorld">Pdf</a>

    I'm going to keep trying.

     

  • Levente Kosa 136 posts 352 karma points
    Jun 03, 2015 @ 23:58
    Levente Kosa
    0

    My url path was wrong. I used alttemplate and it worked perfectly.

    Thank you for your help!

  • Levente Kosa 136 posts 352 karma points
    Jun 04, 2015 @ 01:23
    Levente Kosa
    0

    Maybe just another question. It' about the generated filename. I try to make it dynamic, but I have some problem with the pdf extension.

    I've tried different way, maybe you already managed somehow.

    This is what I have now, but still got an error:

    string pdf = ".pdf";
    Response.AppendHeader("X-Pdf-Force-Download", @CurrentPage.Name.Replace(" ", "-")@pdf );

    This is working within root, just not here.
    Any idea? 

  • Levente Kosa 136 posts 352 karma points
    Jun 05, 2015 @ 02:51
    Levente Kosa
    0

    Hi,

    Response.AppendHeader("X-Pdf-Force-Download", @CurrentPage.Name.Replace(" ", "-") + ".pdf"); 

    Thank you for your help!

Please Sign in or register to post replies

Write your reply to:

Draft