વેબને કેપ્ચર અને કન્વર્ટ કરવા માટેનાં સાધનો

વેબસાઇટ સ્ક્રીનશોટ કેપ્ચર કરો અથવા છબીઓમાં HTML ને કન્વર્ટ કરો

નોડ.જેએસ API

નીચેની સુવિધાઓનો ઉપયોગ કરીને વેબસાઇટ્સના સંપૂર્ણ છબી સ્ક્રીનશshotsટ્સ બનાવો GrabzIt ની Node.js API. જો કે તમે પ્રારંભ કરતા પહેલા યાદ રાખો કે ફોન કર્યા પછી url_to_image, html_to_image or file_to_image પદ્ધતિઓ save or save_to સ્ક્રીનશ takeટ લેવા માટે પદ્ધતિને ક beલ કરવી આવશ્યક છે.

મૂળભૂત વિકલ્પો

વેબ પૃષ્ઠનો સ્ક્રીનશોટ લેવા માટે ફક્ત એક પરિમાણ આવશ્યક છે અથવા એચટીએમએલ કન્વર્ટ intઓએ છબી નીચેના ઉદાહરણમાં બતાવ્યા પ્રમાણે.

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

છબી સ્ક્રીનશોટ ફોર્મેટ્સ

GrabzIt નો નોડ.જેએસ એપીઆઇ JPG, PNG, WEBP, BMP (8 બીટ, 16 બીટ, 24 બીટ અથવા 32 બીટ) અને TIFF સહિતના ઘણાં ફોર્મેટ્સમાં છબી સ્ક્રીનશોટ લઈ શકે છે. છબી સ્ક્રીનશોટ માટેનું ડિફ defaultલ્ટ ફોર્મેટ જેપીજી છે. જો કે જેપીજી ઇમેજની ગુણવત્તા કેટલાક એપ્લિકેશનો માટે પૂરતી સારી ન હોઈ શકે આ સંજોગોમાં પીએનજી ફોર્મેટને ઇમેજ સ્ક્રીનશોટ માટે ભલામણ કરવામાં આવે છે કારણ કે તે ગુણવત્તા અને ફાઇલ કદ વચ્ચે સારી સંતુલન આપે છે. નીચેનું ઉદાહરણ બતાવે છે કે PNG ફોર્મેટનો ઉપયોગ કરીને લેવામાં આવતા એક છબીનો સ્ક્રીનશોટ.

var grabzit = require('grabzit');

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

var options = {"format":"png"};

