'text_count = the number of text pages
image_count = the number of images'

def _header_record(self, text_count, chapter_count, link_count, image_count):

    compression = 10
    non_text_offset = (text_count + 1)
    chapter_offset = non_text_offset
    link_offset = (chapter_offset + chapter_count)
    if (image_count > 0):
        image_data_offset = (link_offset + link_count)
        meta_data_offset = (image_data_offset + image_count)
        last_data_offset = (meta_data_offset + 1)
    else:
        meta_data_offset = (link_offset + link_count)
        last_data_offset = (meta_data_offset + 1)
        image_data_offset = last_data_offset
    if (chapter_count == 0):
        chapter_offset = last_data_offset
    if (link_count == 0):
        link_offset = last_data_offset
    record = ''
    record += struct.pack('>H', compression)
    record += struct.pack('>H', 0)
    record += struct.pack('>H', 0)
    record += struct.pack('>H', 25152)
    record += struct.pack('>H', 0)
    record += struct.pack('>H', 0)
    record += struct.pack('>H', non_text_offset)
    record += struct.pack('>H', chapter_count)
    record += struct.pack('>H', 0)
    record += struct.pack('>H', 0)
    record += struct.pack('>H', image_count)
    record += struct.pack('>H', link_count)
    record += struct.pack('>H', 1)
    record += struct.pack('>H', 0)
    record += struct.pack('>H', 0)
    record += struct.pack('>H', 0)
    record += struct.pack('>H', chapter_offset)
    record += struct.pack('>H', 2560)
    record += struct.pack('>H', last_data_offset)
    record += struct.pack('>H', last_data_offset)
    record += struct.pack('>H', image_data_offset)
    record += struct.pack('>H', link_offset)
    record += struct.pack('>H', meta_data_offset)
    record += struct.pack('>H', 0)
    record += struct.pack('>H', last_data_offset)
    record += struct.pack('>H', last_data_offset)
    record += struct.pack('>H', last_data_offset)
    for i in range(54, 132, 2):
        record += struct.pack('>H', 0)
    return record
