# Copyright (c) 2021 ActivePDF, Inc. # ActivePDF Server 2013 # Example generated 04/17/21 require 'win32ole' # Get current path strPath = File.expand_path(File.dirname(__FILE__)) + "\\" # Instantiate Object oSVR = WIN32OLE.new("APServer.Object") # Add an email oSVR.AddEMail() # Set server information oSVR.SetSMTPInfo('0.0.0.0', 25) oSVR.SetSMTPCredentials('john.doe', 'activePDF', 'asdfasdf') # Set email addresses oSVR.SetSenderInfo('John Doe', 'john.doe@asdidlwenra.com') oSVR.SetReplyToInfo('John Doe', 'john.doe@asdidlwenra.com') oSVR.SetRecipientInfo('Jane Doe', 'jane.doe@asdidlwenra.com') oSVR.AddToCC('Jim Doe', 'jim.doe@asdidlwenra.com') oSVR.AddToBcc('Janice Doe', 'janice.doe@asdidlwenra.com') # Subject and Body oSVR.EMailSubject = 'PDF Delivery from activePDF' oSVR.SetEMailBody('<html><body style='background-color: #EEE; padding: 4px;'>Here is your PDF!</body></html>', true) # Attachments - Binary attachments can be added with AddEMailBinaryAttachment oSVR.AddEMailAttachment(strPath + 'x.pdf') # Other email options oSVR.EMailReadReceipt = false oSVR.EMailAttachOutput = true # Convert the PostScript file into PDF results = oSVR.ConvertPSToPDF(strPath + 'PS.ps', strPath + 'email.pdf') if results.ServerStatus != 0 puts "Error with ConvertPSToPDF:" puts "#{results.ServerStatus}" puts results.Details exit 1 end # If running multiple conversions in one instance: # One email can be removed before the next conversion oSVR.RemoveEMail('john.doe@activepdf.com') # An attachment can be removed oSVR.ClearEMailAttachments() # or all emails can be removed oSVR.ClearEMails() # Release Object oSVR = '' # Process Complete puts "Done!"