ਵੈੱਬ ਨੂੰ ਕੈਪਚਰ ਅਤੇ ਕਨਵਰਟ ਕਰਨ ਲਈ ਟੂਲ

ਵੈਬ ਪੇਜਾਂ ਅਤੇ HTML ਨੂੰ ਪੀਡੀਐਫ ਵਿੱਚ ਬਦਲੋ

ਪਾਈਥਨ ਏਪੀਆਈ

ਜਦੋਂ ਵੈੱਬ ਪੰਨੇ ਅਤੇ HTML ਨੂੰ ਪੀਡੀਐਫ ਵਿੱਚ ਤਬਦੀਲ ਕਰਦੇ ਹੋ ਗਰੈਬਜ਼ਆਈਟੀ ਦਾ ਪਾਈਥਨ API ਹੇਠ ਲਿਖੀਆਂ ਵਿਸ਼ੇਸ਼ਤਾਵਾਂ ਪ੍ਰਦਾਨ ਕਰਦੇ ਹਨ ਜੋ ਸਹਾਇਤਾ ਕਰਦੀਆਂ ਹਨ intਉਦਾਹਰਣ ਲਈ GrabzIt intਓ ਤੁਹਾਡਾ ਸਿਸਟਮ ਜਿੰਨਾ ਸੰਭਵ ਹੋ ਸਕੇ ਆਸਾਨੀ ਨਾਲ. ਪਰ ਤੁਹਾਨੂੰ ਸ਼ੁਰੂ ਕਰਨ ਤੋਂ ਪਹਿਲਾਂ ਯਾਦ ਰੱਖੋ ਕਿ ਫੋਨ ਕਰਨ ਤੋਂ ਬਾਅਦ URLToPDF, HTMLToPDF or FileToPDF theੰਗ Save or SaveTo ਪੀਡੀਐਫ ਸਕ੍ਰੀਨਸ਼ਾਟ ਲੈਣ ਲਈ methodੰਗ ਨੂੰ ਬੁਲਾਉਣਾ ਲਾਜ਼ਮੀ ਹੈ.

ਮੁ Optionsਲੇ ਚੋਣਾਂ

ਵੈਬ ਪੇਜ ਨੂੰ ਕਨਵਰਟ ਕਰਨ ਵੇਲੇ ਅਕਸਰ intਓ ਪੀ ਡੀ ਐਫ ਦਸਤਾਵੇਜ਼ ਬਹੁਤ ਸਾਰੇ ਪੰਨੇ ਪੂਰੇ ਵੈੱਬਪੇਜ ਨੂੰ ਦਰਸਾਉਣ ਲਈ ਤਿਆਰ ਕੀਤੇ ਜਾਣਗੇ. ਵੈਬ ਪੇਜ ਨੂੰ ਬਦਲਣ ਲਈ ਸਿਰਫ ਇੱਕ ਪੈਰਾਮੀਟਰ ਦੀ ਲੋੜ ਹੁੰਦੀ ਹੈ intoa PDF ਦਸਤਾਵੇਜ਼ ਨੂੰ ਜਾਂ HTML ਨੂੰ PDF ਵਿੱਚ ਤਬਦੀਲ ਕਰੋ ਜਿਵੇਂ ਕਿ ਹੇਠਾਂ ਦਿੱਤੀਆਂ ਉਦਾਹਰਣਾਂ ਵਿੱਚ ਦਿਖਾਇਆ ਗਿਆ ਹੈ.

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

ਕਸਟਮ ਪਛਾਣਕਰਤਾ

