Where are using PDFCreator version 2.1.0 and we have a workflow calling a cs script to add a custom password to the PDF, each PDF has a different password and is passed via token
The script is:
using NLog;
using pdfforge.CustomScriptAction;
using pdfforge.PDFCreator.Conversion.Jobs.Jobs;
using pdfforge.PDFCreator.Conversion.Settings;
using pdfforge.PDFCreator.Utilities.Tokens;
public class SetFilenameInPreConversionCreateBackUpInPostConversionScript : IPDFCreatorScript
{
public ScriptResult PreConversion(Job job, Logger logger)
{
try
{
var userTokenValue = job.TokenReplacer.GetToken("User").GetValueWithFormat("PDFPassword");
if (userTokenValue != null || userTokenValue != "")
{
job.Profile.PdfSettings.Security.Enabled = true;
job.Profile.PdfSettings.Security.RequireUserPassword = true;
job.Passwords.PdfOwnerPassword = userTokenValue;
job.Passwords.PdfUserPassword = userTokenValue;
}
return ScriptResult.Success;
}
catch (Exception e)
{
logger.Error(e, "Exception during CS-Script PreConversion");
return ScriptResult.Abort;
}
}
public ScriptResult PostConversion(Job job, Logger logger)
{
try
{
return ScriptResult.Success;
}
catch (Exception e)
{
logger.Error(e, "Exception during CS-Script PostConversion");
return ScriptResult.Abort;
}
}
}
But sometimes wew receive this error and the queue doesn't print anything more:
[Error] pdfforge.PDFCreator.Core.Workflow.ConversionWorkflow.RunWorkflow: Error CustomScript_ErrorDuringCompilation: Invalid Profile [Warn] pdfforge.PDFCreatorServer.Service.ServiceCore.JobProcessing.WorkerManager.DoWork: Print job 69 was not successful: C:\Windows\TEMP\PDFCreator Server\Spool\XXX.inf
Any idea?