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.

有帮助吗?

解决方案

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/

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top