0

I am at a loss and could use some direction. I have a windows service that performs an Audit on customers. For new customers, I need to create a profile for each one. I already have a ASP.net C# web page that displays a single customer profile for the user:

http://webserver/showprofile.aspx?id=CustomerID

I would like to run some type of loop in the service that would render each new customer's profile and output all of those profiles into a PDF, Word Document, etc. Is there an easy way to do this using the existing Show Profile webpage?

If not, what is the best way to do this in C#? If it requires a component, I would prefer something free to very inexpensive. I currently have licenses for Telerik's complete line of tools if there is something there that can help. The bottom line, this has to be done programmatically as the user will have nothing to do with the generation/export to PDF. They will only access the resulting exported file.

Thanks in advance for your help.

ThaKidd KG5ORD
  • 1,535
  • 3
  • 24
  • 38
  • Search for 'HTML to PDF': http://stackoverflow.com/search?q=%5B.net%5D+html+to+pdf – ZippyV Apr 26 '13 at 11:15
  • I've had a similar problem and used ABCpdf in one of my projects. It was really easy to use, however it's not free. You still get a free trial for 30 days though, so might want to check it out. http://goo.gl/o258E – Trogvar Apr 26 '13 at 11:36
  • I already figured I would have to get some kind of html to pdf component. My main question though is how do you render the web page and dump the html format? Something like foreach (var client in customerList) { htmlOutput = htmlOutput + The Dump From Each HTML Render } – ThaKidd KG5ORD Apr 26 '13 at 19:41

1 Answers1

1

You can use PdfCreator using the following command:

private PDFCreator.clsPDFCreator printer;
printer = new PDFCreator.clsPDFCreator();
printer.cDefaultPrinter = "PDFCreator";

printer.cOptions.UseAutosave = 0;

// Format in which file is to be saved. 0 if for pdf.
printer.cOptions.AutosaveFormat = 0;
printer.cClearCache();

printer.cStart();  
foreach(int CustomerId in CustomerIDs)//array of customer ids as an example
 {
printer.cPrintURL("http://webserver/showprofile.aspx?id=" + CustomerID.ToString());
 }

You can download the software and necessary dll at the following link and look at the examples in the .net folder.

http://sourceforge.net/projects/pdfcreator/

Ari Pollack
  • 50
  • 1
  • 6
  • I ended up doing a work-around to solve this issue using ABCPDF. I will give your answer a shot though as I am not satisfied at this point. – ThaKidd KG5ORD Jul 19 '13 at 05:27