/// <summary> /// Renders a single ZPT document and returns a response. /// </summary> /// <param name="doc">The document to render.</param> /// <param name="outputStream">The output stream.</param> /// <param name="options">Rendering options.</param> /// <param name="contextConfigurator">Context configurator.</param> /// <param name="outputInfo">Output info.</param> protected override IBatchRenderingDocumentResponse Render(IZptDocument doc, Stream outputStream, IRenderingSettings options, Action<IModelValueContainer> contextConfigurator, string outputInfo) { try { return base.Render(doc, outputStream, options, contextConfigurator, outputInfo); } catch(ZptException ex) { return new BatchRenderingDocumentResponse(doc.GetSourceInfo(), ex); } }
/// <summary> /// Renders a single ZPT document and returns a response. /// </summary> /// <param name="doc">The document to render.</param> /// <param name="outputStream">The output stream.</param> /// <param name="options">Rendering options.</param> /// <param name="contextConfigurator">Context configurator.</param> /// <param name="outputInfo">Output info.</param> protected virtual IBatchRenderingDocumentResponse Render(IZptDocument doc, Stream outputStream, IRenderingSettings options, Action<IModelValueContainer> contextConfigurator, string outputInfo) { using(var writer = new StreamWriter(outputStream, options.OutputEncoding)) { doc.Render(writer, options: options, contextConfigurator: contextConfigurator); } return new BatchRenderingDocumentResponse(doc.GetSourceInfo(), outputInfo); }