We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Generate pdf from template?

I’m doing searching for creating pdf files programmatically.
may you know, if there is an option to generate pdf from a template?
I thought about the option to handle HTML file as the template (.cshtml? ) and then convert it to pdf. but I’m wondering if there is any efficient way?


Aspose.PDF provides functionality to generate PDF from HTML as well as other file formats. Do you have any specific format in which you are preparing templates? OR is it .cshtml only? Please share how and what issues are you facing while generating PDFs from your template by sharing the sample files and sample code snippet so that we can test the scenario in our environment and address it accordingly.

this is not an issue, I’m still searching.
Currently, we have, from another provider- the option to render HTML string to pdf.
we considering using the Aspose.cell and checking if we can use also the Aspose.PDF also.
Yesterday I’ve checked the option to convert an excel file via cell (with template) and export it as pdf. the time-consuming was almost 20sec (avg). I’m looking for another efficient way (if you have one)


Regarding Aspose.Cells, please create an inquiry in Aspose.Cells Support Forum and you can please try converting the HTML String to PDF directly using Aspose.PDF by following the example given in the linked article. In case you still face delay issue, please share the sample string with us so that we can test the scenario in our environment and address it accordingly.


I’ve opened ticket at cells, but not sure if this is what we looking for.
I’m checking if there is another way to create a pdf from the template.
let’s say I have an array of data and some templates ( you name the format) and all the software has to do is to combine with these and export the pdf to stream. same, fast as we generate the excel file from the template.
attached here are some POC I created, but the time is around (500-600 pages) 22sec. (create excel from template, convert to pdf)

exmaple folder.zip (6.0 MB)


In your shared project, you are using Aspose.Cells to read the template and generate PDF output. Please note that this forum is dedicated to Aspose.PDF only. We are afraid that we cannot provide any feedback related to the performance issue in Aspose.Cells here. As requested earlier, please create a post in Aspose.Cells forum (if this inquiry is different than the one you already posted there) where you will be assisted accordingly.

Furthermore, as you are building an Excel file from data. You can try building a DataTable from it and convert it into PDF in form of tables. Please follow the example given in the below article and see if you are getting the expected performance.

thank you very much for your response,
Yes, I’ve opened ticket in Aspose.Cells and we take the path from there.

also, as you wrote, the way to create the PDF from data-table is a good starting. do we have an option to add some predefined design to the pdf before we insert the data? same as the “smart makers” I saw in Aspose.Cells (or any additional way to design the file - with less coding as posible)


Regarding design and formatting, can you please elaborate what type of formatting are your expecting? You can define margins, text colors, background color, fonts, etc. using the API. Please check the below article(s) in the API documentation: