ویب پر گرفت اور تبدیل کرنے کے اوزار

ویب سائٹ اسکرین شاٹس پر قبضہ کریں یا HTML کو امیجز میں تبدیل کریں

ASP.NET API

ویب سائٹوں کے کامل امیج اسکرین شاٹس بنائیں یا مندرجہ ذیل خصوصیات کا استعمال کرکے HTML کو براہ راست تصاویر میں تبدیل کریں GrabzIt کا ASP.NET API. تاہم ، اس سے پہلے کہ آپ فون کریں ، یاد رکھیں URLToImage, HTMLToImage or FileToImage طریقوں Save or SaveTo اسکرین شاٹ لینے کے ل method طریقہ کو بلایا جانا چاہئے۔

بنیادی اختیارات

ویب پیج یا اسکرین شاٹ لینے کیلئے صرف ایک پیرامیٹر کی ضرورت ہے HTML کو تبدیل کریں intOA تصویر جیسا کہ مندرجہ ذیل مثال میں دکھایا گیا ہے۔

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

تصویری اسکرین شاٹ فارمیٹس

GrabzIt کا ASP.NET API متعدد فارمیٹس میں تصویری اسکرین شاٹس لے سکتا ہے ، جس میں جے پی جی ، PNG ، WEBP ، BMP (8 بٹ ، 16 بٹ ، 24 بٹ یا 32 بٹ) اور TIFF شامل ہیں۔ تصویری اسکرین شاٹس کے لئے پہلے سے طے شدہ شکل JPG ہے۔ تاہم ، ان حالات میں جے پی جی امیج کا معیار اتنا اچھا نہیں ہوسکتا ہے کہ PNG فارمیٹ کو امیج اسکرین شاٹس کے ل for تجویز کیا جاتا ہے کیونکہ یہ معیار اور فائل کے سائز کے درمیان اچھا توازن فراہم کرتا ہے۔ ذیل کی مثال 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.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 کلاس.

تصویری سائز تبدیل کریں

کسی شبیہہ کے سائز کو تبدیل کرنا آسان ہے ، تصویر کو مسخ کیے بغیر کرنا کچھ مشکل ہے۔ پورے عمل کو آسان بنانے کے ل we ہم آپ کو مشورہ دیتے ہیں کہ آپ اسے استعمال کریں سادہ تصویری جہت کیلکولیٹر.

اگر آپ تصویری چوڑائی اور اونچائی کو براؤزر کی چوڑائی اور اونچائی سے بڑے سائز میں بڑھانا چاہتے ہیں ، جو 1366 بذریعہ 728 پکسلز ہے ، تو براؤزر کی چوڑائی اور اونچائی کو بھی میچ کرنے کیلئے بڑھانا ہوگا۔

کسٹم شناختی

آپ کو ایک کسٹم شناخت کنندہ پاس کرسکتے ہیں تصویر جیسا کہ ذیل میں دکھایا گیا ہے ، اس کی قیمت آپ کے 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 آپ کو ایک پورے ویب پیج کی مکمل لمبائی کا اسکرین شاٹ لینے کی اجازت دیتا ہے اس کے ل you آپ کو ایک ایکس ایکس ایکس ایکس پاس کرنے کی ضرورت ہے 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");

آپ تھمب نیل بھی واپس کرسکتے ہیں جو فصل نہیں لگے ہیں ، لیکن ہوشیار رہیں کہ اس سے بڑی تصاویر تشکیل دے سکتی ہیں۔ ایسا کرنے کے ل a ایک -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");
نوٹ کریں براؤزر کی پوری چوڑائی نہیں ہے!

ان خصوصی قدروں کو استعمال کرنے کا مطلب یہ ہے کہ آپ ایک اسکرین شاٹ تشکیل دے سکتے ہیں جو اگر آپ چاہیں تو پورے ویب پیج کا مکمل پیمانہ ورژن ہے۔

کسی صفحہ عنصر کا اسکرین شاٹ لیں

GrabzIt آپ کو HTML عنصر کا اسکرین شاٹ لینے کی اجازت دیتا ہے ، جیسے کہ div or span ٹیگ ، اور اس کے تمام مواد پر قبضہ. ایسا کرنے کے ل the آپ جس HTML عنصر کی اسکرین شاٹ لینا چاہتے ہیں اسے بطور درج ہونا ضروری ہے سی ایس ایس سلیکٹر.

...
<div id="features">
	<img src="http://www.example.com/hot.jpg"/><h3>Heatwave Starting</h3>
</div>
...

ذیل کی مثال کے طور پر ہم id کو "خصوصیات" کے ساتھ منتخب کریں گے اور اسے 250 x 250px JPEG تصویر کے بطور برآمد کریں گے۔

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");