This is a demo applciation for Umbraco Template to Html
Backoffice Log in :
Username :admin@demo.com PassWord: Admin12345
This package is desgined to convert Umbraco Cotnent into Pdf while you have a full control of what the pdf shall look like using confgration from Umbraco back office!
- 2.1 First Thing First: Download the package Using:
dotnet add package Our.Umbraco.TemplateToPdf
2.2 Adding The Core file you need to add a file called: wkhtmltopdf.exe this file is responsible for converting the Html inside of the template to Pdf. you can download it from here :
Life location must be: **“/ wwwroot/TemplateToPdf/wkhtmltopdf.exe” ** if the folder “TemplateToPdf” is not there create one.
2.3 Configuring the Startup.cs add this line to the startup file and you are ready to go!
services.AddTemplateToPdf(_env);
like the Image Bellow:
This package is so simple to use : All you have to use is to create a Url and let the browser redirect to it. You can use b builder from the Package that will help you alot
var pdfUrl = new PdfUrlBuilder().UsingGetByIdMethod().WithTemplateAlias("").AddPdfFileName("").Url(); this line will generate a url to be imbeded in any page or any where !
And this is how the Template looks like :
and @model IPublishedContent to bind the page to a loose model
Thats it
let me give an exmaple of how this package works and one of its usage! (we will walk a scenario from A to Z)
Using Umbraco Starter-kit, i added a button on the buttom of each one of those cool people to download thier resumes:
Now! when you click on the button it will open up a pdf file took its content from UmbracoCms and the structure/style from a Template also in Umbraco!
Now Lets see the Content : Here we got the details for each Person :
Now! Lets say we want to make his name on a different color and check a few lines on the objectve
Those are our changes we saved and published them:
now to see the new pdf , All you have to do is refresh !!
This is The Pretty much the TemplateToPdf Package