public static void ClearTraceLog() { PDFTraceLog log; if (IsInWebContext) { log = WebLog; } else { log = _threadlog; } if (log is IDisposable) { ((IDisposable)log).Dispose(); } if (IsInWebContext) { WebLog = null; } else { _threadlog = null; } }
public static PDFTraceLog InitTraceLog(TraceRecordLevel level) { PDFTraceLog log; if (IsInWebContext) { log = WebLog; } else { log = _threadlog; } if (log is IDisposable) { ((IDisposable)log).Dispose(); } log = CreateTraceLog(level); if (IsInWebContext) { WebLog = log; } else { _threadlog = log; } return(log); }
public static PDFTraceLog GetLog() { PDFTraceLog log; if (IsInWebContext) { log = WebLog; if (null == log) { log = CreateTraceLog(); WebLog = log; } } else { log = _threadlog; //This is thread safe if (log == null) { log = CreateTraceLog(); _threadlog = log; } } return(log); }
public PDFContextBase(PDFItemCollection items, PDFTraceLog log, PDFPerformanceMonitor perfmon, IPDFDocument document) { this._format = OutputFormat.PDF; this._log = log; if (null == log) { _log = new Logging.DoNothingTraceLog(Scryber.TraceRecordLevel.Off); } _shouldLogDebug = TraceRecordLevel.Diagnostic >= _log.RecordLevel; _shouldLogVerbose = TraceRecordLevel.Verbose >= _log.RecordLevel; _shouldLogMessage = TraceRecordLevel.Messages >= _log.RecordLevel; this._items = items; this._perfmon = perfmon; this._doc = document; }
public static void AddLog(PDFTraceLog log) { //if (null == log) // throw new ArgumentNullException("log"); //PDFTraceLog current = GetLog(); //PDFTraceLog composite; //if (current is Scryber.Logging.DoNothingTraceLog) // composite = log; //else // composite = new Logging.CompositeTraceLog(new PDFTraceLog[] { current, log }); //if (IsInWebContext) // WebLog = composite; //else // _threadlog = composite; }
/// <summary> /// Adds all the performance monitor entries onto the specified trace log /// </summary> /// <param name="log"></param> public void OutputToTraceLog(PDFTraceLog log) { if (null == log) { return; } foreach (PDFPerformanceMonitorEntry entry in this) { log.Add(TraceLevel.Message, "Performance Timings", "Total for " + entry.MonitorKey + ": " + entry.MonitorElapsed + " for " + entry.MonitorCount + " calls"); if (entry.HasMeasurements && log.ShouldLog(TraceLevel.Verbose)) { foreach (PDFPerformanceMonitorMeasurement measure in entry.GetMeasurements()) { log.Add(TraceLevel.Verbose, "Perfromance Timings", "Measured " + entry.MonitorKey + ": " + measure.Key + " took " + measure.Elapsed); } } } }
public PDFLayoutContext(Style style, PDFOutputFormatting format, PDFItemCollection items, PDFTraceLog log, PDFPerformanceMonitor perfmon, IPDFDocument document) : base(new StyleStack(style), items, log, perfmon, document) { this._format = format; }
public PDFWriter CreateWriter(Document forDoc, System.IO.Stream outputStream, int generation, PDFTraceLog log) { if (null == this.WriterFactory) { IDocumentPasswordSettings settings = null; if (forDoc.PasswordProvider != null && forDoc.PasswordProvider.IsSecure(forDoc.LoadedSource, out settings)) { this.WriterFactory = GetSecureWriter(forDoc, settings); } else if (forDoc.Permissions.HasRestrictions) { if (forDoc.ConformanceMode == ParserConformanceMode.Lax) { forDoc.TraceLog.Add(TraceLevel.Error, "Writer", "No Password provider has been set on the document, so using a random password for this generation. As a minimum an owner password should be set."); Guid pass = Guid.NewGuid(); var passS = pass.ToString().Substring(14); forDoc.PasswordProvider = new Secure.DocumentPasswordProvider(passS); forDoc.PasswordProvider.IsSecure(forDoc.LoadedSource, out settings); this.WriterFactory = GetSecureWriter(forDoc, settings); } else { throw new System.Security.SecurityException("No Password provider has been set on the document, so restrictions cannot be applied. As a minimum an owner password should be set."); } } else { this.WriterFactory = GetStandardWriter(forDoc); } } return(this.WriterFactory.GetInstance(forDoc, outputStream, generation, this, log)); }
internal PDFContextStyleBase(Styles.StyleStack stylesstack, PDFItemCollection items, PDFTraceLog log, PDFPerformanceMonitor perfmon, IPDFDocument document) : base(items, log, perfmon, document) { this._stylestack = stylesstack; }
// // .ctor // #region public PDFWriter14(Stream stream, PDFTraceLog log) /// <summary> /// Creates a new PDFWriter14 to update the specified stream, and a tracelog to write to as required. /// </summary> /// <param name="stream"></param> /// <param name="log"></param> public PDFWriter14(Stream stream, PDFTraceLog log) : this(stream, 0, log, DefaultVersion) { }
public PDFInitContext(PDFItemCollection items, PDFTraceLog log, PDFPerformanceMonitor perfmon, IPDFDocument document) : base(items, log, perfmon, document) { }
/// <summary> /// Creates a new instance of the SVG Path parser, that reads path data and converts to a path data commands /// </summary> /// <param name="strict">If true then exceptions will be thrown if commands cannot be parsed or are not supported. /// If false then errors will be written to the log instead, and execution continues</param> /// <param name="log">The log (if any) to write to</param> public PDFSVGPathDataParser(bool strict, PDFTraceLog log) { this._strict = strict; this._log = log == null ? new Scryber.Logging.DoNothingTraceLog(TraceRecordLevel.Off) : log; }
internal PDFRenderContext(DrawingOrigin origin, int pageCount, PDFOutputFormatting format, Styles.StyleStack stack, PDFItemCollection items, PDFTraceLog log, PDFPerformanceMonitor perfmon, IPDFDocument document) : base(stack, items, log, perfmon, document) { this._origin = origin; this._offset = new PDFPoint(); this._space = new PDFSize(); this._pgCount = pageCount; this._pgindex = 0; this._format = format; }
// // .ctor // public PDFRenderContext(DrawingOrigin origin, int pageCount, PDFOutputFormatting format, Styles.Style root, PDFItemCollection items, PDFTraceLog log, PDFPerformanceMonitor perfmon, IPDFDocument document) : this(origin,pageCount,format, new Scryber.Styles.StyleStack(root), items, log, perfmon, document) { }
public PDFWriterPooled14(System.IO.Stream stream, int generation, PDFTraceLog log, Version vers) : base(stream, generation, log, vers) { InitStreamPool(DefaultPoolCount); }
// // .ctors // #region public PDFDataContext(PDFItemCollection items, PDFTraceLog log) /// <summary> /// Creates a new PDFDataContext with the item collection and trace log /// </summary> /// <param name="items"></param> /// <param name="log"></param> public PDFDataContext(PDFItemCollection items, PDFTraceLog log, PDFPerformanceMonitor perfmon, IPDFDocument document) : this(items, log, perfmon, new PDFDataStack(), document) { }
/// <summary> /// Creates a new PDFDataContext with the item collection, trace log, and data stack /// </summary> /// <param name="items"></param> /// <param name="log"></param> /// <param name="stack"></param> public PDFDataContext(PDFItemCollection items, PDFTraceLog log, PDFPerformanceMonitor perfmon, PDFDataStack stack, IPDFDocument document) : base(items, log, perfmon, document) { this._datastack = stack; }
/// <summary> /// Creates a new PDFWriter14 to update the specified stream, and a tracelog to write to as required. With the generation number and version /// </summary> /// <param name="stream"></param> /// <param name="gen"></param> /// <param name="log"></param> /// <param name="vers"></param> public PDFWriter14(Stream stream, int gen, PDFTraceLog log, Version vers) : base(stream, log) { this._docvers = vers; }