Search code examples
t-sqlpdfsp-send-dbmaildbmail

Create PDF document in SQL


I am writing a stored procedure in T-SQL that sends mail. I am looking to add an attachment to these emails. I have an html string that I would like to convert to pdf and attach to my email.

I am using selectPDF to convert my html to pdf.

Can this all be done in sql or do I have to write an application for creating the pdf document?


Solution

  • I've had good luck with iTextSharp in the past. iTextSharp Project

    You would be looking at a wrapper CLR function around that, but yes it can be done.

    As a side note too you could also design a SSRS report and automate that too...