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

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

Node.js API

ویب صفحات اور HTML کو پی ڈی ایف میں تبدیل کرتے وقت GrabzIt's Node.js API مدد کرنے میں مندرجہ ذیل خصوصیات مہیا کرتی ہیں intمثال کے طور پر GrabzIt into آپ کا سسٹم جتنا آسانی سے ممکن ہو سکے۔ تاہم ، اس سے پہلے کہ آپ فون کریں ، یاد رکھیں url_to_pdf, html_to_pdf or file_to_pdf طریقوں save or save_to پی ڈی ایف اسکرین شاٹ لینے کے لئے یا HTML کو سیدھے پی ڈی ایف میں تبدیل کرنے کے ل method طریقہ کا مطالبہ کرنا ضروری ہے۔

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

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

client.url_to_pdf("https://www.tesla.com");
//Then call the save or save_to method
client.html_to_pdf("<html><body><h1>Hello World!</h1></body></html>");
//Then call the save or save_to method
client.file_to_pdf("example.html");
//Then call the save or save_to method

کسٹم شناختی

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

var grabzit = require('grabzit');

var client = new grabzit("Sign in to view your Application Key", "Sign in to view your Application Secret");

var options = {"customId":123456};

client.url_to_pdf("https://www.tesla.com", options);
//Then call the save method
client.save("http://www.example.com/handler", function (error, id){
    if (error != null){
        throw error;
    }
});
var grabzit = require('grabzit');

var client = new grabzit("Sign in to view your Application Key", "Sign in to view your Application Secret");

var options = {"customId":123456};

client.html_to_pdf("<html><body><h1>Hello World!</h1></body></html>", options);
//Then call the save method
client.save("http://www.example.com/handler", function (error, id){
    if (error != null){
        throw error;
    }
});
var grabzit = require('grabzit');

var client = new grabzit("Sign in to view your Application Key", "Sign in to view your Application Secret");

var options = {"customId":123456};

client.file_to_pdf("example.html", options);
//Then call the save method
client.save("http://www.example.com/handler", function (error, id){
    if (error != null){
        throw error;
    }
});

ہیڈر اور فوٹر

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

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

var grabzit = require('grabzit');

var client = new grabzit("Sign in to view your Application Key", "Sign in to view your Application Secret");

var options = {"marginTop":20,"marginBottom":20,"templateId":"my template"};

client.url_to_pdf("https://www.tesla.com", options);
//Then call the save or save_to method
client.save_to("result.pdf", function (error, id){
    //this callback is called once the capture is downloaded
    if (error != null){
        throw error;
    }
});
var grabzit = require('grabzit');

var client = new grabzit("Sign in to view your Application Key", "Sign in to view your Application Secret");

var options = {"marginTop":20,"marginBottom":20,"templateId":"my template"};

client.html_to_pdf("<html><body><h1>Hello World!</h1></body></html>", options);
//Then call the save or save_to method
client.save_to("result.pdf", function (error, id){
    //this callback is called once the capture is downloaded
    if (error != null){
        throw error;
    }
});
var grabzit = require('grabzit');

var client = new grabzit("Sign in to view your Application Key", "Sign in to view your Application Secret");

var options = {"marginTop":20,"marginBottom":20,"templateId":"my template"};

client.file_to_pdf("example.html", options);
//Then call the save or save_to method
client.save_to("result.pdf", function (error, id){
    //this callback is called once the capture is downloaded
    if (error != null){
        throw error;
    }
});

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

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

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

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

var grabzit = require('grabzit');

var client = new grabzit("Sign in to view your Application Key", "Sign in to view your Application Secret");

grabzIt.url_to_pdf("http://www.bbc.co.uk/news", {"targetElement":"#Article"});
//Then call the save or save_to method
client.save_to("result.pdf", function (error, id){
    //this callback is called once the capture is downloaded
    if (error != null){
        throw error;
    }
});

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