/// <summary> /// Prints the pitch book. /// </summary> /// <param name="biographyIds">The biographyIds.</param> /// <param name="projectId">The project id.</param> /// <param name="username">The username.</param> /// <returns></returns> public static string PrintPitchBook(string projectId, string biographyIds = null, string articleIds = null, string serviceIds = null, string relatedContentIds = null, string username = null, string resultFileName = null, string publishingFolder = null) { if (string.IsNullOrEmpty(projectId)) { projectId = defaultProjectId; } var db = Sitecore.Context.ContentDatabase ?? Sitecore.Context.Database; var manager = new Sitecore.PrintStudio.PublishingEngine.PrintManager(db, Sitecore.Context.Language); var parameters = new SafeDictionary<string, object>(); if (!string.IsNullOrEmpty(biographyIds)) { parameters.Add("BiographyIds", biographyIds); } if (!string.IsNullOrEmpty(username)) { parameters.Add("Weil_Username", username); } if (!string.IsNullOrEmpty(articleIds)) { parameters.Add("ArticleIds", articleIds); } if (!string.IsNullOrEmpty(serviceIds)) { parameters.Add("ServiceIds", serviceIds); } if (!string.IsNullOrEmpty(relatedContentIds)) { parameters.Add("relatedContentIds", relatedContentIds); } var printOptions = new PrintOptions { PrintExportType = PrintExportType.Pdf, UseHighRes = true, Parameters = parameters, ResultFolder = publishingFolder ?? PublisherFolder }; if (string.IsNullOrEmpty(resultFileName)) { printOptions.ResultFileName = String.Format(fileNameFormat, "PitchBook", db.GetItem(projectId).Name.Replace(" ", "_"), DateTime.Now.Ticks, printOptions.ResultExtension, username); } else { printOptions.ResultFileName = resultFileName; } return manager.Print(projectId, printOptions); }
/// <summary> /// Prints a biography pdf for specified attorney and based on passed project id. If project ID is not passed in it takes default id from const above. /// </summary> /// <param name="id">The id.</param> /// <param name="projectId"></param> /// <returns></returns> public static string PrintBiography(string id, string projectId = null) { var manager = new Sitecore.PrintStudio.PublishingEngine.PrintManager(DB, Sitecore.Context.Language); var printOptions = GetPrintOptions(id, projectId); return manager.Print(projectId, printOptions); }