ਤੁਸੀਂ ਇੱਕ ਕਸਟਮ ਪਛਾਣਕਰਤਾ ਨੂੰ ਪਾਸ ਕਰ ਸਕਦੇ ਹੋ PDF shownੰਗ ਜਿਵੇਂ ਕਿ ਹੇਠਾਂ ਦਰਸਾਇਆ ਗਿਆ ਹੈ, ਇਹ ਮੁੱਲ ਫਿਰ ਤੁਹਾਡੇ ਗਰੈਬਜ਼ਿਟ ਪਾਈਥਨ ਹੈਂਡਲਰ ਨੂੰ ਵਾਪਸ ਕਰ ਦਿੱਤਾ ਜਾਵੇਗਾ. ਉਦਾਹਰਣ ਵਜੋਂ ਇਹ ਕਸਟਮ ਪਛਾਣਕਰਤਾ ਇੱਕ ਡੇਟਾਬੇਸ ਪਛਾਣਕਰਤਾ ਹੋ ਸਕਦਾ ਹੈ, ਜਿਸ ਨਾਲ ਸਕ੍ਰੀਨਸ਼ਾਟ ਨੂੰ ਕਿਸੇ ਵਿਸ਼ੇਸ਼ ਡਾਟਾਬੇਸ ਰਿਕਾਰਡ ਨਾਲ ਜੋੜਿਆ ਜਾ ਸਕਦਾ ਹੈ.

from GrabzIt import GrabzItPDFOptions
from GrabzIt import GrabzItClient

grabzIt = GrabzItClient.GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret")

options = GrabzItPDFOptions.GrabzItPDFOptions()
options.customId = "123456"

grabzIt.URLToPDF("https://www.tesla.com", options)
# Then call the Save method
grabzIt.Save("http://www.example.com/handler.py")
from GrabzIt import GrabzItPDFOptions
from GrabzIt import GrabzItClient

grabzIt = GrabzItClient.GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret")

options = GrabzItPDFOptions.GrabzItPDFOptions()
options.customId = "123456"

grabzIt.HTMLToPDF("<html><body><h1>Hello World!</h1></body></html>", options)
# Then call the Save method
grabzIt.Save("http://www.example.com/handler.py")
from GrabzIt import GrabzItPDFOptions
from GrabzIt import GrabzItClient

grabzIt = GrabzItClient.GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret")

options = GrabzItPDFOptions.GrabzItPDFOptions()
options.customId = "123456"

grabzIt.FileToPDF("example.html", options)
# Then call the Save method
grabzIt.Save("http://www.example.com/handler.py")

ਸਿਰਲੇਖ ਅਤੇ ਫੁੱਟਰ

ਜਦੋਂ ਤੁਸੀਂ ਇੱਕ ਪੀਡੀਐਫ ਸਕ੍ਰੀਨਸ਼ਾਟ ਬਣਾਉਂਦੇ ਹੋ ਤਾਂ ਤੁਸੀਂ ਬੇਨਤੀ ਕਰ ਸਕਦੇ ਹੋ ਕਿ ਤੁਸੀਂ ਕਿਸੇ ਵਿਸ਼ੇਸ਼ ਨੂੰ ਲਾਗੂ ਕਰਨਾ ਚਾਹੁੰਦੇ ਹੋ ਟੈਪਲੇਟ ਤਿਆਰ ਕੀਤੀ PDF ਨੂੰ. ਇਹ ਨਮੂਨਾ ਹੋਣਾ ਚਾਹੀਦਾ ਹੈ saveਡੀ ਪਹਿਲਾਂ ਤੋਂ ਹੈ ਅਤੇ ਸਿਰਲੇਖ ਅਤੇ ਫੁੱਟਰ ਦੀ ਸਮੱਗਰੀ ਨੂੰ ਕਿਸੇ ਵਿਸ਼ੇਸ਼ ਵੇਰੀਏਬਲ ਦੇ ਨਾਲ ਦਰਸਾਏਗਾ. ਹੇਠਾਂ ਦਿੱਤੇ ਕੋਡ ਵਿਚ ਉਪਭੋਗਤਾ ਉਨ੍ਹਾਂ ਦੇ ਟੈਂਪਲੇਟ ਦੀ ਵਰਤੋਂ ਕਰ ਰਿਹਾ ਹੈ ਜਿਸ ਨੂੰ "ਮੇਰਾ ਟੈਂਪਲੇਟ" ਕਹਿੰਦੇ ਹਨ.

