Copied to clipboard

Flag this post as spam?

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


  • Dan Soule 33 posts 194 karma points
    May 24, 2017 @ 15:37
    Dan Soule
    0

    PDF Creator default razor template directory and Umbraco 7.6.1 template editor mismatch.

    Umbraco 7.6.1 - the directories used by PDF creator for Razor files appear to be /masterpages same as previous versions. However the Template editor in Umbraco used to look in /views first and by default would create new templates there. If you deleted the file in /views then the editor would look in /masterpages and you could then edit your file. with 7.6.1 the Umbraco template editor only looks in /views and does not recognize /masterpages which is what PDF creator is expecting at run-time.

  • Darren Ferguson 1022 posts 3259 karma points MVP c-trib
    May 24, 2017 @ 19:48
    Darren Ferguson
    0

    Hi Dan,

    I'm not sure I follow?

    A PDF creator template can be a View or a Masterpage - It doesn't require that you have a template in masterpages.

    I can't quite picture what is happening from the description above. Do you get an error when trying to edit a template? Or does it just not load the Masterpage any more when you try to edit it?

    I don't think that I can make the Umbraco template editor open a masterpage, but it should be pretty easy to make the PDF creator template into a View if you want to edit it via the back office.

    Thanks.

  • Dan Soule 33 posts 194 karma points
    May 24, 2017 @ 20:55
    Dan Soule
    0

    Thanks for the response Darren, PDF creator does not find the Razor Template if it only exists in the /Views directory. It gives an error about the physical template file not being found. That does not bother me so much as I can keep my templates in the /masterpages directory, but the problem is that the Umbraco editor (starting with the 7.6 release) no longer looks in the /masterpages directory for templates, so when I try to edit a template in the editor it comes up blank. In order to get things to work with existing templates I had to create new PDF templates using the editor so that Umbraco knew they existed, and then delete them manually from the /views directory, this way at PDF run-time, the PDF engine does go to the /masterpages directory and finds the template and creates the PDF.

    The work around is as follows: 1. Create a new template using Umbraco editor 2. Move the template from /views to /masterpages 3. Edit the template in /masterpages manually using a text editor 4. At run-time the template in /masterpages is used even if a template with the same name exists in /views

    Hope this better describes the situation. This problem did not exist in 7.5.10 it only started in 7.6 if that is of any help.

  • Darren Ferguson 1022 posts 3259 karma points MVP c-trib
    May 28, 2017 @ 11:01
    Darren Ferguson
    0

    Hi Dan,

    I think I understand the issue :)

    The "physical template file not found" error message is an Umbraco one, not a PDF creator one.

    A PDF creator template is just a standard Umbraco template - if you remove the Output PDF header from the template it'll just output XML.

    I'm guessing there is some bug in the fallback to a masterpage in the new version of Umbraco?

    It is a bit hard to visualise, but I'd be happy to have a skype call/hangout if that'd help you out?

  • Dan Soule 33 posts 194 karma points
    Jul 31, 2017 @ 18:32
    Dan Soule
    0

    A standard umbraco install in 7.6.1 thru 7.6.4 does not include a /masterpages directory. when I install PDFcreator the example files are placed in the /view directory and they can be edited using the Umbraco editor. The problem comes when I try to use one of these PDFcreator templates I get the "file not found error" because PDFcreator is expecting the template to exist in /masterpages. Somewhere in the PDFcreator code the directory for the templates appears to be hard coded to /masterpages or maybe there is configuration file that determines the template directory that PDFcreator uses because clearly it is not find template files that are defined in the /view director and yet the Umbraco editor can find the template files so this does not appear to be an Umbraco problem.

  • Darren Ferguson 1022 posts 3259 karma points MVP c-trib
    Aug 02, 2017 @ 07:42
    Darren Ferguson
    0

    Hello Dan -

    I just installed on 7.6.4.

    Post install I ran the following SQL to remove the old Masterpage templates:

    delete from cmsTemplate where alias in ('PDFMaster', 'PDFRazorExample', 'PDFRazorHelloWorld', 'PDFRazorHelperExample', 'PDFXsltExample', 'PDFXsltHelloWorld')

    After that - I restarted the website which I needed to do so that the templates were removed from the Umbraco back office.

    Next, I created a new template via the Umbraco back office - and pasted ~/Views/PdfMvcExample.cshtml

    After following these steps, the PDF template rendered correctly.

    In the longer term - I need to update the package to remove the old masterpage templates.

    I hope this helps?

Please Sign in or register to post replies

Write your reply to:

Draft