/// <summary> /// Builds a <see cref="SlipSheet"/> instance. /// </summary> /// <returns>Returns a <see cref="SlipSheet"/> instanc.</returns> public SlipSheet Build() { SlipSheet instance = this.instance; this.instance = null; return(instance); }
/// <summary> /// Gets the slipsheet image of a specific document. /// </summary> /// <param name="docid">The docid of the target document.</param> /// <returns>Returns an image if the document has a slipsheet. /// Otherwise returns null.</returns> public Image GetSlipSheetImage(string docid) { Image img = null; if (slipsheetLookup.ContainsKey(docid)) { SlipSheet ss = slipsheetLookup[docid]; img = ss.GetImage(); } return(img); }
/// <summary> /// Saves a slipsheet to the provided destination. The destination will /// be created if it does not exist. The path value is prepended with the /// volume directory. /// </summary> /// <param name="path">The destination to write the slipsheets.</param> /// <param name="slipsheet">The slipsheet to create.</param> protected void writeSlipsheet(string path, SlipSheet slipsheet) { path = path.TrimStart('\\'); string ssPath = (destinationDir != null) ? Path.Combine(destinationDir.FullName, path) : path; FileInfo ssFile = new FileInfo(ssPath); if (!Directory.Exists(ssFile.Directory.FullName)) { Directory.CreateDirectory(ssFile.Directory.FullName); } logger.Debug("Writing slipsheet to {0}.", ssPath); slipsheet.SaveImage(ssPath); }
/// <summary> /// Generates slipsheet for a document collection. /// </summary> public void GenerateSlipSheets(DocumentCollection docs) { Document previousDoc = null; foreach (Document doc in docs) { if (trigger != null && trigger.IsTriggered(doc, previousDoc)) { string text = getSlipSheetText(doc); SlipSheet ss = SlipSheet.Builder .Start(doc.Key, text) .SetFont(slipsheetFont) .SetResolution(resolution) .SetHorizontalTextPlacement(horizontalPlacement) .SetVerticalTextPlacement(verticalPlacement) .Build(); slipsheetLookup.Add(doc.Key, ss); } previousDoc = doc; } }
private Builder() { instance = new SlipSheet(); }