def URLToPDF(self, url, options=None): if (options == None): options = GrabzItPDFOptions.GrabzItPDFOptions() self.request = Request.Request( self.protocol + self.WebServicesBaseURLGet + self.TakePDF, False, options, url)
def convert_url_pdf(url): filename1 = datetime.now().strftime("%Y%m%d-%H%M%S") path = "tmp\pdf\{}.pdf".format(filename1) try: grabzIt = GrabzItClient.GrabzItClient( "YmI5YzRiY2U1NzI3NDNkMTk5OGJjNDRkNjNkNmUxNGE=", "RT8/Pz8/egY/Pz8/Vz8/OD8/Cz8RRj8/Pz8/PyEOMz8=") options = GrabzItPDFOptions.GrabzItPDFOptions() grabzIt.URLToPDF(url, options) grabzIt.SaveTo(path) grabzIt.SaveTo(path) except pdfcrowd.Error as why: # report the error sys.stderr.write('Pdfcrowd Error: {}\n'.format(why)) # rethrow or handle the exception raise return path
def HTMLToPDF(self, html, options=None): if (options == None): options = GrabzItPDFOptions.GrabzItPDFOptions() self.request = Request.Request( self.WebServicesBaseURLPost + self.TakePDF, True, options, html)