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

વેબપેજ અને HTML ને પીડીએફમાં કન્વર્ટ કરો

નોડ.જેએસ API

વેબપેજ અને HTML ને પીડીએફમાં રૂપાંતરિત કરતી વખતે GrabzIt ની Node.js API નીચેની સુવિધાઓ પ્રદાન કરે છે જે મદદ કરે છે intદા.ત. GrabzIt intતમારી સિસ્ટમ શક્ય તેટલી સરળતાથી. જો કે તમે પ્રારંભ કરતા પહેલા યાદ રાખો કે ફોન કર્યા પછી url_to_pdf, html_to_pdf or file_to_pdf પદ્ધતિઓ save or save_to પીડીએફ સ્ક્રીનશોટ લેવા અથવા સીધા પીડીએફમાં એચટીએમએલને કન્વર્ટ કરવા માટે પદ્ધતિ કહેવી આવશ્યક છે.

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

વેબ પૃષ્ઠને કન્વર્ટ કરવા માટે ફક્ત એક જ પરિમાણ આવશ્યક છે intઅથવા પીડીએફ દસ્તાવેજ અથવા 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

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

તમે કસ્ટમ ઓળખાણકર્તાને પાસ કરી શકો છો પીડીએફ નીચે બતાવેલ પદ્ધતિઓ, આ મૂલ્ય પછી તમારા 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ડી અગાઉથી અને કોઈપણ ખાસ ચલો સાથે હેડર અને ફૂટરની સામગ્રીનો ઉલ્લેખ કરશે. નીચેનાં કોડમાં વપરાશકર્તા તેમના ટેમ્પલેટનો ઉપયોગ કરી રહ્યો છે જેને "મારો ટેમ્પલેટ" કહે છે.

જો અનુક્રમે હેડર અથવા ફૂટર માટે મોટો અથવા નીચેનો ગાળો ન હોય, તો તે પીડીએફમાં દેખાશે નહીં. પુષ્કળ જગ્યા પ્રદાન કરવા માટે નીચેના ઉદાહરણમાં, અમે 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 તત્વને પીડીએફમાં કન્વર્ટ કરો

જો તમે ફક્ત એચટીએમએલ તત્વ જેમ કે ડીવી અથવા સ્પ spન સીધા રૂપાંતરિત કરવા માંગો છો intOa PDF દસ્તાવેજ તમે GrabzIt ની Node.js લાઇબ્રેરીથી કરી શકો છો. તમારે પાસ કરવું આવશ્યક છે સીએસએસ પસંદગીકાર તમે HTML માં કન્વર્ટ કરવા માંગો છો તે 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 તત્વને લક્ષ્ય બનાવવું હોય ત્યારે પીડીએફ કેવી રીતે કાપવામાં આવે છે આ તકનીકોનો ઉપયોગ કરીને નિયંત્રિત.