Example code is for an older version of Server, newer code is available.
<!-- Copyright (c) 2021 ActivePDF, Inc. -->
<!-- ActivePDF Server 2009 -->
<!-- Example generated 02/27/21 -->
<!-- Example uses the .NET DLL which requires -->
<!-- Coldfusion 8 or above -->
<CFSCRIPT>
// Get current path
strPath = ExpandPath(".") & "\";
// Instantiate Object
oSVR = CreateObject(".NET", "APServer.Server", "C:\Program Files\activePDF\Server\bin\APServer.dll");
// Start Email
oSVR.AddEmail();
// Email server (IP or Domain Name)
oSVR.Set_SMTPServer("10.1.10.33");
// Email user details
oSVR.Set_EMailNameFrom("PDF Server");
oSVR.Set_EMailIDFrom("pdfserver@fakedomainname.com");
oSVR.Set_EMailReplyTo("pdfserver@fakedomainname.com");
oSVR.Set_EMailNameTo("Derek Andelin");
oSVR.Set_EMailTo("derek.andelin@activepdf.com");
oSVR.Set_EMailCC("activepdf@myfatback.com");
// Email details
oSVR.Set_EMailSubject("PDF Server Delivery");
oSVR.Set_EMailText("Here is your PDF!");
// Email attachment details
oSVR.Set_EMailAttachOutput(true);
oSVR.AddEMailAttachment(strPath & "confidential.txt");
// Convert the PostScript file into PDF
intPSToPDF = oSVR.PSToPDF(strPath & "PS.ps", strPath & "Email.pdf");
if(intPSToPDF != 0) {
Error("PSToPDF", intPSToPDF);
}
// Clear email options used when not clearing the Server object
oSVR.RemoveEMail("pdfserver@fakedomainname.com");
oSVR.ClearEMailAttachments();
oSVR.ClearEMails();
// Release Object
oSVR = 0;
// Process Complete
WriteOutput("Done!");
// Error Handling
Function Error(method, outputCode) {
WriteOutput("Error in " & method & ": " & outputCode);
}
</CFSCRIPT>