ગ્રાબઝિટનું સ્ક્રીનશોટ એપીઆઈ ખૂબ જ લવચીક છે અને તેને ઘણી રીતે બોલાવી શકાય છે જેમ કે ક્રોનજjobબ, વેબ પૃષ્ઠ અથવા એપ્લિકેશનથી. તમારી પર્લ એપ્લિકેશનમાં રૂપાંતર વિધેયમાં સ્ક્રીનશ screenટ્સ અથવા એચટીએમએલ ઉમેરવાની સૌથી સહેલી રીત આ પગલાંને અનુસરો:
એપીઆઈનો ઉપયોગ કરવા માટે તમારે પહેલા આનો દાખલો બનાવવાની જરૂર રહેશે GrabzItClient વર્ગ અને તમારા પાસ એપ્લિકેશન કી અને એપ્લિકેશન ગુપ્ત તમારા GrabzIt એકાઉન્ટથી કંસ્ટ્રક્ટર સુધી.
#!/usr/bin/perl use GrabzItClient; # Create the GrabzItClient class # Replace "APPLICATION KEY", "APPLICATION SECRET" with the values from your account! $grabzIt = GrabzItClient->new("Sign in to view your Application Key", "Sign in to view your Application Secret");
પછી એક વાપરો છબી, પીડીએફ, એનિમેશન or ટેબલ કેપ્ચર પદ્ધતિઓ URL ને or એચટીએમએલ કન્વર્ટ.
# To take a image screenshot $grabzIt->URLToImage("https://www.tesla.com"); # Or to take a PDF screenshot $grabzIt->URLToPDF("https://www.tesla.com"); # Or to convert online videos into animated GIF's $grabzIt->URLToAnimation("http://www.example.com/video.avi"); # Or to capture table(s) $grabzIt->URLToTable("https://www.tesla.com");
# To convert HTML into a image $grabzIt->HTMLToImage("<html><body><h1>Hello World!</h1></body></html>"); # Or convert HTML into a PDF document $grabzIt->HTMLToPDF("<html><body><h1>Hello World!</h1></body></html>"); # Or convert HTML into a CSV, XLSX or JSON document $grabzIt->HTMLToTable("<html><body><table><tr><th>Name</th><th>Age</th></tr> <tr><td>Tom</td><td>23</td></tr><tr><td>Nicola</td><td>26</td></tr> </table></body></html>");
# To convert HTML file into a image $grabzIt->FileToImage("example.html"); # Or convert HTML file into a PDF document $grabzIt->FileToPDF("example.html"); # Or convert HTML file into a CSV, XLSX or JSON document $grabzIt->FileToTable("tables.html");
અંતે નીચેના બેમાંથી એકનો ઉપયોગ કરો save પદ્ધતિઓ. પહેલું save નીચે બતાવેલ પદ્ધતિ માટે URL નો જરૂરી છે હેન્ડલ.પી.એલ. આ હેન્ડલર પ્રક્રિયા કરશે કૉલબૅક GrabzIt થી અને save પરિણામી સ્ક્રીનશ .ટ.
$grabzIt->Save("http://www.example.com/handler.pl");
જો આગ્રહણીય છે Save ઉપરની પદ્ધતિ પછી વાપરી શકાતી નથી સુસંગત SaveTo તેના બદલે પદ્ધતિનો ઉપયોગ થવો જોઈએ.
જો કે આ તમારી એપ્લિકેશનને કેપ્ચર બનાવવામાં આવે ત્યારે રાહ જોવાની ફરજ પાડશે, એકવાર સમાપ્ત થઈ જાય તે પછી તે આપમેળે થઈ જાય છે saveડી સ્પષ્ટ કરેલ ફાઇલ પાથ પર.
$filepath = "images/result.jpg"; $grabzIt->SaveTo($filepath);
જ્યારે સ્ક્રીનશોટ બનાવતી વખતે અથવા એચટીએમએલને કન્વર્ટ કરતી વખતે ઘણા બધા વિકલ્પો શામેલ છે; બ્રાઉઝરની heightંચાઈ, બ્રાઉઝરની પહોળાઈ, સ્ક્રીનશોટની heightંચાઇ, સ્ક્રીનશshotટની પહોળાઈ, સ્ક્રીનશ takenટ લેવાય તે પહેલાંનો વિલંબ અને સ્ક્રીનશ ofટનું છબી બંધારણ. આ બધા વિકલ્પો અને વધુ માટે કૃપા કરીને આ જુઓ ક્લાઈન્ટ દસ્તાવેજીકરણ.