/// <summary> /// Creates a new PageSize using the paper and orientation /// </summary> /// <param name="paper">The specified paper size</param> /// <param name="orientation">The paper orientation</param> public PageSize(PaperSize paper, PaperOrientation orientation) : base(PDFObjectTypes.PageSize) { this.PaperSize = paper; this.Orientation = orientation; this.UpdateSizes(); }
public RtfDocument(PaperSize paper, PaperOrientation orientation, CultureInfo cultureInfo) { _paper = paper; _orientation = orientation; _margins = new Margins(); if (_orientation == PaperOrientation.Portrait) { _margins[Direction.Top] = DefaultValue.MarginSmall; _margins[Direction.Right] = DefaultValue.MarginLarge; _margins[Direction.Bottom] = DefaultValue.MarginSmall; _margins[Direction.Left] = DefaultValue.MarginLarge; } else // landscape { _margins[Direction.Top] = DefaultValue.MarginLarge; _margins[Direction.Right] = DefaultValue.MarginSmall; _margins[Direction.Bottom] = DefaultValue.MarginLarge; _margins[Direction.Left] = DefaultValue.MarginSmall; } _lcid = (Lcid)cultureInfo.LCID; ReadingDirection = cultureInfo.TextInfo.IsRightToLeft ? ReadingDirection.RightToLeft : ReadingDirection.LeftToRight; _fontTable = new List <string>(); _fontTable.Add(DefaultValue.Font); // default font _colorTable = new List <RtfColor>(); _colorTable.Add(new RtfColor()); // default color _header = null; _footer = null; }
/// <summary> /// Sets the paper and orientation based upon the size /// </summary> private void UpdatePage() { SizeF sf = this._size.ToDrawing(); this._paper = Papers.GetPaperFromSize(sf); this._orientation = this.Width > this.Height ? PaperOrientation.Landscape : PaperOrientation.Portrait; }
public RtfDocument(PaperSize paper, PaperOrientation orientation, Lcid lcid) { _paper = paper; _orientation = orientation; _margins = new Margins(); if (_orientation == PaperOrientation.Portrait) { _margins[Direction.Top] = DefaultValue.MarginSmall; _margins[Direction.Right] = DefaultValue.MarginLarge; _margins[Direction.Bottom] = DefaultValue.MarginSmall; _margins[Direction.Left] = DefaultValue.MarginLarge; } else // landscape { _margins[Direction.Top] = DefaultValue.MarginLarge; _margins[Direction.Right] = DefaultValue.MarginSmall; _margins[Direction.Bottom] = DefaultValue.MarginLarge; _margins[Direction.Left] = DefaultValue.MarginSmall; } _lcid = lcid; _fontTable = new List <string>(); _fontTable.Add(DefaultValue.Font); // default font _colorTable = new List <Color>(); _colorTable.Add(new Color()); // default color _header = null; _footer = null; }
public static int paperHeightInTwip(PaperSize paperSize, PaperOrientation orientation) { int[] d = paperDimensions(paperSize); if (orientation == PaperOrientation.Portrait) { if (d[0] < d[1]) { return(d[1]); } else { return(d[0]); } } else // landscape { if (d[0] < d[1]) { return(d[0]); } else { return(d[1]); } } }
public DiagramDetailsView() { InitializeComponent(); PaperSizeComboBox.ItemsSource = PaperSize.GetSizes(); PaperOrientationComboBox.ItemsSource = PaperOrientation.GetOrientations(); }
public RtfDocument(PaperSize paper, PaperOrientation orientation, Lcid lcid) { _paper = paper; _orientation = orientation; Margins = new Margins(); if (_orientation == PaperOrientation.Portrait) { Margins[Direction.Top] = DefaultValue.MarginSmall; Margins[Direction.Right] = DefaultValue.MarginLarge; Margins[Direction.Bottom] = DefaultValue.MarginSmall; Margins[Direction.Left] = DefaultValue.MarginLarge; } else { // landscape Margins[Direction.Top] = DefaultValue.MarginLarge; Margins[Direction.Right] = DefaultValue.MarginSmall; Margins[Direction.Bottom] = DefaultValue.MarginLarge; Margins[Direction.Left] = DefaultValue.MarginSmall; } _lcid = lcid; _fontTable = new List <string> { DefaultValue.Font // default font }; _colorTable = new List <RtfColor> { new RtfColor() // default color }; _header = null; _footer = null; }
/// <summary> /// Initializes a new instance of the Bytescout.PDF.Page class. /// </summary> /// <param name="format">The page size.</param> /// <param name="orientation">The paper orientation.</param> public Page(PaperFormat format, PaperOrientation orientation) { _dictionary = new PDFDictionary(); _dictionary.AddItem("Type", new PDFName("Page")); _dictionary.AddItem("MediaBox", createBox(PaperSizes.GetRect(format, orientation))); Watermarks = new WatermarkCollection(); }
public Paper(Test test, PaperTemplate template, PaperOrientation orientation) { ParentTest = test; Template = template; Orientation = orientation; BorderInch = Program.UserSettings.defaultPaperBorder; SetSize(); }
public Paper(Test test, PaperTemplate template, PaperOrientation orientation, SizeF border) { ParentTest = test; Template = template; Orientation = orientation; BorderInch = border; SetSize(); }
/// <summary> /// Отчет из плагина /// </summary> /// <param name="fileName"></param> /// <param name="someobjs"></param> public static void ReportMake(string fileName, IList <VeloObject> someobjs, float sectionFontSize = 8.5f, PaperOrientation paperOrientation = PaperOrientation.Portrait) { var doc = new RtfDocument(PaperSize.A4, paperOrientation, Lcid.Russian); RTFWorkingProvider.DocumentMargins(doc, paperOrientation == PaperOrientation.Landscape ? 2.5f : 1.5f, paperOrientation == PaperOrientation.Landscape ? 1.5f : 2.5f, 1.5f, 1.5f); CreateDocumentTitle(doc); CreateDataTable(doc, someobjs, sectionFontSize); doc.Save(fileName); }
public static int paperHeightInTwip(PaperSize paperSize, PaperOrientation orientation) { int[] d = paperDimensions(paperSize); if (orientation == PaperOrientation.Portrait) { if (d[0] < d[1]) { return d[1]; } else { return d[0]; } } else { // landscape if (d[0] < d[1]) { return d[0]; } else { return d[1]; } } }
public void Page_PaperOrientationTest() { PageStyle target = new PageStyle(); PaperOrientation expected = PaperOrientation.Portrait; Assert.AreEqual(expected, target.PaperOrientation); expected = PaperOrientation.Landscape; target.PaperOrientation = expected; Assert.AreEqual(expected, target.PaperOrientation); expected = PaperOrientation.Portrait; target.PaperOrientation = expected; Assert.AreEqual(expected, target.PaperOrientation); expected = PaperOrientation.Portrait; target.RemovePaperOrientation(); Assert.AreEqual(expected, target.PaperOrientation); }
protected bool DoConvertPageOrientation(StyleBase style, object value, out PaperOrientation orientation) { if (null == value) { orientation = PaperOrientation.Portrait; return(false); } else if (value is PaperOrientation p) { orientation = p; return(true); } else if (Enum.TryParse(value.ToString(), out orientation)) { return(true); } else { return(false); } }
public static int PaperWidthInTwip(PaperSize paperSize, PaperOrientation orientation) { var d = PaperDimensions(paperSize); if (orientation == PaperOrientation.Portrait) { if (d[0] < d[1]) { return(d[0]); } else { return(d[1]); } } // landscape if (d[0] < d[1]) { return(d[1]); } return(d[0]); }
public RtfDocument(PaperSize paper, PaperOrientation orientation, Lcid lcid) { _paper = paper; _orientation = orientation; _margins = new Margins(); if (_orientation == PaperOrientation.Portrait) { _margins[Direction.Top] = DefaultValue.MarginSmall; _margins[Direction.Right] = DefaultValue.MarginLarge; _margins[Direction.Bottom] = DefaultValue.MarginSmall; _margins[Direction.Left] = DefaultValue.MarginLarge; } else { // landscape _margins[Direction.Top] = DefaultValue.MarginLarge; _margins[Direction.Right] = DefaultValue.MarginSmall; _margins[Direction.Bottom] = DefaultValue.MarginLarge; _margins[Direction.Left] = DefaultValue.MarginSmall; } _lcid = lcid; _fontTable = new List<string>(); _fontTable.Add(DefaultValue.Font); // default font _colorTable = new List<Color>(); _colorTable.Add(new Color()); // default color _header = null; _footer = null; }
internal PaperOrientationViewModel(string displayName, PaperOrientation paperOrientation) { DisplayName = displayName; PaperOrientation = paperOrientation; }
public override void BeginWrite() { PaperOrientation po = (fAlbumPage) ? PaperOrientation.Landscape : PaperOrientation.Portrait; fDocument = new RtfDocument(PaperSize.A4, po, Lcid.English); }
public void Page_CreatePageSizeTest() { //default PaperSize size = PDFStyleConst.DefaultPaperSize; PaperOrientation orientation = PDFStyleConst.DefaultPaperOrientation; PageStyle target = new PageStyle(); //Empty PageSize expected = new PageSize(size, orientation); PageSize actual = target.CreatePageSize(); AssertPageSizeAreEqual(expected, actual); //papers size = PaperSize.Tabloid; orientation = PaperOrientation.Landscape; expected = new PageSize(size, orientation); target.PaperSize = size; target.PaperOrientation = orientation; actual = target.CreatePageSize(); AssertPageSizeAreEqual(expected, actual); size = PaperSize.A4; orientation = PaperOrientation.Portrait; target.PaperSize = size; target.PaperOrientation = orientation; expected = new PageSize(size, orientation); actual = target.CreatePageSize(); AssertPageSizeAreEqual(expected, actual); // explicit sizes target = new PageStyle(); PDFUnit w = 200; PDFUnit h = 500; target.Width = w; target.Height = h; expected = new PageSize(new PDFSize(w, h)); actual = target.CreatePageSize(); AssertPageSizeAreEqual(expected, actual); // size overides paper target = new PageStyle(); w = 300; h = 600; size = PaperSize.A8; orientation = PaperOrientation.Landscape; target.Width = w; target.Height = h; target.PaperSize = size; target.PaperOrientation = orientation; expected = new PageSize(new PDFSize(w, h)); actual = target.CreatePageSize(); AssertPageSizeAreEqual(expected, actual); }
public static float paperHeightInPt(PaperSize paperSize, PaperOrientation orientation) { return((float)paperHeightInTwip(paperSize, orientation) / 20.0F); }
public static float paperHeightInPt(PaperSize paperSize, PaperOrientation orientation) { return (float)paperHeightInTwip(paperSize, orientation) / 20.0F; }
/// <summary> </summary> public Page CreatePage2(PaperFormat paperFormat, PaperOrientation paperOrientation) { return(new Page(paperFormat, paperOrientation)); }
public static RectangleF GetRect(PaperFormat format, PaperOrientation orientation) { RectangleF rect = new RectangleF(); switch (format) { case PaperFormat.A0: rect.Size = new SizeF(2383.94f, 3370.39f); break; case PaperFormat.A1: rect.Size = new SizeF(1683.78f, 2383.94f); break; case PaperFormat.A2: rect.Size = new SizeF(1190.55f, 1683.78f); break; case PaperFormat.A3: rect.Size = new SizeF(841.89f, 1190.55f); break; case PaperFormat.A4: rect.Size = new SizeF(595.28f, 841.89f); break; case PaperFormat.A5: rect.Size = new SizeF(419.53f, 595.28f); break; case PaperFormat.A6: rect.Size = new SizeF(297.64f, 419.53f); break; case PaperFormat.B4: rect.Size = new SizeF(708.66f, 1000.63f); break; case PaperFormat.B4Envelope: rect.Size = new SizeF(708.66f, 1000.63f); break; case PaperFormat.B5: rect.Size = new SizeF(498.9f, 708.66f); break; case PaperFormat.B5Envelope: rect.Size = new SizeF(498.9f, 708.66f); break; case PaperFormat.C6Envelope: rect.Size = new SizeF(323.15f, 459.21f); break; case PaperFormat.DLEnvelope: rect.Size = new SizeF(311.81f, 623.62f); break; case PaperFormat.Executive: rect.Size = new SizeF(522, 756); break; case PaperFormat.Folio: rect.Size = new SizeF(612, 936); break; case PaperFormat.Legal: rect.Size = new SizeF(612, 1008); break; case PaperFormat.Letter: rect.Size = new SizeF(612, 792); break; case PaperFormat.MonarchEnvelope: rect.Size = new SizeF(279, 540); break; case PaperFormat.Statement: rect.Size = new SizeF(396, 612); break; } if (orientation == PaperOrientation.Landscape) { rect.Size = new SizeF(rect.Height, rect.Width); } return(rect); }
public RTFWriter() { PaperOrientation po = (fAlbumPage) ? PaperOrientation.Landscape : PaperOrientation.Portrait; fDocument = new RtfDocument(PaperSize.A4, po, Lcid.English); }
public RtfDocument(PaperSize paper, PaperOrientation orientation, Lcid lcid) : this(paper, orientation, CultureInfo.GetCultureInfo(((int)lcid))) { }
public static float PaperWidthInPt(PaperSize paperSize, PaperOrientation orientation) { return(PaperWidthInTwip(paperSize, orientation) / 20.0F); }
public async Task SavedSearchesProperties() { using (var service = await SdkHelper.CreateService()) { SavedSearchCollection savedSearches = service.SavedSearches; await savedSearches.GetAllAsync(); // Iterate saved searches and make sure we can read them foreach (SavedSearch savedSearch in savedSearches) { string dummyString; bool dummyBool; //DateTime dummyDateTime; int dummyInt; // Resource properties //dummyString = savedSearch.Name; dummyString = savedSearch.Name; //dummyString = savedSearch.Path; // SavedSearch properties get dummyString = savedSearch.Actions.Email.AuthPassword; dummyString = savedSearch.Actions.Email.AuthUsername; dummyBool = savedSearch.Actions.Email.SendResults; dummyString = savedSearch.Actions.Email.Bcc; dummyString = savedSearch.Actions.Email.CC; dummyString = savedSearch.Actions.Email.Command; EmailFormat emailFormat = savedSearch.Actions.Email.Format; dummyBool = savedSearch.Actions.Email.Inline; dummyString = savedSearch.Actions.Email.MailServer; dummyInt = savedSearch.Actions.Email.MaxResults; dummyString = savedSearch.Actions.Email.MaxTime; PaperOrientation paperOrientation = savedSearch.Actions.Email.ReportPaperOrientation; PaperSize paperSize = savedSearch.Actions.Email.ReportPaperSize; dummyBool = savedSearch.Actions.Email.ReportServerEnabled; //dummyString = savedSearch.Actions.Email.ReportServerUrl; dummyBool = savedSearch.Actions.Email.SendPdf; dummyBool = savedSearch.Actions.Email.SendResults; dummyString = savedSearch.Actions.Email.Subject; dummyString = savedSearch.Actions.Email.To; dummyBool = savedSearch.Actions.Email.TrackAlert; dummyString = savedSearch.Actions.Email.Ttl; dummyBool = savedSearch.Actions.Email.UseSsl; dummyBool = savedSearch.Actions.Email.UseTls; dummyBool = savedSearch.Actions.Email.WidthSortColumns; dummyString = savedSearch.Actions.PopulateLookup.Command; dummyString = savedSearch.Actions.PopulateLookup.Destination; dummyString = savedSearch.Actions.PopulateLookup.Hostname; dummyInt = savedSearch.Actions.PopulateLookup.MaxResults; dummyString = savedSearch.Actions.PopulateLookup.MaxTime; dummyBool = savedSearch.Actions.PopulateLookup.TrackAlert; dummyString = savedSearch.Actions.PopulateLookup.Ttl; dummyString = savedSearch.Actions.Rss.Command; //dummyString = savedSearch.Actions.Rss.Hostname; dummyInt = savedSearch.Actions.Rss.MaxResults; dummyString = savedSearch.Actions.Rss.MaxTime; dummyBool = savedSearch.Actions.Rss.TrackAlert; dummyString = savedSearch.Actions.Rss.Ttl; SavedSearch.ActionsAdapter.ScriptAdapter scriptT = savedSearch.Actions.Script; dummyString = scriptT.FileName; dummyString = scriptT.Hostname; dummyInt = scriptT.MaxResults; dummyString = scriptT.MaxTime; dummyBool = scriptT.TrackAlert; dummyString = scriptT.Ttl; dummyString = savedSearch.Actions.SummaryIndex.Name; dummyString = savedSearch.Actions.SummaryIndex.Command; //dummyString = savedSearch.Actions.SummaryIndex.Hostname; dummyBool = savedSearch.Actions.SummaryIndex.Inline; dummyInt = savedSearch.Actions.SummaryIndex.MaxResults; dummyString = savedSearch.Actions.SummaryIndex.MaxTime; dummyBool = savedSearch.Actions.SummaryIndex.TrackAlert; dummyString = savedSearch.Actions.SummaryIndex.Ttl; dummyBool = savedSearch.Alert.DigestMode; dummyString = savedSearch.Alert.Expires; AlertSeverity alertSeverity = savedSearch.Alert.Severity; SavedSearch.AlertAdapter.SuppressAdapter suppress = savedSearch.Alert.Suppress; dummyString = suppress.Fields; dummyString = suppress.Period; AlertTrack track = savedSearch.Alert.Track; AlertComparator comparator = savedSearch.Alert.Comparator; dummyString = savedSearch.Alert.Condition; dummyString = savedSearch.Alert.Threshold; AlertType alertType = savedSearch.Alert.AlertType; dummyString = savedSearch.CronSchedule; dummyString = savedSearch.Description; dummyInt = savedSearch.Dispatch.Buckets; dummyString = savedSearch.Dispatch.EarliestTime; //dummyString = savedSearch.Dispatch.LatestTime; dummyBool = savedSearch.Dispatch.Lookups; dummyInt = savedSearch.Dispatch.MaxCount; dummyInt = savedSearch.Dispatch.MaxTime; dummyInt = savedSearch.Dispatch.ReduceFreq; dummyBool = savedSearch.Dispatch.RealTimeBackfill; dummyBool = savedSearch.Dispatch.SpawnProcess; dummyString = savedSearch.Dispatch.TimeFormat; dummyString = savedSearch.Dispatch.Ttl; SavedSearch.DisplayAdapter display = savedSearch.Display; dummyInt = savedSearch.MaxConcurrent; //dummyDateTime = savedSearch.NextScheduledTime; dummyString = savedSearch.QualifiedSearch; dummyBool = savedSearch.RealTimeSchedule; dummyString = savedSearch.Request.UIDispatchApp; dummyString = savedSearch.Request.UIDispatchView; dummyBool = savedSearch.RestartOnSearchPeerAdd; dummyBool = savedSearch.RunOnStartup; dummyString = savedSearch.Search; //dummyString = savedSearch.Vsid; dummyBool = savedSearch.Actions.Email.IsEnabled; dummyBool = savedSearch.Actions.PopulateLookup.IsEnabled; dummyBool = savedSearch.Actions.Rss.IsEnabled; //dummyBool = savedSearch.IsActionScript; dummyBool = savedSearch.Actions.SummaryIndex.IsEnabled; dummyBool = savedSearch.IsDisabled; dummyBool = savedSearch.IsScheduled; dummyBool = savedSearch.IsVisible; } for (int i = 0; i < savedSearches.Count; i++) { SavedSearch savedSearch = savedSearches[i]; string dummyString; bool dummyBool; //DateTime dummyDateTime; int dummyInt; // Resource properties //dummyString = savedSearch.Name; dummyString = savedSearch.Name; //dummyString = savedSearch.Path; // SavedSearch properties get dummyString = savedSearch.Actions.Email.AuthPassword; dummyString = savedSearch.Actions.Email.AuthUsername; dummyBool = savedSearch.Actions.Email.SendResults; dummyString = savedSearch.Actions.Email.Bcc; dummyString = savedSearch.Actions.Email.CC; dummyString = savedSearch.Actions.Email.Command; EmailFormat emailFormat = savedSearch.Actions.Email.Format; dummyBool = savedSearch.Actions.Email.Inline; dummyString = savedSearch.Actions.Email.MailServer; dummyInt = savedSearch.Actions.Email.MaxResults; dummyString = savedSearch.Actions.Email.MaxTime; PaperOrientation paperOrientation = savedSearch.Actions.Email.ReportPaperOrientation; PaperSize paperSize = savedSearch.Actions.Email.ReportPaperSize; dummyBool = savedSearch.Actions.Email.ReportServerEnabled; //dummyString = savedSearch.Actions.Email.ReportServerUrl; dummyBool = savedSearch.Actions.Email.SendPdf; dummyBool = savedSearch.Actions.Email.SendResults; dummyString = savedSearch.Actions.Email.Subject; dummyString = savedSearch.Actions.Email.To; dummyBool = savedSearch.Actions.Email.TrackAlert; dummyString = savedSearch.Actions.Email.Ttl; dummyBool = savedSearch.Actions.Email.UseSsl; dummyBool = savedSearch.Actions.Email.UseTls; dummyBool = savedSearch.Actions.Email.WidthSortColumns; dummyString = savedSearch.Actions.PopulateLookup.Command; dummyString = savedSearch.Actions.PopulateLookup.Destination; dummyString = savedSearch.Actions.PopulateLookup.Hostname; dummyInt = savedSearch.Actions.PopulateLookup.MaxResults; dummyString = savedSearch.Actions.PopulateLookup.MaxTime; dummyBool = savedSearch.Actions.PopulateLookup.TrackAlert; dummyString = savedSearch.Actions.PopulateLookup.Ttl; dummyString = savedSearch.Actions.Rss.Command; //dummyString = savedSearch.Actions.Rss.Hostname; dummyInt = savedSearch.Actions.Rss.MaxResults; dummyString = savedSearch.Actions.Rss.MaxTime; dummyBool = savedSearch.Actions.Rss.TrackAlert; dummyString = savedSearch.Actions.Rss.Ttl; SavedSearch.ActionsAdapter.ScriptAdapter script = savedSearch.Actions.Script; dummyString = script.FileName; dummyString = script.Hostname; dummyInt = script.MaxResults; dummyString = script.MaxTime; dummyBool = script.TrackAlert; dummyString = script.Ttl; dummyString = savedSearch.Actions.SummaryIndex.Name; dummyString = savedSearch.Actions.SummaryIndex.Command; //dummyString = savedSearch.Actions.SummaryIndex.Hostname; dummyBool = savedSearch.Actions.SummaryIndex.Inline; dummyInt = savedSearch.Actions.SummaryIndex.MaxResults; dummyString = savedSearch.Actions.SummaryIndex.MaxTime; dummyBool = savedSearch.Actions.SummaryIndex.TrackAlert; dummyString = savedSearch.Actions.SummaryIndex.Ttl; dummyBool = savedSearch.Alert.DigestMode; dummyString = savedSearch.Alert.Expires; AlertSeverity alertSeverity = savedSearch.Alert.Severity; SavedSearch.AlertAdapter.SuppressAdapter suppress = savedSearch.Alert.Suppress; dummyString = suppress.Fields; dummyString = suppress.Period; AlertTrack track = savedSearch.Alert.Track; AlertComparator comparator = savedSearch.Alert.Comparator; dummyString = savedSearch.Alert.Condition; dummyString = savedSearch.Alert.Threshold; AlertType alertType = savedSearch.Alert.AlertType; dummyString = savedSearch.CronSchedule; dummyString = savedSearch.Description; dummyInt = savedSearch.Dispatch.Buckets; dummyString = savedSearch.Dispatch.EarliestTime; //dummyString = savedSearch.Dispatch.LatestTime; dummyBool = savedSearch.Dispatch.Lookups; dummyInt = savedSearch.Dispatch.MaxCount; dummyInt = savedSearch.Dispatch.MaxTime; dummyInt = savedSearch.Dispatch.ReduceFreq; dummyBool = savedSearch.Dispatch.RealTimeBackfill; dummyBool = savedSearch.Dispatch.SpawnProcess; dummyString = savedSearch.Dispatch.TimeFormat; dummyString = savedSearch.Dispatch.Ttl; SavedSearch.DisplayAdapter display = savedSearch.Display; dummyInt = savedSearch.MaxConcurrent; //dummyDateTime = savedSearch.NextScheduledTime; dummyString = savedSearch.QualifiedSearch; dummyBool = savedSearch.RealTimeSchedule; dummyString = savedSearch.Request.UIDispatchApp; dummyString = savedSearch.Request.UIDispatchView; dummyBool = savedSearch.RestartOnSearchPeerAdd; dummyBool = savedSearch.RunOnStartup; dummyString = savedSearch.Search; //dummyString = savedSearch.Vsid; dummyBool = savedSearch.Actions.Email.IsEnabled; dummyBool = savedSearch.Actions.PopulateLookup.IsEnabled; dummyBool = savedSearch.Actions.Rss.IsEnabled; //dummyBool = savedSearch.IsActionScript; dummyBool = savedSearch.Actions.SummaryIndex.IsEnabled; dummyBool = savedSearch.IsDisabled; dummyBool = savedSearch.IsScheduled; dummyBool = savedSearch.IsVisible; } } }
private static void FullExample(string[] args) { Debugger.Break(); // Konfiguration vorbereiten IConfigurationBuilder configBuilder = new ConfigurationBuilder() // NuGet: Microsoft.Extensions.Configuration.CommandLine .AddCommandLine(args); // Build() liest die Werte aller Quellen ein IConfigurationRoot config = configBuilder.Build(); configBuilder .SetBasePath(Directory.GetCurrentDirectory()) // NuGet: Microsoft.Extensions.Configuration.Json .AddJsonFile($"appsettings.{config.GetValue("Env", "Production")}.json"); config = configBuilder.Build(); // Connectionstring abrufen... config = configBuilder.Build(); string connectionString = config["ConnectionStrings:Main"]; // ...damit Konfiguration aus Datenbank aktivieren config = configBuilder .AddSqlDatabase(connectionString) .AddInMemoryCollection(new Dictionary <string, string> { { "App:Window:Height", "740" }, { "App:Window:Width", "900" }, { "App:Window:Top", "10" }, { "App:Window:Left", "10" }, { "App:Window:Title:Color", "Green" } }) // NuGet: Microsoft.Extensions.Configuration.EnvironmentVariables .AddEnvironmentVariables() // NuGet: Microsoft.Extensions.Configuration.CommandLine .AddCommandLine(args) // NuGet: Microsoft.Extensions.Configuration.Ini .AddIniFile("Config.ini") // NuGet: Microsoft.Extensions.Configuration.Xml .AddXmlFile("Config.xml") // NuGet: Microsoft.Extensions.Configuration.AzureKeyVault //.AddAzureKeyVault($"https://{config["Vault"]}.vault.azure.net/", // config["ClientId"], // config["ClientSecret"]) .Build(); // Nicht definierter Wert int smptPort = config.GetValue("Smtp:Port", 25); // Einfacher Zugriff (ohne Binder) string conString = config["ConnectionStrings:Main"]; // JSON-File int c = config.GetValue("App:MainWindow:Top", 0); // Aus Ini-Datei string wetter = config.GetValue <string>("IniSection:Wetter"); // Aus XML-Datei // Konfiguration auf Enum mappen PaperOrientation paperOrientation = config.GetValue("setting:Orientation:value", PaperOrientation.Portrait); // Umgebungsvariabel string systemdrive = config.GetValue("SystemDrive", "X:"); // Programm-Argumente string enviroment = config.GetValue("Env", "Production"); // Aus der Datebank (Custom) string color = config.GetValue <string>("Color"); // Konfiguration auf POCOs mappen var appWindow = new AppWindows(); config.GetSection("App:Window").Bind(appWindow); // Aus Private-Setter-Eigenschaften binden appWindow = config.GetSection("App:Window").Get <AppWindows>( o => o.BindNonPublicProperties = true ); }
public async Task <byte[]> ConvertHtmlToPdfAsync(string url, PaperType paperType, PaperOrientation paperOrientation, Dimension dimension = null) { var phantomJsDirectoryName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "runtime", "phantomjs"); var phantomJsFileName = RuntimeInformation.IsOSPlatform(OSPlatform.Linux) ? "linux_phantomjs" : RuntimeInformation.IsOSPlatform(OSPlatform.OSX) ? "osx_phantomjs" : "windows_phantomjs.exe"; phantomJsFileName = Path.Combine(phantomJsDirectoryName, "exe", phantomJsFileName); var outputFileName = $"output_{Guid.NewGuid()}.pdf"; var arguments = paperType != PaperType.Custom ? $"rasterize.js \"{url}\" \"{outputFileName}\" \"{paperType.ToString()}\" \"{paperOrientation.ToString().ToLower()}\"" : $"rasterize.js \"{url}\" \"{outputFileName}\" \"{dimension.Width.ToString().Replace(",", ".")}{dimension.UnitName}*{dimension.Height.ToString().Replace(",", ".")}{dimension.UnitName}\" \"{paperOrientation.ToString().ToLower()}\""; var startInfo = new ProcessStartInfo(phantomJsFileName) { WorkingDirectory = phantomJsDirectoryName, Arguments = arguments, UseShellExecute = false, CreateNoWindow = true, RedirectStandardOutput = true, StandardOutputEncoding = System.Text.Encoding.UTF8 }; var process = new Process { StartInfo = startInfo }; process.Start(); var output = await process.StandardOutput.ReadToEndAsync(); process.WaitForExit(); if (process.ExitCode == 1) { throw new Exception(output); } outputFileName = Path.Combine(phantomJsDirectoryName, outputFileName); var bytes = await File.ReadAllBytesAsync(outputFileName); if (File.Exists(outputFileName)) { File.Delete(outputFileName); } return(bytes); }