private void Run() { JsonConvert.DefaultSettings = () => new JsonSerializerSettings { Formatting = Formatting.None, Converters = new JsonConverter[] { new JsonKnownTypeConverter() } }; const string applicationId = "54b841f7606fe6302029d607"; IUnityContainer container = new UnityContainer().LoadConfiguration(); IFormServiceGateway formServiceGateway = container.Resolve<IFormServiceGateway>(); ISecurityService securityServiceGateway = container.Resolve<ISecurityService>(); SecureSession session = securityServiceGateway.CreateSession("Administrator", "dws!1114"); Application application = formServiceGateway.GetApplication(session, applicationId); ProductDefinition product = formServiceGateway.GetProduct(session, application.FormId, null); PdfWriterSettings settings = new PdfWriterSettings { BorderColourHex = "333333", FontColourHex = "333333", FontFace = "Verdana", FontSize = "9pt", HeaderLogoUri = @".\dws-logo.png", HeaderRowBackgroundHex = "015998", HeaderRowFontColourHex = "ffffff", MetaAuthor = "iApply", MetaTitle = "Application PDF" }; FileStream fileStream = new FileStream(@".\iapply.pdf", FileMode.Create); ApplicationPdfWriter writer = new ApplicationPdfWriter(settings); writer.WritePdfToStream(application, product.FormDefinition.Pages.AllControls, fileStream); /*ProductPdfWriter writer = new ProductPdfWriter(settings); writer.WritePdfToFilesystem(product, new ControlEntitlementList());*/ }
/// <summary> /// Initializes a new instance of the <see cref="ApplicationPdfWriter"/> class. /// </summary> /// <param name="settings">The settings.</param> public ApplicationPdfWriter(PdfWriterSettings settings) : base(settings) { }
/// <summary> /// Initializes a new instance of the <see cref="ProductPdfWriter"/> class. /// </summary> /// <param name="settings">The settings.</param> public ProductPdfWriter(PdfWriterSettings settings) : base(settings) { }
/// <summary> /// Initializes a new instance of the <see cref="PdfWriter"/> class. /// </summary> /// <param name="settings">The settings.</param> public PdfWriter(PdfWriterSettings settings) { this.Settings = settings; this.BorderColour = this.CreateColorFromHex(this.Settings.BorderColourHex); }
/// <summary> /// Initializes a new instance of the <see cref="ApiManager" /> class. /// </summary> /// <param name="securityService">A gateway into the Security subsystem.</param> /// <param name="formGateway">A gateway into the Forms subsystem.</param> /// <param name="workbenchManager">An instance that manages Workbench operations.</param> /// <param name="migrationDataImporter">A data importer.</param> /// <param name="migrationDataValidator">An import data validator.</param> /// <param name="apiDataAccess">The API data access layer.</param> /// <param name="pdfWriterSettings">A PDF writer settings object.</param> /// <param name="pdfFilenameFormat">The PDF filename format.</param> /// <param name="stringFormatter">A string formatter.</param> public ApiManager( ISecurityService securityService, IFormServiceGateway formGateway, WorkbenchManager workbenchManager, MigrationDataImporter migrationDataImporter, MigrationDataValidator migrationDataValidator, IDataAccess apiDataAccess, PdfWriterSettings pdfWriterSettings, string pdfFilenameFormat, StringFormatter stringFormatter) { this.securityService = securityService; this.formGateway = formGateway; this.workbenchManager = workbenchManager; this.migrationDataImporter = migrationDataImporter; this.migrationDataValidator = migrationDataValidator; this.apiDataAccess = apiDataAccess; this.pdfWriterSettings = pdfWriterSettings; this.pdfFilenameFormat = pdfFilenameFormat; this.stringFormatter = stringFormatter; }