PyMuPDF 1.24.2 Documentation
open("test.pdf") doc = fitz.open() # empty output PDF for spage in src: # for each page in input r = spage.rect # input page rectangle d = fitz.Rect(spage.cropbox_position, # CropBox displacement if ---------------- r1 = r / 2 # top left rect r2 = r1 + (r1.width, 0, r1.width, 0) # top right rect r3 = r1 + (0, r1.height, 0, r1.height) # bottom left rect r4 = fitz.Rect(r1.br, r.br) # bottom right right rect rect_list = [r1, r2, r3, r4] # put them in a list for rx in rect_list: # run thru rect list rx += d # add the CropBox displacement page = doc.new_page(-1, # new output page with rx dimensions0 码力 | 565 页 | 6.84 MB | 1 年前3Scrapy 0.16 Documentation
options: • --callback or -c: spider method to use as callback for parsing the response • --rules or -r: use CrawlSpider rules to discover the callback (ie. spider method) to use for parsing the response HtmlXPathSelector(response) item = Item() item['id'] = hxs.select('//td[@id="item_id"]/text()').re(r'ID: (\d+)') item['name'] = hxs.select('//td[@id="item_name"]/text()').extract() item['description'] = ['id', 'name', 'description'] def parse_row(self, response, row): log.msg('Hi, this is a row!: %r' % row) item = TestItem() item['id'] = row['id'] item['name'] = row['name'] item['description'] = row['description']0 码力 | 203 页 | 931.99 KB | 1 年前3Scrapy 0.16 Documentation
Supported options: --callback or -c: spider method to use as callback for parsing the response --rules or -r: use CrawlSpider rules to discover the callback (ie. spider method) to use for parsing the response HtmlXPathSelector(response) item = Item() item['id'] = hxs.select('//td[@id="item_id"]/text()').re(r'ID: (\d+)') item['name'] = hxs.select('//td[@id="item_name"]/text()').extract() 'name', 'description'] def parse_row(self, response, row): log.msg('Hi, this is a row!: %r' % row) item = TestItem() item['id'] = row['id'] item['name'] = row['name']0 码力 | 272 页 | 522.10 KB | 1 年前3Scrapy 0.18 Documentation
options: • --callback or -c: spider method to use as callback for parsing the response • --rules or -r: use CrawlSpider rules to discover the callback (ie. spider method) to use for parsing the response HtmlXPathSelector(response) item = Item() item['id'] = hxs.select('//td[@id="item_id"]/text()').re(r'ID: (\d+)') item['name'] = hxs.select('//td[@id="item_name"]/text()').extract() item['description'] = ['id', 'name', 'description'] def parse_row(self, response, row): log.msg('Hi, this is a row!: %r' % row) item = TestItem() item['id'] = row['id'] item['name'] = row['name'] item['description'] = row['description']0 码力 | 201 页 | 929.55 KB | 1 年前3Scrapy 0.22 Documentation
options: • --callback or -c: spider method to use as callback for parsing the response • --rules or -r: use CrawlSpider rules to discover the callback (ie. spider method) to use for parsing the response url) sel = Selector(response) item = Item() item[’id’] = sel.xpath(’//td[@id="item_id"]/text()’).re(r’ID: (\d+)’) item[’name’] = sel.xpath(’//td[@id="item_name"]/text()’).extract() item[’description’] = = [’id’, ’name’, ’description’] def parse_row(self, response, row): log.msg(’Hi, this is a row!: %r’ % row) item = TestItem() item[’id’] = row[’id’] item[’name’] = row[’name’] item[’description’] = row[’description’]0 码力 | 199 页 | 926.97 KB | 1 年前3Scrapy 0.20 Documentation
options: • --callback or -c: spider method to use as callback for parsing the response • --rules or -r: use CrawlSpider rules to discover the callback (ie. spider method) to use for parsing the response url) sel = Selector(response) item = Item() item[’id’] = sel.xpath(’//td[@id="item_id"]/text()’).re(r’ID: (\d+)’) item[’name’] = sel.xpath(’//td[@id="item_name"]/text()’).extract() item[’description’] = = [’id’, ’name’, ’description’] def parse_row(self, response, row): log.msg(’Hi, this is a row!: %r’ % row) item = TestItem() item[’id’] = row[’id’] item[’name’] = row[’name’] item[’description’] = row[’description’]0 码力 | 197 页 | 917.28 KB | 1 年前3PyMuPDF 1.12.2 documentation
shifted on writing a new modern graphics library called ``Fitz``. Fitz was originally intended as an R&D project to replace the aging Ghostscript graphics library, but has instead become the rendering # update info dict r = annot.rect # take annot rect r.x1 = r.x0 + r.width * 1.2 # new location has same top-left r.y1 = r.y0 + r.height * 1.2 # but but 20% longer sides annot.setRect(r) # update rectangle annot.updateImage() # update appearance doc.save("circle-out.pdf", garbage=4) # save This is how the circle0 码力 | 387 页 | 2.70 MB | 1 年前3Scrapy 0.20 Documentation
Supported options: --callback or -c: spider method to use as callback for parsing the response --rules or -r: use CrawlSpider rules to discover the callback (ie. spider method) to use for parsing the response Selector(response) item = Item() item['id'] = sel.xpath('//td[@id="item_id"]/text()').re(r'ID: (\d+)') item['name'] = sel.xpath('//td[@id="item_name"]/text()').extract() item['description'] 'name', 'description'] def parse_row(self, response, row): log.msg('Hi, this is a row!: %r' % row) item = TestItem() item['id'] = row['id'] item['name'] = row['name']0 码力 | 276 页 | 564.53 KB | 1 年前3Scrapy 0.18 Documentation
Supported options: --callback or -c: spider method to use as callback for parsing the response --rules or -r: use CrawlSpider rules to discover the callback (ie. spider method) to use for parsing the response HtmlXPathSelector(response) item = Item() item['id'] = hxs.select('//td[@id="item_id"]/text()').re(r'ID: (\d+)') item['name'] = hxs.select('//td[@id="item_name"]/text()').extract() 'name', 'description'] def parse_row(self, response, row): log.msg('Hi, this is a row!: %r' % row) item = TestItem() item['id'] = row['id'] item['name'] = row['name']0 码力 | 273 页 | 523.49 KB | 1 年前3Scrapy 0.22 Documentation
Supported options: --callback or -c: spider method to use as callback for parsing the response --rules or -r: use CrawlSpider rules to discover the callback (ie. spider method) to use for parsing the response Selector(response) item = Item() item['id'] = sel.xpath('//td[@id="item_id"]/text()').re(r'ID: (\d+)') item['name'] = sel.xpath('//td[@id="item_name"]/text()').extract() item['description'] 'name', 'description'] def parse_row(self, response, row): log.msg('Hi, this is a row!: %r' % row) item = TestItem() item['id'] = row['id'] item['name'] = row['name']0 码力 | 303 页 | 566.66 KB | 1 年前3
共 556 条
- 1
- 2
- 3
- 4
- 5
- 6
- 56