ওয়েব ক্যাপচার এবং রূপান্তর করার সরঞ্জামসমূহ

ওয়েবপৃষ্ঠা এবং এইচটিএমএলকে পিডিএফে রূপান্তর করুন

নোড.জেএসপিআইপি

ওয়েব পৃষ্ঠাগুলি এবং এইচটিএমএলকে পিডিএফ রূপান্তর করার সময় গ্র্যাজআইটি'র নোড.জেএসআইপিআই নিম্নলিখিত বৈশিষ্ট্যগুলি সহায়তা করে intউদাহরণস্বরূপ GrabzIt intহে আপনার সিস্টেম যতটা সম্ভব সহজ। তবে আপনি শুরু করার আগে মনে রাখবেন যে ফোন করার পরে url_to_pdf, html_to_pdf or file_to_pdf পদ্ধতিগুলি save or save_to পিডিএফ স্ক্রিনশট নিতে বা এইচটিএমএলকে সরাসরি পিডিএফ রূপান্তর করতে পদ্ধতিটি কল করতে হবে।

বেসিক বিকল্পসমূহ

ওয়েব পৃষ্ঠায় রূপান্তর করতে কেবল একটি প্যারামিটার প্রয়োজন intoa পিডিএফ ডকুমেন্ট বা পিডিএলে এইচটিএমএল রূপান্তর করুন নিচে দেখানো হয়েছে.

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

কাস্টম আইডেন্টিফায়ার

আপনি একটি কাস্টম সনাক্তকারী পাস করতে পারেন পিডিএফ পদ্ধতিগুলি নীচে দেখানো হয়েছে, এই মানটি আপনার গ্র্যাবজিট নোড.জেএস হ্যান্ডলারের কাছে ফিরে আসে। উদাহরণস্বরূপ, এই কাস্টম শনাক্তকারী কোনও ডাটাবেস শনাক্তকারী হতে পারে, একটি স্ক্রিনশটকে একটি নির্দিষ্ট ডাটাবেস রেকর্ডের সাথে যুক্ত করার অনুমতি দেয়।

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ডি অগ্রিম এবং কোনও বিশেষ ভেরিয়েবলের সাথে শিরোনাম এবং পাদচরণের বিষয়বস্তু নির্দিষ্ট করে দেবে। নীচের উদাহরণ কোডে ব্যবহারকারী তাদের "আমার টেম্পলেট" নামক টেম্পলেটটি ব্যবহার করছেন।

যদি যথাক্রমে শিরোলেখ বা পাদলেখের জন্য যথেষ্ট পরিমাণে শীর্ষ বা নীচের মার্জিন না থাকে তবে এটি পিডিএফে প্রদর্শিত হবে না। নীচের উদাহরণে আমরা প্রচুর জায়গা সরবরাহের জন্য শীর্ষ এবং নীচের মার্জিনগুলি 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;
    }
});

এইচটিএমএল উপাদানকে পিডিএফে রূপান্তর করুন

আপনি যদি কোনও এইচটিএমএল উপাদান যেমন একটি ডিভ বা স্প্যান হিসাবে সরাসরি রূপান্তর করতে চান intoa পিডিএফ ডকুমেন্ট আপনি গ্রাবিজিটির নোড.জেএস লাইব্রেরির সাথে করতে পারেন can আপনি অবশ্যই পাস করতে হবে সিএসএস নির্বাচক আপনি যে রূপান্তর করতে চান এইচটিএমএল উপাদানটি targetElement প্যারামিটার।

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

এই উদাহরণে, আমরা স্প্যানের সমস্ত আইটেম ক্যাপচার করতে ইচ্ছুক যার আইডি রয়েছে Articleসুতরাং, আমরা নীচে প্রদর্শিত হিসাবে গ্র্যাবিট এটি পাস।

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

এইচটিএমএল উপাদানকে লক্ষ্য করে যখন পিডিএফটি ক্রপ করা হয় তখন তা কী হতে পারে এই কৌশলগুলি ব্যবহার করে নিয়ন্ত্রণ করা.