वेब कॅप्चर आणि रूपांतरित करण्यासाठी साधने

वेबपृष्ठे आणि एचडीएमएलला पीडीएफमध्ये रूपांतरित करा

नोड.जेएस एपीआय

वेबपृष्ठे आणि HTML पीडीएफमध्ये रूपांतरित करताना GrabzIt चे Node.js API मदत करते खालील वैशिष्ट्ये प्रदान करते intउदाहरणार्थ GrabzIt intओ तुमची प्रणाली शक्य तितक्या सहजतेने. तथापि आपण सुरू करण्यापूर्वी लक्षात ठेवा की कॉल केल्यावर url_to_pdf, html_to_pdf or file_to_pdf पद्धती save or save_to पीडीएफ स्क्रीनशॉट घेण्यासाठी किंवा एचडीएमएलला थेट पीडीएफमध्ये रुपांतरित करण्यासाठी पध्दती कॉल करणे आवश्यक आहे.

मूलभूत पर्याय

वेबपृष्ठ रूपांतरित करण्यासाठी फक्त एक पॅरामीटर आवश्यक आहे intकिंवा पीडीएफ दस्तऐवज किंवा करण्यासाठी एचडीएमएलला पीडीएफमध्ये रूपांतरित करा खाली दर्शविल्या प्रमाणे.

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डी आगाऊ आहे आणि हेडर आणि फूटरची सामग्री कोणत्याही विशिष्ट व्हेरिएबल्ससह निर्दिष्ट करेल. खाली दिलेल्या कोडमध्ये वापरकर्ता "माझे टेम्पलेट" नावाचे त्यांचे टेम्पलेट वापरत आहे.

अनुक्रमे शीर्षलेख किंवा तळटीपसाठी मोठे किंवा खालचे समास मोठे नसल्यास ते पीडीएफमध्ये दिसणार नाहीत. खाली दिलेल्या उदाहरणात आम्ही पुरेशी जागा देण्यासाठी एक्सएनयूएमएक्स वर वरच्या आणि खालच्या समाप्ती सेट केल्या आहेत.

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

एचटीएमएल घटक पीडीएफमध्ये रूपांतरित करा

आपण फक्त एखादा एचटीएमएल घटक रूपांतरित करू इच्छित असाल जसे की डिव किंवा स्पॅन थेट intकिंवा पीडीएफ दस्तऐवज आपण ग्रॅबझिटच्या नोड.जेएस लायब्ररीसह करू शकता. आपण पास करणे आवश्यक आहे सीएसएस निवडकर्ता आपण रूपांतरित करू इच्छित 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;
    }
});

एचटीएमएल घटकाला लक्ष्य करतेवेळी पीडीएफ कसे तयार होते या तंत्राचा वापर करून नियंत्रित केले.