protected override Dictionary <string, string> GetParameters(string applicationKey, string signature, string callBackURL, string dataName, string dataValue) { Dictionary <string, string> parameters = CreateParameters(applicationKey, signature, callBackURL, dataName, dataValue); parameters.Add("background", Convert.ToInt32(IncludeBackground).ToString()); parameters.Add("pagesize", PageSize.ToString().ToUpper()); parameters.Add("orientation", Orientation.ToString()); parameters.Add("templateid", TemplateId); parameters.Add("customwatermarkid", CustomWaterMarkId); parameters.Add("includelinks", Convert.ToInt32(IncludeLinks).ToString()); parameters.Add("includeoutline", Convert.ToInt32(IncludeOutline).ToString()); parameters.Add("title", Title); parameters.Add("coverurl", CoverURL); parameters.Add("mleft", MarginLeft.ToString()); parameters.Add("mright", MarginRight.ToString()); parameters.Add("mtop", MarginTop.ToString()); parameters.Add("mbottom", MarginBottom.ToString()); parameters.Add("delay", Delay.ToString()); parameters.Add("requestmobileversion", Convert.ToInt32(RequestAs).ToString()); parameters.Add("quality", Quality.ToString()); parameters.Add("target", TargetElement); parameters.Add("hide", HideElement); parameters.Add("waitfor", WaitForElement); parameters.Add("noads", Convert.ToInt32(NoAds).ToString()); parameters.Add("post", post); parameters.Add("bwidth", BrowserWidth.ToString()); parameters.Add("width", PageWidth.ToString()); parameters.Add("height", PageHeight.ToString()); parameters.Add("tvars", templateVariables); return(parameters); }
/// <summary> /// Returned object must be disposed /// MultiplexingConverter should be used for multithreading /// but and application doesn't exit after its using /// </summary> /// <returns></returns> private WkHtmlToPdfConverter GetConverter() { var conv = new WkHtmlToPdfConverter(); conv.GlobalSettings.Dpi = Dpi; conv.GlobalSettings.Margin.Top = MarginTop?.ToString(); conv.GlobalSettings.Margin.Bottom = MarginBottom?.ToString(); conv.GlobalSettings.Margin.Left = MarginLeft?.ToString(); conv.GlobalSettings.Margin.Left = MarginLeft?.ToString(); conv.GlobalSettings.Orientation = Orientation; conv.GlobalSettings.Size.PageSize = PageSize; conv.ObjectSettings.Load.ZoomFactor = Zoom; conv.ObjectSettings.Header.Spacing = HeaderSpacing; conv.ObjectSettings.Header.HtmlUrl = HeaderHtmlUrl; conv.ObjectSettings.Page = HtmlUrl; conv.ObjectSettings.Footer.Spacing = FooterSpacing; conv.ObjectSettings.Footer.HtmlUrl = FooterHtmlUrl; conv.ObjectSettings.Web.EnableIntelligentShrinking = false; //conv.Begin += (s, e) => _Log.DebugFormat("Conversion begin, phase count: {0}", e.Value); //conv.Error += (s, e) => _Log.Error(e.Value); //conv.Warning += (s, e) => _Log.Warn(e.Value); //conv.PhaseChanged += (s, e) => _Log.InfoFormat("PhaseChanged: {0} - {1}", e.Value, e.Value2); //conv.ProgressChanged += (s, e) => _Log.InfoFormat("ProgressChanged: {0} - {1}", e.Value, e.Value2); //conv.Finished += (s, e) => _Log.InfoFormat("Finished: {0}", e.Value ? "success" : "failed!"); return(conv); }
private async void StackPanel_PointerPressed(object sender, PointerRoutedEventArgs e) { //string JsonModel = " {" + // "\"PhoneOEM\": \"{0}\"," + // "\"PhoneName\": \"{1}\"," + // "\"Color\": \"{2}\"," + // "\"ColorStr\": \"{3}\"," + // "\"PhoneGlare\": \"{4}\"," + // "\"PhoneScreen\": \"{5}\"," + // "\"MarginLeft\": \"{6}\"," + // "\"MarginTop\": \"{7}\"," + // "\"MarginRight\": \"{8}\"," + // "\"MarginBottom\": \"{9}\"," + // "\"ScreenWidth\": \"{10}\"," + // "\"ScreenHeight\": \"{11}\"" + // "},"; string[] args = new string[12]; args[0] = "\n {\n \"PhoneOEM\":\"" + PhoneOEM.Text + "\",\n"; args[1] = " \"PhoneName\":\"" + PhoneName.Text + "\",\n"; args[2] = " \"Color\": \"" + Color.SelectedItem as string + "\",\n"; args[3] = " \"ColorStr\": \"" + ColorToStr(Color.SelectedItem as string) + "\",\n"; args[4] = " \"PhoneGlare\": \"" + _filepath.Replace("C:\\Users\\blue-\\Documents\\Visual Studio 2015\\Projects\\ShotWithPhone\\ShotWithPhone\\PhoneImageSources\\", "/PhoneImageSources/").Replace("screen", "glare") + "\",\n"; args[5] = " \"PhoneScreen\": \"" + _filepath.Replace("C:\\Users\\blue-\\Documents\\Visual Studio 2015\\Projects\\ShotWithPhone\\ShotWithPhone\\PhoneImageSources\\", "/PhoneImageSources/") + "\",\n"; args[6] = " \"MarginLeft\": \"" + MarginLeft.ToString() + "\",\n"; args[7] = " \"MarginTop\": \"" + MarginTop.ToString() + "\",\n"; args[8] = " \"MarginRight\": \"" + MarginRight.ToString() + "\",\n"; args[9] = " \"MarginBottom\": \"" + MarginBottom.ToString() + "\",\n"; args[10] = " \"ScreenWidth\": \"" + RecWidth.ToString() + "\",\n"; args[11] = " \"ScreenHeight\": \"" + RecHeight.ToString() + "\"\n },"; string Json = ""; foreach (string item in args) { Json += item; } DataPackage data = new DataPackage(); data.SetText(Json); Clipboard.SetContent(data); MessageDialog MD = new MessageDialog("CopyOK!"); MD.Options = MessageDialogOptions.AcceptUserInputAfterDelay; await MD.ShowAsync(); }
protected override void FillStyleAttributes(CssStyleCollection attributes, IUrlResolutionService urlResolver) { base.FillStyleAttributes(attributes, urlResolver); if (PaddingTop != Unit.Empty) { attributes.Add(HtmlTextWriterStyle.PaddingTop, PaddingTop.ToString()); } if (PaddingLeft != Unit.Empty) { attributes.Add(HtmlTextWriterStyle.PaddingLeft, PaddingLeft.ToString()); } if (PaddingRight != Unit.Empty) { attributes.Add(HtmlTextWriterStyle.PaddingRight, PaddingRight.ToString()); } if (PaddingBottom != Unit.Empty) { attributes.Add(HtmlTextWriterStyle.PaddingBottom, PaddingBottom.ToString()); } if (MarginTop != Unit.Empty) { attributes.Add(HtmlTextWriterStyle.MarginTop, MarginTop.ToString()); } if (MarginLeft != Unit.Empty) { attributes.Add(HtmlTextWriterStyle.MarginLeft, MarginLeft.ToString()); } if (MarginRight != Unit.Empty) { attributes.Add(HtmlTextWriterStyle.MarginRight, MarginRight.ToString()); } if (MarginBottom != Unit.Empty) { attributes.Add(HtmlTextWriterStyle.MarginBottom, MarginBottom.ToString()); } if (!String.IsNullOrEmpty(BackImageUrl)) { attributes.Add(HtmlTextWriterStyle.BackgroundImage, String.Format("url({0})", urlResolver.ResolveClientUrl(BackImageUrl))); } }
protected override void FillStyleAttributes(CssStyleCollection attributes, IUrlResolutionService urlResolver) { base.FillStyleAttributes(attributes, urlResolver); if (PaddingTop != Unit.Empty) { attributes.Add(HtmlTextWriterStyle.PaddingTop, PaddingTop.ToString()); } if (PaddingLeft != Unit.Empty) { attributes.Add(HtmlTextWriterStyle.PaddingLeft, PaddingLeft.ToString()); } if (PaddingRight != Unit.Empty) { attributes.Add(HtmlTextWriterStyle.PaddingRight, PaddingRight.ToString()); } if (PaddingBottom != Unit.Empty) { attributes.Add(HtmlTextWriterStyle.PaddingBottom, PaddingBottom.ToString()); } if (MarginTop != Unit.Empty) { attributes.Add(HtmlTextWriterStyle.MarginTop, MarginTop.ToString()); } if (MarginLeft != Unit.Empty) { attributes.Add(HtmlTextWriterStyle.MarginLeft, MarginLeft.ToString()); } if (MarginRight != Unit.Empty) { attributes.Add(HtmlTextWriterStyle.MarginRight, MarginRight.ToString()); } if (MarginBottom != Unit.Empty) { attributes.Add(HtmlTextWriterStyle.MarginBottom, MarginBottom.ToString()); } }
protected override Dictionary <string, string> GetParameters(string applicationKey, string signature, string callBackURL, string dataName, string dataValue) { Dictionary <string, string> parameters = CreateParameters(applicationKey, signature, callBackURL, dataName, dataValue); parameters.Add("background", Convert.ToInt32(IncludeBackground).ToString()); parameters.Add("pagesize", PageSize.ToString().ToUpper()); parameters.Add("orientation", Orientation.ToString()); parameters.Add("templateid", TemplateId); parameters.Add("customwatermarkid", CustomWaterMarkId); parameters.Add("includelinks", Convert.ToInt32(IncludeLinks).ToString()); parameters.Add("includeoutline", Convert.ToInt32(IncludeOutline).ToString()); parameters.Add("title", Title); parameters.Add("coverurl", CoverURL); parameters.Add("mleft", MarginLeft.ToString()); parameters.Add("mright", MarginRight.ToString()); parameters.Add("mtop", MarginTop.ToString()); parameters.Add("mbottom", MarginBottom.ToString()); parameters.Add("delay", Delay.ToString()); parameters.Add("requestmobileversion", Convert.ToInt32(RequestAs).ToString()); parameters.Add("quality", Quality.ToString()); return(parameters); }