// Reads the configuration settings and creates the appropriate Watermark objects public bool SetPageLocationWatermarkFromConfig(string pageLocation, SerializableStringDictionary configuration) { if (configuration != null) { if (configuration["watermark_type"] == "text") { PageLocations[pageLocation] = new TextWatermark(configuration["text"]) { FontName = configuration["font_name"], FontSize = Int32.Parse(configuration["font_size"]), FontStyle = configuration["font_style"], PageLocation = pageLocation }; if (configuration["add_timestamp"] == "Yes") { PageLocations[pageLocation].AddTimestampFlag = true; } } else if (configuration["watermark_type"] == "image") { PageLocations[pageLocation] = new ImageWatermark(configuration["image_location"]) { PageLocation = pageLocation }; } else if (configuration["watermark_type"] == "page_number") { bool show_total = false; if (configuration["show_total"] == "Yes") { show_total = true; } PageLocations[pageLocation] = new PageNumberer(configuration["text"], show_total) { FontName = configuration["font_name"], FontSize = Int32.Parse(configuration["font_size"]), FontStyle = configuration["font_style"], PageLocation = pageLocation }; } } return(true); }
public bool setPageLocationWatermarkFromConfig(string page_location, SerializableStringDictionary config_dict) { if (config_dict != null) { if (config_dict["watermark_type"] == "text") { page_locations[page_location] = new Text_Watermark(config_dict["text"]); page_locations[page_location].font_name = config_dict["font_name"]; page_locations[page_location].font_size = Int32.Parse(config_dict["font_size"]); page_locations[page_location].font_style = config_dict["font_style"]; if (config_dict["add_timestamp"] == "Yes") { page_locations[page_location].add_timestamp = true; } page_locations[page_location].page_location = page_location; } else if (config_dict["watermark_type"] == "image") { page_locations[page_location] = new Image_Watermark(config_dict["image_location"]); page_locations[page_location].page_location = page_location; } else if (config_dict["watermark_type"] == "page_number") { bool show_total = false; if (config_dict["show_total"] == "Yes") { show_total = true; } page_locations[page_location] = new PageNumberer(config_dict["text"], show_total); page_locations[page_location].font_name = config_dict["font_name"]; page_locations[page_location].font_size = Int32.Parse(config_dict["font_size"]); page_locations[page_location].font_style = config_dict["font_style"]; page_locations[page_location].page_location = page_location; } } return(true); }