Forum Documentation

.NET Accessory Package

swsdam
So I downloaded Prince and can use the desktop model fine. It's awesome!

Now I'm working on calling it from ASP.NET 2.0. I've downloaded the Prince .NET accessory package (r2). Where do I put the DLL and how do I use it?
mikeday
You should be able to add the DLL to your project, then it should recognise the Prince interfaces when you type in "Dim p as New Prince..." or words to that effect.
swsdam
Thanks! It seems to appear in the folder with the rest of my apps now.
lcarlson
Can you provide a little more detail?

 Prince myPrince = new Prince();
 myPrince.SetLog(@"C:\princelog.log");
 myPrince.Convert(xmlFile, pdfFile);


Provides me with the error: Cannot start process because a file name has not been provided.

If, according to one of the posts, I change the first line to:
Prince myPrince = new Prince(@"C:\Program Files\Prince\Prince.exe");


It brings up the user interface. This works, but what I'm looking for is to background convert xml (w/CSS) to PDF in C#.

Thanks,
Lynn
mikeday
Use "C:\Program Files\Prince\Engine\Bin\Prince.exe".
lcarlson
Fantastic! I knew that I was missing something. For anyone who needs it:

string inFile = @"C:\ElementCSS.xml"; // Assume file exists with 
                                                                //correctly associated CSS file
string pdfFile = @"C:\myPDF.pdf";       // This file gets overwritten
Prince myPrince = new Prince(@"C:\Program Files\Prince\Engine\Bin\Prince.exe");
myPrince.SetLog(@"C:\princelog.log"); //Provides logging for debug
myPrince.Convert(inFile, pdfFile);         //Performs conversion


Thank you!! I've searched all over for this capability.