I have to send to user a e-ticket. The e-ticket is information about event, schedule, row, place, barcode and other information.
I have two way:
1. Create html markup, fill all fields, generate pdf file from html and send user in mail attachments.
2. A desinger create template file in pdf format. And, I open it, fill information and send user.
I have never worked with pdf and I need to you advice. What way is the simply and less wasteful (in sense of load of the server, etc.)?
Thanks.
For my experience, you have pros and cons in both solutions:
Solution 1:
PROS: once you find out a good library for making the HTML->PDF conversion, you have a pretty flexible solution, given that you just have to change your HTML markup (pretty simple operation) to obtain a new PDF layout.
CONS: the operation of converting HTML 2 PDF can be CPU consuming (depend on the size and complexity of your HTML markup) and you’re gonna bind your solution to a 3rd party component
TIP: you could use http://www.html-to-pdf.net/
Solution 2:
PROS: it’ll need very low resource to couple toghether the layout and the data you need to put on it; morever you’ll only need a free library (iText.Net) that is considered to be the standard library to manipulate PDF documets.
CONS: it won’t be that flexible, ’cause you need to modify both the pdf layout and the code to fill it, in order to have a new e-ticket.
Conclusion
So, if you are planning to hange the layout of your e-tickets very frequently, go with the first one, otherwise, I’d choose the second option.