/// <summary> /// Create a new GhostscriptJob instance /// </summary> /// <param name="jobInfo">JobInfo of the job to convert</param> /// <param name="profile">Profile that determines the conversion process</param> /// <param name="tempFolder"> /// TempFolderProvider that gives the full Temp path, i.e. C:\Users\Admin\Local /// Settings\Temp\clawPDF /// </param> /// <param name="jobTranslations">Translations needed for the job</param> /// <param name="fileWrap">Only for testing</param> /// <param name="directoryWrap">Only for testing</param> public GhostscriptJob(IJobInfo jobInfo, ConversionProfile profile, JobTranslations jobTranslations, ITempFolderProvider tempFolder, IFile fileWrap, IDirectory directoryWrap) : base(jobInfo, profile, jobTranslations, fileWrap, directoryWrap) { var gsVersion = new GhostscriptDiscovery().GetBestGhostscriptInstance(); if (gsVersion == null) { Logger.Error("No valid Ghostscript version found."); throw new InvalidOperationException("No valid Ghostscript version found."); } Logger.Debug("Ghostscript Version: " + gsVersion.Version + " loaded from " + gsVersion.DllPath); _ghostScript = new GhostScript(gsVersion); JobTempFolder = PathSafe.Combine(tempFolder.TempFolder, "Job_" + PathSafe.GetFileNameWithoutExtension(PathSafe.GetRandomFileName())); JobTempOutputFolder = PathSafe.Combine(JobTempFolder, "tempoutput"); DirectoryWrap.CreateDirectory(JobTempFolder); DirectoryWrap.CreateDirectory(JobTempOutputFolder); // Shorten the temp folder for GS compatibility //缩短临时文件夹以实现GS兼容性 JobTempFolder = JobTempFolder; }
public XpsJob(IJobInfo jobInfo, ConversionProfile profile, JobTranslations jobTranslations) : base(jobInfo, profile, jobTranslations) { JobTempFolder = Path.Combine(Path.Combine(Path.GetTempPath(), "clawPDF\\Temp"), "Job_" + Path.GetFileNameWithoutExtension(Path.GetRandomFileName())); JobTempOutputFolder = Path.Combine(JobTempFolder, "tempoutput"); Directory.CreateDirectory(JobTempFolder); Directory.CreateDirectory(JobTempOutputFolder); }
public static IJob CreateJob(IJobInfo jobInfo, ConversionProfile conversionProfile, ITempFolderProvider tempFolder, JobTranslations jobTranslations) { if (jobInfo.JobType == JobType.XpsJob) { return(new XpsJob(jobInfo, conversionProfile, jobTranslations)); } return(new GhostscriptJob(jobInfo, conversionProfile, tempFolder, jobTranslations)); }
protected AbstractJob(IJobInfo jobInfo, ConversionProfile profile, JobTranslations jobTranslations, IFile fileWrap, IDirectory directoryWrap) { FileWrap = fileWrap; DirectoryWrap = directoryWrap; TempOutputFiles = new List <string>(); OutputFiles = new List <string>(); JobActions = new List <IAction>(); Passwords = new JobPasswords(); JobTranslations = jobTranslations; AutoCleanUp = true; JobInfo = jobInfo; Profile = profile; TokenReplacer = GetTokenReplacer(); //important for testing without workflow }
protected AbstractJob(IJobInfo jobInfo, ConversionProfile profile, JobTranslations jobTranslations) : this(jobInfo, profile, jobTranslations, new FileWrap(), new DirectoryWrap()) { }
/// <summary> /// Create a new GhostscriptJob instance /// </summary> /// <param name="jobInfo">JobInfo of the job to convert</param> /// <param name="profile">Profile that determines the conversion process</param> /// <param name="tempFolder"> /// TempFolderProvider that gives the full Temp path, i.e. C:\Users\Admin\Local /// Settings\Temp\clawPDF /// </param> /// <param name="jobTranslations">Translations needed for the job</param> public GhostscriptJob(IJobInfo jobInfo, ConversionProfile profile, ITempFolderProvider tempFolder, JobTranslations jobTranslations) : this(jobInfo, profile, jobTranslations, tempFolder, new FileWrap(), new DirectoryWrap()) { }