જ્યારે HTML ફાઇલો, વેબ પૃષ્ઠો અથવા સાદા HTML ને પીડીએફમાં રૂપાંતરિત કરો ત્યારે. GrabzIt ની જાવા API નીચેની સુવિધાઓ પ્રદાન કરે છે જે મદદ કરે છે intદા.ત. GrabzIt intતમારી સિસ્ટમ શક્ય તેટલી સરળતાથી.
જો કે તમે પ્રારંભ કરતા પહેલા યાદ રાખો કે ફોન કર્યા પછી URLToPDF, HTMLToPDF or FileToPDF પદ્ધતિઓ. ક્યાં તો Save or SaveTo પીડીએફ સ્ક્રીનશોટ લેવા અથવા સીધા પીડીએફમાં એચટીએમએલને કન્વર્ટ કરવા માટે પદ્ધતિ કહેવી આવશ્યક છે.
એક પીડીએફ સ્ક્રીનશોટ સમગ્ર વેબ પૃષ્ઠને કબજે કરે છે અને તેને રૂપાંતરિત કરે છે intoa પીડીએફ ફાઇલ જેમાં ઘણા પૃષ્ઠો શામેલ હોઈ શકે છે. લક્ષ્ય વેબ પૃષ્ઠની લંબાઈના આધારે. વેબ પૃષ્ઠને કન્વર્ટ કરવા માટે ફક્ત એક જ પરિમાણ આવશ્યક છે intઓએ પીડીએફ દસ્તાવેજ. અથવા તો HTML ને પીડીએફમાં કન્વર્ટ કરો નીચે દર્શાવ્યા મુજબ.
grabzIt.URLToPDF("https://www.tesla.com"); //Then call the Save or SaveTo method
grabzIt.HTMLToPDF("<html><body><h1>Hello World!</h1></body></html>"); //Then call the Save or SaveTo method
grabzIt.FileToPDF("example.html"); //Then call the Save or SaveTo method
તમે કસ્ટમ ઓળખાણકર્તાને પાસ કરી શકો છો પીડીએફ નીચે બતાવેલ પદ્ધતિઓ. આ મૂલ્ય પછી તમારા GrabzIt જાવા હેન્ડલર પર પાછા ફર્યા છે. હમણાં પૂરતું આ કસ્ટમ આઇડેન્ટિફાયર ડેટાબેસ ઓળખકર્તા હોઈ શકે છે, સ્ક્રીનશ .ટને ચોક્કસ ડેટાબેઝ રેકોર્ડ સાથે જોડવાની મંજૂરી આપે છે.
GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret"); PDFOptions options = new PDFOptions(); options.setCustomId("123456"); grabzIt.URLToPDF("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"); PDFOptions options = new PDFOptions(); options.setCustomId("123456"); grabzIt.HTMLToPDF("<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"); PDFOptions options = new PDFOptions(); options.setCustomId("123456"); grabzIt.FileToPDF("example.html", options); //Then call the Save method grabzIt.Save("http://www.example.com/handler");
જ્યારે તમે પીડીએફ સ્ક્રીનશોટ બનાવો છો ત્યારે તમે વિનંતી કરી શકો છો કે તમે કોઈ વિશેષને લાગુ કરવા માંગો છો નમૂનો જનરેટ પીડીએફ પર. આ ટેમ્પલેટ હોવો જોઈએ saveઅગાઉથી ડી. તે કોઈપણ વિશેષ ચલો સાથે હેડર અને ફૂટરની સામગ્રીને સ્પષ્ટ કરશે. નીચે આપેલા ઉદાહરણ કોડમાં વપરાશકર્તા નમૂના બનાવે છે જેનો તેઓએ "મારુ ટેમ્પલેટ" કહે છે.
જો અનુક્રમે હેડર અથવા ફૂટર માટે મોટું પૂરતું ટોચ અથવા નીચેનું માર્જિન ન હોય તો. તે પીડીએફમાં દેખાશે નહીં. પુષ્કળ જગ્યા પ્રદાન કરવા માટે નીચેના ઉદાહરણમાં, અમે 20 પર ટોચ અને તળિયા માર્જિન સેટ કર્યા છે.
GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret"); PDFOptions options = new PDFOptions(); options.setMarginTop(20); options.setMarginBottom(20); options.setTemplateId("my template"); grabzIt.URLToPDF("https://www.tesla.com", options); //Then call the Save or SaveTo method grabzIt.SaveTo("result.pdf");
GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret"); PDFOptions options = new PDFOptions(); options.setMarginTop(20); options.setMarginBottom(20); options.setTemplateId("my template"); grabzIt.HTMLToPDF("<html><body><h1>Hello World!</h1></body></html>", options); //Then call the Save or SaveTo method grabzIt.SaveTo("result.pdf");
GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret"); PDFOptions options = new PDFOptions(); options.setMarginTop(20); options.setMarginBottom(20); options.setTemplateId("my template"); grabzIt.FileToPDF("example.html", options); //Then call the Save or SaveTo method grabzIt.SaveTo("result.pdf");
જો તમે ફક્ત HTML દસ્તાવેજમાંથી એક જ HTML ઘટકને કન્વર્ટ કરવા માંગો છો. જેમ કે એક જ ડીવ અથવા સ્પanનને સીધા રૂપાંતરિત કરવું intOa PDF દસ્તાવેજ તમે GrabzIt ની જાવા લાઇબ્રેરી સાથે કરી શકો છો. તમારે પાસ કરવું આવશ્યક છે સીએસએસ પસંદગીકાર તમે HTML માં કન્વર્ટ કરવા માંગો છો તે HTML ઘટક છે setTargetElement
પદ્ધતિ
... <span id="Article"> <p>This is the content I am interested in.</p> <img src="myimage.jpg"> </span> ...
આ ઉદાહરણમાં, અમે સ્પેનમાં બધી સામગ્રી કેપ્ચર કરવા માંગીએ છીએ જેની આઈડી છે Article
. તેથી અમે નીચે બતાવ્યા પ્રમાણે, આ આઈડી GrabzIt ને આપીએ છીએ.
GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret"); PDFOptions options = new PDFOptions(); options.setTargetElement("#Article"); grabzIt.URLToPDF("http://www.bbc.co.uk/news", options); //Then call the Save or SaveTo method grabzIt.SaveTo("result.pdf");
જ્યારે HTML તત્વને લક્ષ્ય બનાવવું હોય ત્યારે પીડીએફ કેવી રીતે કાપવામાં આવે છે આ તકનીકોનો ઉપયોગ કરીને નિયંત્રિત.