public OutputVisitorResult Visit(OutputStream outputStream) { var fileName = _tempFileManager.CreateTempFile(content: null); return(new OutputVisitorResult() { OutputFile = fileName }); }
public VisitorResult Visit(InputHtmlString inputString) { var fileName = _tempFileManager.CreateTempFile(inputString.HtmlString); return(new VisitorResult() { File = fileName }); }
private WkHtmlToPdfParametersInternal GenerateInternalParameters( IInputData[] inputFiles, string outputPdfFilePath, string coverHtml, WKHtmlToPDFParameters parameters, TempFileManager tempFileManager) { WkHtmlToPdfParametersInternal pdfParametersInternal = new WkHtmlToPdfParametersInternal() { OutputFileParameter = new OutputFileParameter(value: outputPdfFilePath), CoverFileParameter = string.IsNullOrWhiteSpace(coverHtml) == false ? new CoverFilePathParameter(value: tempFileManager.CreateTempFile(coverHtml), customWkHtmlCoverArgs: parameters.CustomWkHtmlCoverArgs) : null, HeaderFilePathParameter = parameters.PageHeaderHtml?.IsEnabled() == true ? new HeaderFilePathParameter(value: tempFileManager.CreateTempFile(parameters.PageHeaderHtml.GetContent())) : null, FooterFilePathParameter = parameters.PageFooterHtml?.IsEnabled() == true ? new FooterFilePathParameter(value: tempFileManager.CreateTempFile(parameters.PageFooterHtml.GetContent())) : null }; InputFileProvider fileProvider = new InputFileProvider(tempFileManager); foreach (var inputData in inputFiles) { var htmlFile = inputData.Accept(fileProvider); var headerParam = new PageHeaderHtmlParameter() { Enabled = string.IsNullOrWhiteSpace(inputData.PageHeaderHtml) == false, PageHeaderHtml = inputData.PageHeaderHtml }; var footerParam = new PageFooterHtmlParameter() { Enabled = string.IsNullOrWhiteSpace(inputData.PageFooterHtml) == false, PageFooterHtml = inputData.PageFooterHtml }; var headerFilePathParameter = headerParam.IsEnabled() == true ? new HeaderFilePathParameter(value: tempFileManager.CreateTempFile(headerParam.GetContent())) : null; var footerFilePathParameter = footerParam.IsEnabled() == true ? new FooterFilePathParameter(value: tempFileManager.CreateTempFile(footerParam.GetContent())) : null; var zoom = inputData.Zoom.HasValue ? new ZoomParameter() { Value = inputData.Zoom.Value } : parameters.ZoomGlobal; pdfParametersInternal.InputFileParameters.Add( new InputFileParameter( value: htmlFile.File, customWkHtmlPageArgs: parameters.CustomWkHtmlPageArgsGlobal, headerFilePath: headerFilePathParameter, footerFilePath: footerFilePathParameter, zoom: zoom)); } return(pdfParametersInternal); }