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

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

PHP, API

GrabzIt નું PHP API મદદ કરવા માટે નીચેની સુવિધાઓ પ્રદાન કરે છે intદા.ત. GrabzIt intઓ તમારી એપ્લિકેશન શક્ય તેટલી સરળતાથી વેબ પૃષ્ઠો અથવા HTML ને સીધા પીડીએફ દસ્તાવેજોમાં રૂપાંતરિત કરતી વખતે. જો કે તમે પ્રારંભ કરતા પહેલા યાદ રાખો કે ફોન કર્યા પછી 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 PHP હેન્ડલર પર પાછા ફર્યા છે. હમણાં પૂરતું આ કસ્ટમ આઇડેન્ટિફાયર ડેટાબેસ ઓળખકર્તા હોઈ શકે છે, જેનાથી સ્ક્રીનશોટ અથવા પીડીએફને કોઈ ચોક્કસ ડેટાબેઝ રેકોર્ડ સાથે સંકળાયેલ હોઈ શકે છે.

$grabzIt = new \GrabzIt\GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret");

$options = new \GrabzIt\GrabzItPDFOptions();
$options->setCustomId(123456);

$grabzIt->URLToPDF("https://www.tesla.com", $options);
//Then call the Save method
$grabzIt->Save("http://www.example.com/handler.php");
$grabzIt = new \GrabzIt\GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret");

$options = new \GrabzIt\GrabzItPDFOptions();
$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.php");
$grabzIt = new \GrabzIt\GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret");

$options = new \GrabzIt\GrabzItPDFOptions();
$options->setCustomId(123456);

$grabzIt->FileToPDF("example.html", $options);
//Then call the Save method
$grabzIt->Save("http://www.example.com/handler.php");

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

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

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

$grabzIt = new \GrabzIt\GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret");

$options = new \GrabzIt\GrabzItPDFOptions();
$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");
$grabzIt = new \GrabzIt\GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret");

$options = new \GrabzIt\GrabzItPDFOptions();
$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");
$grabzIt = new \GrabzIt\GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret");

$options = new \GrabzIt\GrabzItPDFOptions();
$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 તત્વને પીડીએફમાં કન્વર્ટ કરો

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

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

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

$grabzIt = new \GrabzIt\GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret");

$options = new \GrabzIt\GrabzItPDFOptions();
$options->setTargetElement("#Article");

$grabzIt->URLToPDF("http://www.bbc.co.uk/news", $options);
//Then call the Save or SaveTo method
$grabzIt->SaveTo("result.pdf");

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