Skip to content

This is a demo applciation for Umbraco Template to Html

Notifications You must be signed in to change notification settings

IbrahimMNada/TemplateToPdf.Demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TemplateToPdf.Demo

This is a demo applciation for Umbraco Template to Pdf

Backoffice Log in :

Username :admin@demo.com PassWord: Admin12345

What is this package for?

This package is desgined to convert Umbraco Content into a Pdf while you have full control of what the pdf will look like using the Umbraco back office!

Getting Started

  1. 2.1 First Thing First:

    Download the package using:

dotnet add package Our.Umbraco.TemplateToPdf

2.2 Add 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 here :

https://github.com/uppercuut/TemplateToPdf.Demo/tree/master/TemplateToPdf.Demo/wwwroot/TemplateToPdf

The live folder location must be:

**“/wwwroot/TemplateToPdf/wkhtmltopdf.exe” ** if the folder “TemplateToPdf” is not there then create it.

2.3 Configuring Startup.cs:

Add this line to the startup file and you are ready to go!

builder.AddTemplateToPdf();

like the image below:

image

Usage

This package is so simple to use. All you have to do is create a Url and let the browser redirect to it. You can use a builder from the Package that will help you a lot:

var pdfUrl = new PdfUrlBuilder().UsingGetByIdMethod().WithTemplateAlias("").AddPdfFileName("").Url(); this line will generate a url to be imbeded in any page or any where !

Untitled2

And this is what the Template looks like :

Untitled

and @model IPublishedContent to bind the page to a loose model

Thats it!

Example:

Let me give an exmaple of how this package works and one of its uses! (we will walk through a scenario from A to Z)

Using Umbraco Starter-kit, I added a button to the bottom of each one of those cool people to download thier resumes: 139023905-54d7e6db-5a46-41d6-96e1-b88a75369d71-min

Now! When you click on the button it will open up a pdf file, take its content from UmbracoCms and the structure/style from a Template also in Umbraco!

This is the template used => 139024501-c26c9b75-4eeb-4b90-899a-def7ba3a783f-min

Now let's see the content : Here we see the details for each Person : 139024974-08b043db-cb2e-4ae8-b259-6d799ec514ff-min

Now let's check the Pdf! : 139025176-d4f964cb-14f0-432f-8027-17b83d201d2e-min

Now! Let's say we want to make his name a different color and change a few lines of the Objective text
Those are our changes, we saved and published them: 139025595-3553ff95-2bc9-481a-9ed2-109e4b1e7bbf-min (1)

Now to see the new pdf. All you have to do is refresh !! 139026247-3c7a6d9e-4a94-4fc4-aaa2-2e7ccaece65d-min

This is pretty much the TemplateToPdf Package.

About

This is a demo applciation for Umbraco Template to Html

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published