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

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

રૂબી API

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

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

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

grabzItClient.url_to_pdf("https://www.tesla.com")
# Then call the save or save_to method
grabzItClient.html_to_pdf("<html><body><h1>Hello World!</h1></body></html>")
# Then call the save or save_to method
grabzItClient.file_to_pdf("example.html")
# Then call the save or save_to method

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

તમે કસ્ટમ ઓળખાણકર્તાને પાસ કરી શકો છો પીડીએફ નીચે બતાવેલ પદ્ધતિઓ, આ મૂલ્ય પછી તમારા GrabzIt રૂબી હેન્ડલર પર પાછા ફર્યા છે. દાખલા તરીકે આ કસ્ટમ આઇડેન્ટિફાયર ડેટાબેસ ઓળખકર્તા હોઈ શકે છે, જેનાથી સ્ક્રીનશોટને કોઈ ચોક્કસ ડેટાબેઝ રેકોર્ડ સાથે સંકળાયેલ હોઈ શકે છે.

grabzItClient = GrabzIt::Client.new("Sign in to view your Application Key", "Sign in to view your Application Secret")

options = GrabzIt::PDFOptions.new()
options.customId = "123456"

grabzItClient.url_to_pdf("https://www.tesla.com", options)
# Then call the save method
grabzItClient.save("http://www.example.com/handler/index")
grabzItClient = GrabzIt::Client.new("Sign in to view your Application Key", "Sign in to view your Application Secret")

options = GrabzIt::PDFOptions.new()
options.customId = "123456"

grabzItClient.html_to_pdf("<html><body><h1>Hello World!</h1></body></html>", options)
# Then call the save method
grabzItClient.save("http://www.example.com/handler/index")
grabzItClient = GrabzIt::Client.new("Sign in to view your Application Key", "Sign in to view your Application Secret")

options = GrabzIt::PDFOptions.new()
options.customId = "123456"

grabzItClient.file_to_pdf("example.html", options)
# Then call the save method
grabzItClient.save("http://www.example.com/handler/index")

હેડરો અને ફૂટર્સ

જ્યારે તમે પીડીએફ સ્ક્રીનશોટ બનાવો છો ત્યારે તમે વિનંતી કરી શકો છો કે તમે કોઈ વિશેષને લાગુ કરવા માંગો છો નમૂનો જનરેટ પીડીએફ પર. આ ટેમ્પલેટ હોવો જોઈએ saveડી અગાઉથી અને કોઈપણ ખાસ ચલો સાથે હેડર અને ફૂટરની સામગ્રીનો ઉલ્લેખ કરશે. નીચેનાં કોડમાં વપરાશકર્તા તેમના ટેમ્પલેટનો ઉપયોગ કરી રહ્યો છે જેને "મારો ટેમ્પલેટ" કહે છે.

જો અનુક્રમે હેડર અથવા ફૂટર માટે મોટો અથવા નીચેનો ગાળો ન હોય, તો તે પીડીએફમાં દેખાશે નહીં. પુષ્કળ જગ્યા પ્રદાન કરવા માટે નીચેના ઉદાહરણમાં, અમે 20 પર ટોચ અને તળિયા માર્જિન સેટ કર્યા છે.

grabzItClient = GrabzIt::Client.new("Sign in to view your Application Key", "Sign in to view your Application Secret")

options = GrabzIt::PDFOptions.new()
options.marginTop = 20
options.marginBottom = 20
options.templateId = "my template"

grabzItClient.url_to_pdf("https://www.tesla.com", options)
# Then call the save or save_to method
grabzItClient.save_to("result.pdf")
grabzItClient = GrabzIt::Client.new("Sign in to view your Application Key", "Sign in to view your Application Secret")

options = GrabzIt::PDFOptions.new()
options.marginTop = 20
options.marginBottom = 20
options.templateId = "my template"

grabzItClient.html_to_pdf("<html><body><h1>Hello World!</h1></body></html>", options)
# Then call the save or save_to method
grabzItClient.save_to("result.pdf")
grabzItClient = GrabzIt::Client.new("Sign in to view your Application Key", "Sign in to view your Application Secret")

options = GrabzIt::PDFOptions.new()
options.marginTop = 20
options.marginBottom = 20
options.templateId = "my template"

grabzItClient.file_to_pdf("example.html", options)
# Then call the save or save_to method
grabzItClient.save_to("result.pdf")

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

જો તમે ફક્ત એચટીએમએલ તત્વ જેમ કે ડીવી અથવા સ્પ spન સીધા રૂપાંતરિત કરવા માંગો છો intOa PDF દસ્તાવેજ તમે GrabzIt ના રૂબી જેમ સાથે કરી શકો છો. તમારે પાસ કરવું આવશ્યક છે સીએસએસ પસંદગીકાર તમે HTML માં કન્વર્ટ કરવા માંગો છો તે HTML ઘટક છે targetElement પદ્ધતિ

...
<span id="Article">
<p>This is the content I am interested in.</p>
<img src="myimage.jpg">
</span>
...

આ ઉદાહરણમાં, અમે સ્પેનમાં બધી સામગ્રી કેપ્ચર કરવા માંગીએ છીએ જેની આઈડી છે Article, તેથી અમે નીચે બતાવ્યા પ્રમાણે તેને GrabzIt પર પસાર કરીએ છીએ.

grabzItClient = GrabzIt::Client.new("Sign in to view your Application Key", "Sign in to view your Application Secret")

options = GrabzIt::PDFOptions.new()
options.targetElement = "#Article"

grabzItClient.url_to_pdf("http://www.bbc.co.uk/news", options)
# Then call the save or save_to method
grabzItClient.save_to("result.pdf")

જ્યારે HTML તત્વને લક્ષ્ય બનાવવું હોય ત્યારે પીડીએફ કેવી રીતે કાપવામાં આવે છે આ તકનીકોનો ઉપયોગ કરીને નિયંત્રિત.