वेबसाइटचे परिपूर्ण प्रतिमा स्क्रीनशॉट तयार करा किंवा खालील वैशिष्ट्यांचा वापर करून HTML थेट प्रतिमांमध्ये रूपांतरित करा GrabzIt चे ASP.NET API. तथापि आपण सुरू करण्यापूर्वी लक्षात ठेवा की कॉल केल्यावर URLToImage, HTMLToImage or FileToImage पद्धती Save or SaveTo स्क्रीनशॉट घेण्यासाठी पद्धत कॉल करणे आवश्यक आहे.
वेब पृष्ठाचा स्क्रीनशॉट घेण्यासाठी फक्त एक पॅरामीटर आवश्यक आहे किंवा एचटीएमएल रूपांतरित करा intओए प्रतिमा पुढील उदाहरणात दर्शविल्याप्रमाणे.
grabzIt.URLToImage("https://www.tesla.com"); //Then call the Save or SaveTo method
grabzIt.HTMLToImage("<html><body><h1>Hello World!</h1></body></html>"); //Then call the Save or SaveTo method
grabzIt.FileToImage("example.html"); //Then call the Save or SaveTo method
ग्रॅबझिटचे एएसपी.नेट नेटिव्ह जेपीजी, पीएनजी, डब्ल्यूईबीपी, बीएमपी (एक्सएनयूएमएक्स बिट, एक्सएनयूएमएक्स बिट, एक्सएनयूएमएक्स बिट किंवा एक्सएनयूएमएक्स बिट) आणि टीआयएफएफ यासह अनेक स्वरूपात प्रतिमा स्क्रीनशॉट घेऊ शकतात. प्रतिमेच्या स्क्रीनशॉटचे डीफॉल्ट स्वरूप जेपीजी आहे. तथापि जेपीजी प्रतिमेची गुणवत्ता काही अनुप्रयोगांसाठी चांगली नसते कदाचित या परिस्थितीत प्रतिमा स्क्रीनशॉटसाठी पीएनजी स्वरुपाची शिफारस केली जाते कारण ते गुणवत्ता आणि फाईल आकारामध्ये चांगले संतुलन देते. खाली दिलेली उदाहरणे पीएनजी स्वरूप वापरुन घेतलेला एक प्रतिमा स्क्रीनशॉट दर्शविते.
GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret"); ImageOptions options = new ImageOptions(); options.Format = ImageFormat.png; grabzIt.URLToImage("https://www.tesla.com", options); //Then call the Save or SaveTo method grabzIt.SaveTo("result.png");
GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret"); ImageOptions options = new ImageOptions(); options.Format = ImageFormat.png; grabzIt.HTMLToImage("<html><body><h1>Hello World!</h1></body></html>", options); //Then call the Save or SaveTo method grabzIt.SaveTo("result.png");
GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret"); ImageOptions options = new ImageOptions(); options.Format = ImageFormat.png; grabzIt.FileToImage("example.html", options); //Then call the Save or SaveTo method grabzIt.SaveTo("result.png");
ब्राउझर आकार ब्राउझर विंडोच्या आकारास संदर्भित करतो जे बहुतेक प्रकरणांमध्ये स्क्रीनशॉट कॅप्चर करताना वापरला जाईल हे डीफॉल्ट ब्राउझर आकार सर्व कार्यांसाठी पुरेसा असेल म्हणून सेट करण्याची आवश्यकता नाही. ब्राउझर आकार सेट करण्यासाठी फक्त एक मूल्य पास BrowserWidth
आणि BrowserHeight
च्या गुणधर्म ImageOptions वर्ग.
प्रतिमेचा आकार बदलणे सोपे आहे, प्रतिमा विकृत न करता ते करणे थोडे कठिण आहे. संपूर्ण प्रक्रिया सुलभ करण्यासाठी आम्ही आपल्याला याचा वापर करण्याची शिफारस करतो साधे प्रतिमा परिमाण कॅल्क्युलेटर.
आपण ब्राउझरच्या रुंदी आणि उंचीपेक्षा मोठ्या आकारात प्रतिमेची रुंदी आणि उंची वाढवू इच्छित असल्यास, डीफॉल्टनुसार एक्सएनयूएमएक्सने एक्सएनयूएमएक्स पिक्सलद्वारे, ब्राउझरची रुंदी आणि उंची देखील जुळण्यासाठी वाढविली पाहिजे.
आपण एक सानुकूल अभिज्ञापक पास करू शकता प्रतिमा खाली दर्शविल्या गेलेल्या पद्धती, हे मूल्य नंतर आपल्या GrabzIt ASP.NET हँडलरला परत केले जाईल. उदाहरणार्थ हा सानुकूल अभिज्ञापक डेटाबेस अभिज्ञापक असू शकतो, ज्यामुळे स्क्रीनशॉटला विशिष्ट डेटाबेस रेकॉर्डशी संबद्ध होऊ दिले जाते.
GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret"); ImageOptions options = new ImageOptions(); options.CustomId = "123456"; grabzIt.URLToImage("https://www.tesla.com", options); //Then call the Save method grabzIt.Save("http://www.example.com/Home/Handler");
GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret"); ImageOptions options = new ImageOptions(); options.CustomId = "123456"; grabzIt.HTMLToImage("<html><body><h1>Hello World!</h1></body></html>", options); //Then call the Save method grabzIt.Save("http://www.example.com/Home/Handler");
GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret"); ImageOptions options = new ImageOptions(); options.CustomId = "123456"; grabzIt.FileToImage("example.html", options); //Then call the Save method grabzIt.Save("http://www.example.com/Home/Handler");
GrabzIt आपल्याला संपूर्ण वेब पृष्ठाचा संपूर्ण लांबीचा स्क्रीनशॉट घेण्याची परवानगी देते हे करण्यासाठी आपल्याला -1 ला जाण्याची आवश्यकता आहे BrowserHeight
च्या मालमत्ता ImageOptions वर्ग प्रतिमा ब्राउझरच्या आकाराशी जुळत असल्याचे सुनिश्चित करण्यासाठी हे एक -1 पास करते OutputHeight
आणि OutputWidth
गुणधर्म.
GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret"); ImageOptions options = new ImageOptions(); options.BrowserHeight = -1; options.OutputWidth = -1; options.OutputHeight = -1; grabzIt.URLToImage("https://www.tesla.com", options); //Then call the Save or SaveTo method grabzIt.SaveTo("result.jpg");
GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret"); ImageOptions options = new ImageOptions(); options.BrowserHeight = -1; options.OutputWidth = -1; options.OutputHeight = -1; grabzIt.HTMLToImage("<html><body><h1>Hello World!</h1></body></html>", options); //Then call the Save or SaveTo method grabzIt.SaveTo("result.jpg");
GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret"); ImageOptions options = new ImageOptions(); options.BrowserHeight = -1; options.OutputWidth = -1; options.OutputHeight = -1; grabzIt.FileToImage("example.html", options); //Then call the Save or SaveTo method grabzIt.SaveTo("result.jpg");
आपण क्रॉप न केलेले लघुप्रतिमा देखील परत येऊ शकता परंतु सावधगिरी बाळगा यामुळे मोठ्या प्रतिमा तयार होऊ शकतात. हे करण्यासाठी एक -1 पास करा OutputHeight
आणि / किंवा OutputWidth
गुणधर्म. -एक्सएनयूएमएक्स उत्तीर्ण होणारे कोणतेही परिमाण क्रॉप केले जाणार नाही.
GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret"); ImageOptions options = new ImageOptions(); options.OutputWidth = -1; options.OutputHeight = -1; grabzIt.URLToImage("https://www.tesla.com", options); //Then call the Save or SaveTo method grabzIt.SaveTo("result.jpg");
GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret"); ImageOptions options = new ImageOptions(); options.OutputWidth = -1; options.OutputHeight = -1; grabzIt.HTMLToImage("<html><body><h1>Hello World!</h1></body></html>", options); //Then call the Save or SaveTo method grabzIt.SaveTo("result.jpg");
GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret"); ImageOptions options = new ImageOptions(); options.OutputWidth = -1; options.OutputHeight = -1; grabzIt.FileToImage("example.html", options); //Then call the Save or SaveTo method grabzIt.SaveTo("result.jpg");
ही विशेष मूल्ये वापरण्याचा अर्थ असा आहे की आपण इच्छित असल्यास आपण संपूर्ण वेब पृष्ठाची संपूर्ण आवृत्ती असलेली स्क्रीनशॉट तयार करू शकता!
ग्रॅबझिट आपल्याला एचटीएमएल घटकाचा स्क्रीनशॉट घेण्यास अनुमती देते, जसे की div
or span
टॅग करा आणि त्याची सर्व सामग्री कॅप्चर करा. हे करण्यासाठी एचटीएमएल घटक आपण स्क्रीनशॉट करू इच्छित एक म्हणून निर्दिष्ट करणे आवश्यक आहे सीएसएस निवडकर्ता.
... <div id="features"> <img src="http://www.example.com/hot.jpg"/><h3>Heatwave Starting</h3> </div> ...
खाली दिलेल्या उदाहरणासाठी आम्ही आयडी "वैशिष्ट्ये" सह डिव्ह निवडू आणि त्यास एक्सएनयूएमएक्स एक्स एक्सएनयूएमएक्सपीएक्स जेपीईजी प्रतिमा म्हणून आउटपुट करू.
GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret"); // The 250 parameters indicates that image should be sized to 250 x 250 px ImageOptions options = new ImageOptions(); options.OutputWidth = 250; options.OutputHeight = 250; options.Format = ImageFormat.jpg; options.TargetElement = "#features"; grabzIt.URLToImage("http://www.bbc.co.uk/news", options); //Then call the Save or SaveTo method grabzIt.SaveTo("result.jpg");
पुढील उदाहरण "वैशिष्ट्ये" डिव्ह चे आणखी एक स्क्रीनशॉट घेते परंतु यावेळी एक जेपीईजी प्रतिमा दर्शवितो जी Div चा अचूक आकार आहे.
GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret"); // The -1 indicates that image should not be cropped ImageOptions options = new ImageOptions(); options.OutputWidth = -1; options.OutputHeight = -1; options.BrowserHeight = -1; options.Format = ImageFormat.jpg; options.TargetElement = "#features"; grabzIt.URLToImage("http://www.bbc.co.uk/news", options); //Then call the Save or SaveTo method grabzIt.SaveTo("result.jpg");