DOCX અથવા PDF દસ્તાવેજોમાં હેડર અને/અથવા ફૂટર ઉમેરવા માટે તમારે પહેલા જરૂર છે એક નમૂના બનાવો, ઉલ્લેખિત ઓળખકર્તા સાથે. આ બાબતે report
. ટેમ્પલેટમાં તમે પ્રદર્શિત કરવા માંગો છો તે તમામ ટેક્સ્ટ, છબીઓ અને કોષ્ટકો, હેડર અને ફૂટર્સ ક્યારે બતાવવાના નિયમો સાથે શામેલ હોઈ શકે છે.
વધુમાં ટેમ્પલેટ્સમાં બિલ્ટ ઇન ચલોનો સમાવેશ થઈ શકે છે, જેમ કે પેજ નંબર. અથવા કસ્ટમ ટેમ્પલેટ વેરીએબલ્સ જેમાં કોઈપણ સાદો ટેક્સ્ટ હોઈ શકે છે. કસ્ટમ ટેમ્પલેટ વેરીએબલનો ઉપયોગ કરીને HTML પાસ કરવું શક્ય નથી, જો કે કોઈપણ /n અથવા /r અક્ષરોને લાઇન બ્રેક્સમાં રૂપાંતરિત કરવામાં આવશે.
નીચેના ઉદાહરણમાં, હેડર માટેના ટેક્સ્ટમાં કસ્ટમ વેરીએબલનો ઉપયોગ કરવામાં આવી રહ્યો છે {number}
વૈવિધ્યપૂર્ણ ચલ છે.
Report number: {number}
પછી તમે કોઈપણ ટેક્સ અથવા પીડીએફ ડોક્યુમેન્ટમાં નિર્દિષ્ટ હેડર ઉમેરવા માટે આ નમૂના ઓળખકર્તાને ગ્રાબઝિટ પર પસાર કરી શકો છો. ઉપરોક્ત હેડરની નીચે બતાવેલ ઉદાહરણોમાં, આપણે બનાવેલ દરેક પ્રોગ્રામિંગ ભાષા માટે, દરેક પેદા કરેલા પીડીએફ દસ્તાવેજમાં પ્રદર્શિત થાય છે. જો કે આ કોડને સરળતાથી ડોકક્સ દસ્તાવેજોમાં હેડર અને ફૂટર ઉમેરવા માટે અનુરૂપ થઈ શકે છે.
GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret"); PDFOptions options = new PDFOptions(); options.TemplateId = "report"; options.MarginTop = 50; options.MarginBottom = 50; options.AddTemplateParameter("number", "12345"); grabzIt.URLToPDF("http://www.spacex.com", options); grabzIt.Save("http://www.example.com/Home/Index");
GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret"); PDFOptions options = new PDFOptions(); options.setTemplateId("report"); options.setMarginTop(50); options.setMarginBottom(50); options.AddTemplateParameter("number", "12345"); grabzIt.URLToPDF("http://www.spacex.com", options); grabzIt.Save("http://www.example.com/handler");
<script src="https://cdn.jsdelivr.net/npm/@grabzit/js@3.5.2/grabzit.min.js"></script>
<script>
GrabzIt("Sign in to view your Application Key").AddTemplateVariable("number", "12345").ConvertURL("http://www.spacex.com",
{"format": "pdf",
"mtop":50,
"mbottom":50,
"templateid":"report"}).Create();
</script>
બહુવિધ ટેમ્પલેટ ચલોનો ઉલ્લેખ કરવા માટે ફક્ત દરેક કી મૂલ્યની જોડીને a સાથે અલગ કરો &
.
var grabzit = require('grabzit'); var client = new grabzit("Sign in to view your Application Key", "Sign in to view your Application Secret"); var options = {"marginTop":50,"marginBottom":50,"templateId":"report", "templateVariables":"number=12345"}; client.url_to_pdf("http://www.spacex.com", options); client.save("http://www.example.com/handler", function (error, id){ if (error != null){ throw error; } });
$grabzIt = GrabzItClient->new("Sign in to view your Application Key", "Sign in to view your Application Secret"); $options = GrabzItPDFOptions->new(); $options->marginTop(50); $options->marginBottom(50); $options->templateId("report"); $options->AddTemplateParameter("number","12345"); $grabzIt->URLToPDF("http://www.spacex.com", $options); $grabzIt->Save("http://www.example.com/handler.pl");
$grabzIt = new \GrabzIt\GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret"); $options = new \GrabzIt\GrabzItPDFOptions(); $options->setMarginTop(50); $options->setMarginBottom(50); $options->setTemplateId("report"); $options->AddTemplateParameter("number","12345"); $grabzIt->URLToPDF("http://www.spacex.com", $options); $grabzIt->Save("http://www.example.com/handler.php");
grabzIt = GrabzItClient.GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret") options = GrabzItPDFOptions.GrabzItPDFOptions() options.marginTop = 50 options.marginBottom = 50 options.templateId = "report" options.AddTemplateParameter("number","12345") grabzIt.URLToPDF("http://www.spacex.com", options) grabzIt.Save("http://www.example.com/handler.py")
વિનંતીઓ કરતી વખતે યાદ રાખો કૃપા કરીને ખાતરી કરો બધા પરિમાણ મૂલ્યો એ URL એન્કોડ કરેલા છે. નોંધ લો કે દરેક પોસ્ટ નામ અને મૂલ્ય પણ પહેલા URL એન્કોડ થયેલ હોવું જોઈએ. બહુવિધ ટેમ્પલેટ ચલોને સ્પષ્ટ કરવા માટે, ફક્ત દરેક કી મૂલ્યની જોડીને એક સાથે અલગ કરો &
, પછી URL ને એન્કોડ કરો tvars
પરિમાણ
https://api.grabz.it/services/convert?key=Sign in to view your Application Key&format=pdf&tvars=number%3D12345&mtop=50&mbottom=50&templateid=report&url=https%3A%2F%2Fspacex.com%2F
grabzIt = GrabzIt::Client.new("Sign in to view your Application Key", "Sign in to view your Application Secret") options = GrabzIt::PDFOptions.new() options.marginTop = 50 options.marginBottom = 50 options.templateId = "report" options.add_template_parameter("number","12345") grabzIt.url_to_pdf("http://www.spacex.com", options) grabzItClient.save("http://www.example.com/handler/index")
પીડીએફ દસ્તાવેજો ઉત્પન્ન કરતી વખતે તમારે ખાતરી કરવી આવશ્યક છે કે તમારા હેડર અથવા ફૂટર દેખાશે તે માટે પૂરતી જગ્યા છે. આ કરવા માટે હેડર દેખાવા માટે મોટા પર્યાપ્ત ટોચનું માર્જિન અને ફૂટર દેખાવા માટેનું પૂરતું વિશાળ તળિયા માર્જિનનો ઉલ્લેખ કરો. હાંસિયાના કદને મેળવવા માટે થોડી અજમાયશ અને ભૂલની જરૂર પડી શકે છે.