client.url_to_image("https://www.tesla.com", options);
//Then call the save or save_to method
client.save_to("result.png", 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 = {"format":"png"};

client.html_to_image("<html><body><h1>Hello World!</h1></body></html>", options);
//Then call the save or save_to method
client.save_to("result.png", 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 = {"format":"png"};

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

બ્રાઉઝરનું કદ

બ્રાઉઝર કદ એ બ્રાઉઝર વિંડોના કદનો સંદર્ભ આપે છે જેનો ઉપયોગ જ્યારે મોટાભાગના કિસ્સાઓમાં સ્ક્રીનશshotટને કેપ્ચર કરતી વખતે કરવામાં આવશે ત્યારે આ સેટ કરવાની જરૂર નથી કારણ કે તમામ મોટા ભાગના તમામ કાર્યો માટે ડિફ defaultલ્ટ બ્રાઉઝર કદ પૂરતું હશે. તેમ છતાં જો તમે બ્રાઉઝરની પહોળાઈ અને .ંચાઈ સેટ કરવા માંગતા હોવ તો એક ઉદાહરણ નીચે બતાવેલ છે.

var grabzit = require('grabzit');

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

var options = {"browserWidth":1366, "browserHeight":768};

client.url_to_image("https://www.tesla.com", options);
//Then call the save or save_to method
client.save_to("result.jpg", 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 = {"browserWidth":1366, "browserHeight":768};

client.html_to_image("<html><body><h1>Hello World!</h1></body></html>", options);
//Then call the save or save_to method
client.save_to("result.jpg", 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 = {"browserWidth":1366, "browserHeight":768};

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

છબી કદ બદલો

છબીનું કદ બદલવું સરળ છે, છબીને વિકૃત કર્યા વિના કરવું થોડું મુશ્કેલ છે. સંપૂર્ણ પ્રક્રિયાને સરળ બનાવવા માટે અમે તમને આનો ઉપયોગ કરવાની ભલામણ કરીએ છીએ સરળ છબી પરિમાણ કેલ્ક્યુલેટર.

જો તમે ઈમેજની પહોળાઈ અને .ંચાઈને બ્રાઉઝરની પહોળાઈ અને heightંચાઈ કરતા મોટા કદમાં વધારવા માંગતા હો, જે મૂળભૂત રીતે 1366 પિક્સેલ્સ દ્વારા 728 છે, તો બ્રાઉઝરની પહોળાઈ અને heightંચાઈ પણ મેચ કરવા માટે વધારવી આવશ્યક છે.

કસ્ટમ ઓળખકર્તા

તમે કસ્ટમ ઓળખાણકર્તાને પાસ કરી શકો છો છબી નીચે બતાવેલ પદ્ધતિઓ, આ મૂલ્ય પછી તમારા 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_image("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_image("<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_image("example.html", options);
//Then call the save method
client.save("http://www.example.com/handler", function (error, id){
    if (error != null){
        throw error;
    }
});

પૂર્ણ લંબાઈનો સ્ક્રીનશોટ

GrabzIt તમને આ કરવા માટે આખા વેબ પૃષ્ઠનો સંપૂર્ણ લંબાઈનો સ્ક્રીનશ takeટ લેવાની મંજૂરી આપે છે આ કરવા માટે તમારે -1 ને પસાર કરવાની જરૂર છે browserHeight મિલકત. છબી બ્રાઉઝરના કદ સાથે મેળ ખાતી છે તેની ખાતરી કરવા માટે આ એક -1 પસાર કરે છે height અને width ગુણધર્મો.

var grabzit = require('grabzit');

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

var options = {"browserHeight":-1,"width":-1, "height":-1};

client.url_to_image("https://www.tesla.com", options);
//Then call the save or save_to method
client.save_to("result.jpg", 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 = {"browserHeight":-1,"width":-1, "height":-1};

client.html_to_image("<html><body><h1>Hello World!</h1></body></html>", options);
//Then call the save or save_to method
client.save_to("result.jpg", 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 = {"browserHeight":-1,"width":-1, "height":-1};

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

તમે થંબનેલ્સ પણ પાછા આપી શકો છો જે કાપવામાં નથી આવ્યા, પરંતુ સાવચેત રહો આ મોટી છબીઓ બનાવી શકે છે. આ કરવા માટે a -1 ને પાસ કરો height અને / અથવા width ગુણધર્મો. પરિમાણ કે જે -1 પસાર થાય છે તે કાપવામાં આવશે નહીં.

var grabzit = require('grabzit');

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

var options = {"width":-1, "height":-1};

client.url_to_image("https://www.tesla.com", options);
//Then call the save or save_to method
client.save_to("result.jpg", 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 = {"width":-1, "height":-1};

client.html_to_image("<html><body><h1>Hello World!</h1></body></html>", options);
//Then call the save or save_to method
client.save_to("result.jpg", 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 = {"width":-1, "height":-1};

client.file_to_image("example.html", options);
//Then call the save or save_to method
client.save_to("result.jpg", function (error, id){
    //this callback is called once the capture is downloaded
    if (error != null){
        throw error;
    }
});
નોંધો કે બ્રાઉઝરની કોઈ પૂર્ણ પહોળાઈ નથી!

આ વિશેષ મૂલ્યોનો ઉપયોગ કરવાનો અર્થ એ છે કે તમે એક સ્ક્રીનશોટ બનાવી શકો છો જે જો તમે ઈચ્છો તો સંપૂર્ણ વેબ પૃષ્ઠનું સંપૂર્ણ પાયે સંસ્કરણ છે!

પૃષ્ઠના ઘટકનો સ્ક્રીનશોટ લો

GrabzIt તમને એચટીએમએલ તત્વનો સ્ક્રીનશોટ લેવાની મંજૂરી આપે છે, જેમ કે div or span ટ tagગ કરો અને તેની બધી સામગ્રી કેપ્ચર કરો. આ કરવા માટે તમે જે એચટીએમએલ તત્વોનો સ્ક્રીનશ screenટ કરવા માંગો છો તે એક તરીકે નિર્દિષ્ટ થયેલ હોવું જ જોઈએ સીએસએસ પસંદગીકાર.

...
<div id="features">
	<img src="http://www.example.com/boat.jpg"/><h3>New Boat Launched</h3>
</div>
...

નીચેના ઉદાહરણ માટે આપણે id ને "સુવિધાઓ" થી ડિવ પસંદ કરીશું અને તેને 250 x 250px JPEG ઇમેજ તરીકે આઉટપુટ કરીશું.

var grabzit = require('grabzit');

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

// The 250 parameters indicates that image should be sized to 250 x 250 px
var options = {"width":250, "height":250, "format":"jpg","target":"#features"};

client.url_to_image("http://www.bbc.co.uk/news", options);
//Then call the save or save_to method
client.save_to("result.jpg", 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");

// The minus ones indicates that image should not be cropped
var options = {"browserHeight":-1, "width":-1, "height":-1, "format":"jpg", "target":"#features"};

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