વેબસાઇટ્સનો સંપૂર્ણ છબી સ્ક્રીનશોટ બનાવો અથવા નીચેની સુવિધાઓનો ઉપયોગ કરીને સીધા HTML ને છબીઓમાં કન્વર્ટ કરો GrabzIt ની જાવા API. જો કે તમે પ્રારંભ કરતા પહેલા યાદ રાખો કે ફોન કર્યા પછી URLToImage, HTMLToImage or FileToImage પદ્ધતિઓ Save or SaveTo સ્ક્રીનશ takeટ લેવા માટે પદ્ધતિને ક beલ કરવી આવશ્યક છે.
વેબ પૃષ્ઠનો સ્ક્રીનશોટ લેવા માટે ફક્ત એક પરિમાણ આવશ્યક છે અથવા એચટીએમએલ કન્વર્ટ intઓ એક છબી ફાઇલ. નીચેના ઉદાહરણમાં બતાવ્યા પ્રમાણે.
grabzIt.URLToImage("https://www.tesla.com"); //Then call the Save or SaveTo method
grabzIt.HTMLToImage("<html><body><h1>Hello World!</h1></body></html>"); //Then call the Save or SaveTo method
grabzIt.FileToImage("example.html"); //Then call the Save or SaveTo method
GrabzIt ની જાવા એપીઆઇ JPG, PNG, WEBP, BMP (8 બીટ, 16 બીટ, 24 બીટ અથવા 32 બીટ) અને TIFF સહિતના ઘણાં ફોર્મેટ્સમાં છબી સ્ક્રીનશોટ લઈ શકે છે. છબી સ્ક્રીનશોટ માટેનું ડિફ defaultલ્ટ ફોર્મેટ જેપીજી છે. જો કે આ પરિસ્થિતિમાં કેટલીક એપ્લિકેશનો માટે જેપીઇજી ઇમેજની ગુણવત્તા એટલી સારી હોઇ શકે નહીં કે ઇમેજ સ્ક્રીનશ forટ્સ માટે પી.એન.જી. ફોર્મેટની ભલામણ કરવામાં આવે છે કારણ કે તે ગુણવત્તા અને ફાઇલ કદ વચ્ચે સંતુલન આપે છે. નીચેનું ઉદાહરણ બતાવે છે કે PNG ફોર્મેટનો ઉપયોગ કરીને લેવામાં આવતા એક છબીનો સ્ક્રીનશોટ.
GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret"); ImageOptions options = new ImageOptions(); options.setFormat(ImageFormat.PNG); grabzIt.URLToImage("https://www.tesla.com", options); //Then call the Save or SaveTo method grabzIt.SaveTo("result.png");
GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret"); ImageOptions options = new ImageOptions(); options.setFormat(ImageFormat.PNG); grabzIt.HTMLToImage("<html><body><h1>Hello World!</h1></body></html>", options); //Then call the Save or SaveTo method grabzIt.SaveTo("result.png");
GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret"); ImageOptions options = new ImageOptions(); options.setFormat(ImageFormat.PNG); grabzIt.FileToImage("example.html", options); //Then call the Save or SaveTo method grabzIt.SaveTo("result.png");
બ્રાઉઝર કદ એ બ્રાઉઝર વિંડોના કદનો સંદર્ભ આપે છે જેનો ઉપયોગ જ્યારે મોટાભાગના કિસ્સાઓમાં સ્ક્રીનશshotટને કેપ્ચર કરતી વખતે કરવામાં આવશે ત્યારે આને સેટ કરવાની જરૂર નથી કારણ કે લગભગ બધા કાર્યો માટે ડિફ .લ્ટ બ્રાઉઝર કદ પૂરતું હશે. બ્રાઉઝરનું કદ સુયોજિત કરવા માટે ફક્ત એક કિંમત પસાર કરો setBrowserWidth અને setBrowserHeight ની પદ્ધતિઓ ImageOptions વર્ગ.
setBrowserWidth
setBrowserHeight
છબીનું કદ બદલવું સરળ છે, છબીને વિકૃત કર્યા વિના કરવું થોડું મુશ્કેલ છે. સંપૂર્ણ પ્રક્રિયાને સરળ બનાવવા માટે અમે તમને આનો ઉપયોગ કરવાની ભલામણ કરીએ છીએ સરળ છબી પરિમાણ કેલ્ક્યુલેટર.
જો તમે ઈમેજની પહોળાઈ અને .ંચાઈને બ્રાઉઝરની પહોળાઈ અને heightંચાઈ કરતા મોટા કદમાં વધારવા માંગતા હો, જે મૂળભૂત રીતે 1024 પિક્સેલ્સ દ્વારા 728 છે, તો બ્રાઉઝરની પહોળાઈ અને heightંચાઈ પણ મેચ કરવા માટે વધારવી આવશ્યક છે.
તમે કસ્ટમ ઓળખાણકર્તાને પાસ કરી શકો છો છબી નીચે બતાવેલ પદ્ધતિઓ, આ મૂલ્ય પછી તમારા GrabzIt જાવા હેન્ડલર પર પાછા ફર્યા છે. હમણાં પૂરતું આ કસ્ટમ આઇડેન્ટિફાયર ડેટાબેસ ઓળખકર્તા હોઈ શકે છે, સ્ક્રીનશ .ટને ચોક્કસ ડેટાબેઝ રેકોર્ડ સાથે જોડવાની મંજૂરી આપે છે.
GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret"); ImageOptions options = new ImageOptions(); options.setCustomId("123456"); grabzIt.URLToImage("https://www.tesla.com", options); //Then call the Save method grabzIt.Save("http://www.example.com/handler");
GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret"); ImageOptions options = new ImageOptions(); options.setCustomId("123456"); grabzIt.HTMLToImage("<html><body><h1>Hello World!</h1></body></html>", options); //Then call the Save method grabzIt.Save("http://www.example.com/handler");
GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret"); ImageOptions options = new ImageOptions(); options.setCustomId("123456"); grabzIt.FileToImage("example.html", options); //Then call the Save method grabzIt.Save("http://www.example.com/handler");
GrabzIt તમને આ કરવા માટે આખા વેબ પૃષ્ઠનો સંપૂર્ણ લંબાઈનો સ્ક્રીનશ takeટ લેવાની મંજૂરી આપે છે આ કરવા માટે તમારે -1 ને પસાર કરવાની જરૂર છે setBrowserHeight પદ્ધતિ. છબી બ્રાઉઝરના કદ સાથે મેળ ખાતી છે તેની ખાતરી કરવા માટે આ એક -1 પસાર કરે છે setHeight અને setWidth પદ્ધતિઓ
setHeight
setWidth
GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret"); ImageOptions options = new ImageOptions(); options.setBrowserHeight(-1); options.setWidth(-1); options.setHeight(-1); grabzIt.URLToImage("https://www.tesla.com", options); //Then call the Save or SaveTo method grabzIt.SaveTo("result.jpg");
GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret"); ImageOptions options = new ImageOptions(); options.setBrowserHeight(-1); options.setWidth(-1); options.setHeight(-1); grabzIt.HTMLToImage("<html><body><h1>Hello World!</h1></body></html>", options); //Then call the Save or SaveTo method grabzIt.SaveTo("result.jpg");
GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret"); ImageOptions options = new ImageOptions(); options.setBrowserHeight(-1); options.setWidth(-1); options.setHeight(-1); grabzIt.FileToImage("example.html", options); //Then call the Save or SaveTo method grabzIt.SaveTo("result.jpg");
તમે થંબનેલ્સ પણ પાછા આપી શકો છો જે કાપવામાં નથી આવ્યા, પરંતુ સાવચેત રહો આ મોટી છબીઓ બનાવી શકે છે. આ કરવા માટે a -1 ને પાસ કરો setHeight અને / અથવા setWidth પદ્ધતિઓ. કોઈપણ પરિમાણ કે જે -1 પસાર થાય છે તે કાપવામાં આવશે નહીં.
GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret"); ImageOptions options = new ImageOptions(); options.setWidth(-1); options.setHeight(-1); grabzIt.URLToImage("https://www.tesla.com", options); //Then call the Save or SaveTo method grabzIt.SaveTo("result.jpg");
GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret"); ImageOptions options = new ImageOptions(); options.setWidth(-1); options.setHeight(-1); grabzIt.HTMLToImage("<html><body><h1>Hello World!</h1></body></html>", options); //Then call the Save or SaveTo method grabzIt.SaveTo("result.jpg");
GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret"); ImageOptions options = new ImageOptions(); options.setWidth(-1); options.setHeight(-1); grabzIt.FileToImage("example.html", options); //Then call the Save or SaveTo method grabzIt.SaveTo("result.jpg");
આ વિશેષ મૂલ્યોનો ઉપયોગ કરવાનો અર્થ એ છે કે તમે એક સ્ક્રીનશોટ બનાવી શકો છો જે જો તમે ઈચ્છો તો સંપૂર્ણ વેબ પૃષ્ઠનું સંપૂર્ણ પાયે સંસ્કરણ છે!
GrabzIt તમને કોઈ પણ HTML ઘટકનો સ્ક્રીનશોટ લેવાની મંજૂરી આપે છે જ્યાં સુધી તેમાં કોઈ id અથવા વર્ગ લક્ષણ હોય, જેમ કે div or span ટ tagગ કરો અને તેની બધી સામગ્રી કેપ્ચર કરો. આ કરવા માટે તમે જે એચટીએમએલ તત્વોનો સ્ક્રીનશ screenટ કરવા માંગો છો તે એક તરીકે નિર્દિષ્ટ થયેલ હોવું જ જોઈએ સીએસએસ પસંદગીકાર.
div
span
... <div id="features"> <img src="http://www.example.com/football.jpg"/><h3>Local Team Loses</h3> </div> ...
નીચેના ઉદાહરણમાં આઇડી "સુવિધાઓ" સાથેનો ભાગ કબજે કરવામાં આવે છે અને એક 250 x 250px JPEG છબી તરીકે આઉટપુટ કરે છે.
GrabzItClient grabzIt = new GrabzItClient("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 ImageOptions options = new ImageOptions(); options.setWidth(250); options.setHeight(250); options.setFormat(ImageFormat.JPG); options.setTargetElement("#features"); grabzIt.URLToImage("http://www.bbc.co.uk/news", options); //Then call the Save or SaveTo method grabzIt.SaveTo("result.jpg");
આગળનું ઉદાહરણ ફરીથી "સુવિધાઓ" દિવાને કબજે કરે છે પરંતુ આ વખતે જેપીઇજી છબી બહાર કાutsે છે જે બરાબર એ જ ડીવીના કદની છે.
GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret"); // The -1 indicates that image should not be cropped ImageOptions options = new ImageOptions(); options.setWidth(-1); options.setHeight(-1); options.setBrowserHeight(-1); options.setFormat(ImageFormat.JPG); options.setTargetElement("#features"); grabzIt.URLToImage("http://www.bbc.co.uk/news", options); //Then call the Save or SaveTo method grabzIt.SaveTo("result.jpg");