我认为urllib2将为您提供所需的东西。
from urllib2 import Request, urlopenfrom pyPdf import PdfFileWriter, PdfFileReaderfrom StringIO import StringIOurl = "http://www.silicontao.com/ProgrammingGuide/other/beejnet.pdf"writer = PdfFileWriter()remoteFile = urlopen(Request(url)).read()memoryFile = StringIO(remoteFile)pdfFile = PdfFileReader(memoryFile)for pageNum in xrange(pdfFile.getNumPages()): currentPage = pdfFile.getPage(pageNum) #currentPage.mergePage(watermark.getPage(0)) writer.addPage(currentPage)outputStream = open("output.pdf","wb")writer.write(outputStream)outputStream.close()
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)