Calling Prince from ASP

Prince can be called from ASP pages using the ActiveX/COM interface.

This interface is provided in the form of an ActiveX DLL file that needs to be registered in the Windows registry using REGSVR32.EXE:

regsvr32 C:\Prince\PRINCE.dll

In order to call Prince from an ASP page, we need to create a COM object using the CreateObject server method. Once the COM object is created, you can use the COM interface methods to perform the tasks.

The following is some sample code for illustration:

ASP

<%
Dim pr
Dim res

Set pr = Server.CreateObject("PrinceCom.Prince")
pr.SetPrincePath "C:\Prince\engine\bin\prince.exe"
pr.AddStyleSheet "C:\Prince\css\test1.css"
pr.AddStyleSheet "C:\Prince\css\test2.css"
pr.SetEncryptInfo 128, "password1", "password2", true, true, true, true

If pr.Convert("C:\Prince\examples\magic.html", "C:\output.pdf") = 1 Then
    res = "Successful"             
Else
    res = "Unsuccessful"
End If
%>