public function getBlocks($pdiNo, $opts = array())
	{
		$this->debug->groupCollapsed(__CLASS__.'->'.__FUNCTION__);
		$p = $this->p;
		$arrayUtil = new ArrayUtil();
		$opts = array_merge(array(
			'page'		=> null,
			'props'		=> array(),	// the properties to return (or all if empty)
			), $opts);
		#debug('opts', $opts);
		$blocks = array();
		try {
			if ($opts['page'] === null) {
				$this->debug->log('get blocks for all pages');
				$page_count = $p->pcos_get_number($pdiNo, '/Root/Pages/Count');
				$page_start = 0;
				$page_end	= $page_count - 1;
			} else {
				$page_start = $opts['page'];
				$page_end	= $opts['page'];
			}
			if (!empty($opts['props']) && !in_array('ID', $opts['props'])) {
				$opts['props'][] = 'ID';	// need ID for sorting
			}
			for ($pageNo = $page_start; $pageNo <= $page_end; $pageNo++) {
				$this->debug->log('pageNo', $pageNo);
				$block_count = $p->pcos_get_number($pdiNo, 'length:pages['.$pageNo.']/blocks');
				for ($i = 0; $i < $block_count; $i++) {
					$path = 'pages['.$pageNo.']/blocks['.$i.']';
					$block = $this->getProperties($pdiNo, $path, $opts);
					$block['page'] = $pageNo;
					#$this->debug->log('block',$block);
					$blocks[ $block['Name'] ] = $block;
				}
			}
		} catch ( PDFlibException $e ) {
			$this->debug->warn('exception: '.$e->faultcode.', faultstring: '.$e->faultstring);
		}
		$blocks = $arrayUtil->fieldSort($blocks, array('page','ID'));
		$this->debug->log('blocks', $blocks);
		$this->debug->groupEnd();
		return $blocks;
	}