Copied to clipboard

Flag this post as spam?

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


  • Palle Hansen 143 posts 396 karma points
    Jun 25, 2014 @ 13:52
    Palle Hansen
    0

    path error

    Hi.
    I've just installed the package in umb. 7.1.4 and that went well.
    But when I'm trying to render a page like http://localhost:1510/about/pdf I get the error:

    Could not find file 'C:\inetpub\wwwroot\vers714\www\Public\App_Data\pdfs\about.pdf'.

    And it's complaining about this:
    c:\inetpub\wwwroot\vers714\www\Public\Views\pdf.cshtml    Line: 25

    Line 25:     Response.WriteFile(path);

    Does any one knows why or is there an issue here.

    /Palle

  • keilo 568 posts 1023 karma points
    Jul 05, 2014 @ 17:43
    keilo
    0

    I too have the same issue on 7.1.4 and 7.2. Cross-checked the permissions and permissions are ok for the folder (i.e. i can write to that folder with a test razor script) but gives the path error when tried to be rendered via /pdf.

  • Nicolás Cova 48 posts 120 karma points
    Aug 06, 2014 @ 23:08
    Nicolás Cova
    0

    Hey Palle,

    I ran across the same error today working on a v6.1.6 site. This error occurs because the file "about.pdf" does not exist in your pdf directory. I took the liberty of looking into the pdf.cshtml file and it looks like they don't create the pdf file before trying to write data into it (hence, the Response.WriteFile(path) method fails). They do check if the pdf directory exists and they create it if it's missing.

    I added a few lines of code that (after checking if the pdf directory exists) check if the pdf file exists and creates it if it's missing. After that, if I try to render a page via /pdf, I get the file download dialog as expected. The problem is that I get an empty pdf file. It seems to me that the package can't write data to the file. Like keilo mentioned in his post, I checked every permission possible and everything is in order. I think this package needs more work.

  • Palle Hansen 143 posts 396 karma points
    Aug 07, 2014 @ 07:58
    Palle Hansen
    0

    Hi Nicolás.

    Thanks for your reply.
    Well, I have to find another way around to make pdf files. I've used pdfcreator from Blakpoint before,and it's almost okay.
    Your not able to make a lot of styling in that one.

    /Palle 

     

  • Antony Briggs 78 posts 103 karma points
    Aug 13, 2014 @ 12:50
    Antony Briggs
    1

    Hi Both,

    This package generates the PDFs by running an executable program on your server - there's not many hosts that will allow this (Azure does, bizarrely).

    The error you're seeing around the Response.WriteFile line is due to the exe having not ran to produce the PDF file.

    The quality of the PDFs wkhtmltopdf generates is very good but it's quite an intensive process and could easily lead to DoS attacks on your server.

    Essentially, if your content editors are generating the PDFs for storage on the server then wkhtmltopdf is a good solution but don't expose it to end users.

    There are commenrial alternatives like Moriyama's package for Umbraco or ABC.PDF from websupergoo.

  • keilo 568 posts 1023 karma points
    Aug 13, 2014 @ 13:12
    keilo
    0

    Hi Antony

    Thanks for the reply and pointers, not worried about DoS. Was hoping to get it to work somehow or rather.

    I have checked the file permissions and even assigned "Everyone" with full access and yet its still not working.

    This is on Win7x64 on U7.1.4 w MSSQL

    Can you share how to make it work? 

    cheers

  • Antony Briggs 78 posts 103 karma points
    Aug 13, 2014 @ 13:19
    Antony Briggs
    0

    Well, the user that your website is running under needs execute permissions on the App_data/wkhtmltopdf folder in order to run the exe.

    In IIS, go to the appropriate app pool for your site and look under Advanved Settings->Identity. By default this will be "ApplicationPoolIdentity". Change it to Network service and ensure that the Network service user has execute permissions in the App_data/wkhtmltopdf folder (and write permissions in the App_Data/pdfs/ folder).

    Also, check that the wkhtmltopdf.exe file is in the App_data/wkhtmltopdf folder!

    TTFN

  • keilo 568 posts 1023 karma points
    Aug 13, 2014 @ 16:07
    keilo
    0

    Hi Antony

    I just gone through again, ensuring App Pool Identity is Network Service for the site and the folders(cross checked) have full access for Network Service user account. The .exe files are in place, no problem there. 

    After all that, the error is the same when i try to render a simple page via /pdf added ; (i have again, checked with a razor script that I can write to that folder within the website ). 

    Line 23:     Response.AddHeader("content-disposition", "attachment; filename=" + filename);
    Line 24:     Response.ContentType = "application/pdf";
    Line 25: Response.WriteFile(path); Line 26:     Response.Flush();
    Line 27:     Response.End();
  • Chris 8 posts 77 karma points
    Aug 20, 2014 @ 14:57
    Chris
    1

    Hey Guys

    I was getting the same error message too, for me the issue was in line 7 of the pdf.cshtml template as I’m running Umbraco on my dev machine and line 7 doesn’t take into account port numbers.

    Original Line 7:

    Line 7: var url = Request.Url.Scheme + "://" + Request.Url.Host + Request + Model.Content.Url;
    

    I’ve updated Line 7 to:

    Line 7: var url = Request.Url.Scheme + "://" + Request.Url.Host + ":" + Request.Url.Port + Model.Content.Url;
    
  • keilo 568 posts 1023 karma points
    Aug 20, 2014 @ 15:16
    keilo
    0

    Hi Chris

    Even with that, adding the port, it gives the same result. I would be interested to know how you managed to make it work...

  • Chris 8 posts 77 karma points
    Aug 20, 2014 @ 16:38
    Chris
    1

    Hi Keilo

    Does the wkhtmltopdf.exe work from command line? You should be able to open up a command prompt, "cd" to the folder it's located in and type in something like:

    wkhtmltopdf.exe http://google.com google.pdf
    

    If this doesn't generate the pdf try downloading exe files directly from http://wkhtmltopdf.org/downloads.html, installing it, and then copying the files over the existing ones.

  • keilo 568 posts 1023 karma points
    Aug 20, 2014 @ 18:58
    keilo
    0

    Hi Chris

    Thank you! I didnt really think of that and assumed the one that comes with the package would work - apparently it doesnt.

    I have downloaded the latest wkhtmltopdf and it works!

    Thanks again. I believe this solves the issues being reported and it should be marked as the solution for this thread, along with update in the code to specify the port in case server runs on a different port than 80.

    cheers!

Please Sign in or register to post replies

Write your reply to:

Draft