ਜੇ ਸਿਰਲੇਖ ਜਾਂ ਫੁੱਟਰ ਲਈ ਕ੍ਰਮਵਾਰ ਇਕ ਵੱਡਾ ਚੋਟੀ ਜਾਂ ਹੇਠਲਾ ਹਾਸ਼ੀਆ ਨਹੀਂ ਹੈ, ਤਾਂ ਇਹ ਪੀਡੀਐਫ ਵਿਚ ਦਿਖਾਈ ਨਹੀਂ ਦੇਵੇਗਾ. ਹੇਠਲੀ ਉਦਾਹਰਣ ਵਿੱਚ ਅਸੀਂ ਕਾਫ਼ੀ ਜਗ੍ਹਾ ਪ੍ਰਦਾਨ ਕਰਨ ਲਈ ਚੋਟੀ ਦੇ ਅਤੇ ਹੇਠਾਂ ਦੇ ਹਾਸ਼ੀਏ ਨੂੰ 20 ਤੇ ਨਿਰਧਾਰਤ ਕੀਤਾ ਹੈ.

from GrabzIt import GrabzItPDFOptions
from GrabzIt import GrabzItClient

grabzIt = GrabzItClient.GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret")

options = GrabzItPDFOptions.GrabzItPDFOptions()
options.marginTop = 20
options.marginBottom = 20
options.templateId = "my template"

grabzIt.FileToPDF("example.html", options)
# Then call the Save or SaveTo method
grabzIt.SaveTo("result.pdf")

HTML ਐਲੀਮੈਂਟ ਨੂੰ PDF ਵਿੱਚ ਬਦਲੋ

ਜੇ ਤੁਸੀਂ ਸਿਰਫ ਇੱਕ HTML ਐਲੀਮੈਂਟ ਜਿਵੇਂ ਕਿ ਇੱਕ ਡਿਵ ਜਾਂ ਸਪੈਨ ਸਿੱਧੇ ਰੂਪ ਵਿੱਚ ਬਦਲਣਾ ਚਾਹੁੰਦੇ ਹੋ intਓ ਪੀ ਡੀ ਐਫ ਦਸਤਾਵੇਜ਼ ਜੋ ਤੁਸੀਂ ਗਰੈਬਜ਼ਿਟ ਦੀ ਪਾਈਥਨ ਲਾਇਬ੍ਰੇਰੀ ਨਾਲ ਕਰ ਸਕਦੇ ਹੋ. ਤੁਹਾਨੂੰ ਪਾਸ ਕਰਨਾ ਚਾਹੀਦਾ ਹੈ CSS ਚੋਣਕਾਰ ਐਲੀਮੈਂਟਲ ਐਲਿਮੰਟ ਦਾ ਜਿਸ ਨੂੰ ਤੁਸੀਂ ਤਬਦੀਲ ਕਰਨਾ ਚਾਹੁੰਦੇ ਹੋ targetElement ਪੈਰਾਮੀਟਰ.

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

ਇਸ ਉਦਾਹਰਣ ਵਿੱਚ, ਅਸੀਂ ਸਾਰੀ ਸਮਗਰੀ ਨੂੰ ਉਸ ਅਵਧੀ ਵਿੱਚ ਕੈਪਚਰ ਕਰਨਾ ਚਾਹੁੰਦੇ ਹਾਂ ਜਿਸ ਦੀ ਆਈ ਡੀ ਹੈ Article, ਇਸ ਲਈ ਅਸੀਂ ਇਸ ਨੂੰ ਹੇਠਾਂ ਦਰਸਾਏ ਅਨੁਸਾਰ ਗਰੈਬਜ਼ਿਟ ਨੂੰ ਦਿੰਦੇ ਹਾਂ.

from GrabzIt import GrabzItPDFOptions
from GrabzIt import GrabzItClient

grabzIt = GrabzItClient.GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret")

options = GrabzItPDFOptions.GrabzItPDFOptions()
options.targetElement = "#Article"

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

ਇੱਕ ਐਚਡੀਐਮਐਲ ਐਲੀਮੈਂਟ ਨੂੰ ਨਿਸ਼ਾਨਾ ਬਣਾਉਂਦੇ ਸਮੇਂ ਇੱਕ ਪੀਡੀਐਫ ਕਿਵੇਂ ਤਿਆਰ ਕੀਤੀ ਜਾਂਦੀ ਹੈ ਇਨ੍ਹਾਂ ਤਕਨੀਕਾਂ ਦੀ ਵਰਤੋਂ ਨਾਲ ਨਿਯੰਤਰਿਤ.