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

ویب صفحات اور HTML کو پی ڈی ایف میں تبدیل کریں

پی ایچ پی کی API

GrabzIt کا پی ایچ پی API مدد کرنے کے لئے درج ذیل خصوصیات مہیا کرتا ہے intمثال کے طور پر GrabzIt into ویب صفحات یا HTML کو براہ راست پی ڈی ایف دستاویزات میں تبدیل کرتے وقت آپ کی ایپ آسانی سے آسانی سے تلاش کریں۔ تاہم ، اس سے پہلے کہ آپ فون کریں ، یاد رکھیں URLToPDF, HTMLToPDF or FileToPDF طریقوں Save or SaveTo اصل میں پی ڈی ایف بنانے کے ل method طریقہ کو بلایا جانا چاہئے۔

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

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

$grabzIt->URLToPDF("https://www.tesla.com");
//Then call the Save or SaveTo method
$grabzIt->HTMLToPDF("<html><body><h1>Hello World!</h1></body></html>");
//Then call the Save or SaveTo method
$grabzIt->FileToPDF("example.html");
//Then call the Save or SaveTo method

کسٹم شناختی

آپ کو ایک کسٹم شناخت کنندہ پاس کرسکتے ہیں PDF جیسا کہ ذیل میں دکھایا گیا ہے ، اس کی قیمت آپ کے GrabzIt پی ایچ پی ہینڈلر کو واپس کردی جاتی ہے۔ مثال کے طور پر یہ کسٹم شناخت کنندہ ایک ڈیٹا بیس کا شناخت کنندہ ہوسکتا ہے ، جس سے اسکرین شاٹ یا پی ڈی ایف کو کسی خاص ڈیٹا بیس ریکارڈ سے وابستہ کیا جاسکتا ہے۔

$grabzIt = new \GrabzIt\GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret");

$options = new \GrabzIt\GrabzItPDFOptions();
$options->setCustomId(123456);

$grabzIt->URLToPDF("https://www.tesla.com", $options);
//Then call the Save method
$grabzIt->Save("http://www.example.com/handler.php");
$grabzIt = new \GrabzIt\GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret");

$options = new \GrabzIt\GrabzItPDFOptions();
$options->setCustomId(123456);

$grabzIt->HTMLToPDF("<html><body><h1>Hello World!</h1></body></html>", $options);
//Then call the Save method
$grabzIt->Save("http://www.example.com/handler.php");
$grabzIt = new \GrabzIt\GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret");

$options = new \GrabzIt\GrabzItPDFOptions();
$options->setCustomId(123456);

$grabzIt->FileToPDF("example.html", $options);
//Then call the Save method
$grabzIt->Save("http://www.example.com/handler.php");

ہیڈر اور فوٹر

جب آپ پی ڈی ایف بناتے ہیں تو آپ درخواست کرسکتے ہیں کہ آپ کسی خاص کو لاگو کرنا چاہتے ہیں سانچے پیدا پی ڈی ایف میں. یہ ٹیمپلیٹ ہونا چاہئے saveڈی پہلے سے ہی ہے اور ہیڈر اور فوٹر کے مندرجات کے ساتھ ساتھ کسی خاص متغیر کی بھی وضاحت کرے گا۔ مثال کے نیچے کوڈ میں صارف اپنے ٹیمپلیٹ کو "میرے ٹیمپلیٹ" کے نام سے استعمال کررہا ہے۔

اگر بالترتیب ہیڈر یا فوٹر کے ل enough کافی حد تک اوپر یا نیچے مارجن نہیں ہے تو ، یہ پی ڈی ایف میں ظاہر نہیں ہوگا۔ مندرجہ ذیل مثال میں ہم نے کافی مقدار میں جگہ فراہم کرنے کے لئے اوپر اور نیچے مارجن 20 پر طے کیا ہے۔

$grabzIt = new \GrabzIt\GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret");

$options = new \GrabzIt\GrabzItPDFOptions();
$options->setMarginTop(20);
$options->setMarginBottom(20);
$options->setTemplateId("my template");

$grabzIt->URLToPDF("https://www.tesla.com", $options);
//Then call the Save or SaveTo method
$grabzIt->SaveTo("result.pdf");
$grabzIt = new \GrabzIt\GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret");

$options = new \GrabzIt\GrabzItPDFOptions();
$options->setMarginTop(20);
$options->setMarginBottom(20);
$options->setTemplateId("my template");

$grabzIt->HTMLToPDF("<html><body><h1>Hello World!</h1></body></html>", $options);
//Then call the Save or SaveTo method
$grabzIt->SaveTo("result.pdf");
$grabzIt = new \GrabzIt\GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret");

$options = new \GrabzIt\GrabzItPDFOptions();
$options->setMarginTop(20);
$options->setMarginBottom(20);
$options->setTemplateId("my template");

$grabzIt->FileToPDF("example.html", $options);
//Then call the Save or SaveTo method
$grabzIt->SaveTo("result.pdf");

HTML عنصر کو پی ڈی ایف میں تبدیل کریں

اگر آپ صرف کسی HTML عنصر کو تبدیل کرنا چاہتے ہیں جیسے کہ Div یا مدت براہ راست intOA پی ڈی ایف دستاویز GrabzIt کی پی ایچ پی لائبریری کے ساتھ آپ کر سکتے ہیں۔ آپ کو پاس کرنا ہوگا سی ایس ایس سلیکٹر HTML عنصر کی جس میں آپ تبدیل کرنا چاہتے ہیں setTargetElement طریقہ.

...
<span id="Article">
<p>This is the content I am interested in.</p>
<img src="myimage.jpg">
</span>
...

اس مثال میں ، ہم چاہتے ہیں کہ اس مدت میں وہ تمام مواد حاصل کریں جس کی شناخت ہو Article، لہذا ہم اسے GrabzIt کے پاس جیسا کہ ذیل میں دکھایا گیا ہے۔

$grabzIt = new \GrabzIt\GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret");

$options = new \GrabzIt\GrabzItPDFOptions();
$options->setTargetElement("#Article");

$grabzIt->URLToPDF("http://www.bbc.co.uk/news", $options);
//Then call the Save or SaveTo method
$grabzIt->SaveTo("result.pdf");

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