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

جاوا اسکرپٹ اسکرین شاٹ API کے ساتھ ایک تقویم پر قبضہ کریں

جاوا اسکرپٹ API

ایک عام ضرورت یہ ہے کہ کسی HTML صفحہ میں صرف ایک ہی HTML عنصر کے مندرجات کو کیسے پکڑا جائے۔ مثال کے طور پر ایک تقسیم ، مدت یا کینوس عنصر.

However, before you can capture a single HTML element using client side code. Such as an image, PDF or DOCX screenshot. To use the JavaScript Screenshot API. You will need to مفت رجسٹر ہو جائیے اور پھر ہمارا ڈاؤن لوڈ کریں۔ مفت جاوا اسکرپٹ لائبریری.

Once you do this, capturing an HTML element is easy. You just need to pass the سی ایس ایس سلیکٹر جس عنصر پر آپ قبضہ کرنا چاہتے ہیں ہدف پیرامیٹر

To construct your CSS selector you will need to find the HTML element that you want to capture. To do this look at the HTML source of the webpage you are trying to capture the element from. An example of this is below.

<div id="features">
	<h4>Acme Camera</h4>
	<label>Price</label>$399<br />
	<label>Rating</label>4.5 out of 5
</div>
<p>Cras ut velit sed purus porttitor aliquam. Nulla tristique magna ac libero tempor, ac vestibulum felisvulput ate. Nam ut velit
risus porttitor tristique at ac diam. Sed nisi risus, rutrum a metus suscipit, euismod tristique nulla. Etiam venenatis rutrum
blandit. In hac habitasse platea dictumst. Suspendisse potenti. Phasellus eget vehicula felis.</p>

لہذا مثال کے طور پر ID کے ساتھ صرف DIV اسکرین شاٹ کریں features use the JavaScript code below.

This JavaScript additionally autosizes the resultant image screenshot to the same dimensions as the targeted HTML element. By setting the bheight, height اور width پیرامیٹرز to -1. When the page loads, it will create an image screenshot in the same location as the script tag. This will contain the contents of the features div اور کچھ نہیں

<script src="https://cdn.jsdelivr.net/npm/@grabzit/js@/grabzit.min.js"></script>
<script type="text/javascript">
GrabzIt("Sign in to view your Application Key").ConvertURL("http://www.example.com/my-page.html",
{"target": "#features", "bheight": -1, "height": -1, "width": -1}).Create();
</script>
<script src="https://cdn.jsdelivr.net/npm/@grabzit/js@/grabzit.min.js"></script>
<script type="text/javascript">
GrabzIt("Sign in to view your Application Key").ConvertURL("http://www.example.com/my-page.html",
{"target": "#features", "format": "pdf"}).Create();
</script>
<script src="https://cdn.jsdelivr.net/npm/@grabzit/js@/grabzit.min.js"></script>
<script type="text/javascript">
GrabzIt("Sign in to view your Application Key").ConvertURL("http://www.example.com/my-page.html",
{"target": "#features", "format": "docx"}).Create();
</script>

HTML کو کسی تصویر ، پی ڈی ایف یا DOCX میں تبدیل کرتے وقت بھی آپ HTML عناصر کو گرفت میں لے سکتے ہیں۔ بس طریقہ بدل دیں ConvertURL ساتھ ConvertHTML اوپر.

متحرک مواد پر قبضہ کرنا

صارف کے پاس ہونے کے بعد اکثر آپ صفحے کے مواد پر قبضہ کرنا چاہتے ہیں intکسی طرح اس کے ساتھ معاہدہ کیا ، مثال کے طور پر ایک فارم کو بھرنے کے بعد۔ GrabzIt آپ کو فراہم کرکے یہ کام کرنے کے قابل بناتا ہے ConvertPage method. This sends the current HTML of the web page along with the URL of the web page to GrabzIt. The system then loads the content in a browser and converts it into an image, DOCX, or PDF document.

To load resources such as CSS or images referenced by absolute URL. You need an internet connection for this method to work properly.

<div id="divSection">
    <form id="myForm">
        <label>Name</label><input type="text" name="name" />
        <label>Age</label><input type="text" name="age" />
        <input type="button" data-gt-translate-attributes='[{"attribute":"value","format":"json"}]' value="Save"/>
    </form>
</div>

The example makes a copy of a webpage, updates it with form values, and sends it to GrabzIt for conversion. As we only want to capture the div divSection، جیسا کہ اوپر دکھایا گیا ہے ہم اس کو ایک ہدف کے طور پر گزر رہے ہیں۔ تاہم آپ JSON پیرامیٹرز کی وضاحت نہیں کرسکتے اور پورے ویب پیج پر گرفت نہیں کرسکتے ہیں کیونکہ اسے صارف کے ذریعہ اپ ڈیٹ کردیا گیا ہے۔

<script src="https://cdn.jsdelivr.net/npm/@grabzit/js@/grabzit.min.js"></script>
<script>
GrabzIt("Sign in to view your Application Key").ConvertPage({"target": "#divSection", "bheight": -1, "height": -1, "width": -1}).Create();
</script>

جب کسی HTML عنصر کو نشانہ بنانا ہو تو پی ڈی ایف کس طرح کٹ جاتا ہے ان تکنیکوں کا استعمال کرتے ہوئے کنٹرول کیا.

<script src="https://cdn.jsdelivr.net/npm/@grabzit/js@/grabzit.min.js"></script>
<script>
GrabzIt("Sign in to view your Application Key").ConvertPage({"target": "#divSection", "format": "pdf"}).Create();
</script>
<script src="https://cdn.jsdelivr.net/npm/@grabzit/js@/grabzit.min.js"></script>
<script>
GrabzIt("Sign in to view your Application Key").ConvertPage({"target": "#divSection", "format": "docx"}).Create();
</script>

آپ جس ویب سائٹ کی گرفتاری کررہے ہیں اس کی نوعیت پر منحصر ہے کہ آپ اس نقطہ نظر کو اس مواد کو حاصل کرنے کے لئے بھی استعمال کرسکتے ہیں لاگ ان کے پیچھے. Simply use the above approach, with or without the target parameters as desired. Then if you have not restricted the page resources, you can capture the webpage content as seen by the user.