> ## Documentation Index
> Fetch the complete documentation index at: https://docs.abbyy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Reference document assembly

> Set up a reference document assembly in FlexiLayout Studio to verify how pages are assembled into documents, using Header and Footer matching options.

A reference assembly specifies exactly how pages should be assembled into documents.

Like a reference layout, a reference assembly is used to debug a FlexiLayout. It lets you compare the way your FlexiLayout assembles pages into documents against an assembly that is known to be correct.

## Create a reference document assembly

<Steps>
  <Step title="Select the pages">
    In the **Batch** window, select the pages.
  </Step>

  <Step title="Open the Assemble to Reference Document dialog box">
    Right-click the selection and select **Assemble to Reference Documents...** on the shortcut menu.
  </Step>

  <Step title="Select how the pages must be grouped into documents">
    In the **Assemble to Reference Document** dialog box, you can either assemble all the selected pages into one document (select **One document**) or specify the number of pages in a document (select **Group by page count** and type in the number of pages in a document).
  </Step>

  <Step title="Specify whether the first page matches the Header element">
    Select **First page of document matches Header** if the **Header** element must be matched with the first page of a document. Do not select this option if no **Header** element is used to assemble documents (that is, a set number of pages is used instead) or if there is no **Header** element on the selected pages or it cannot be reliably matched.
  </Step>

  <Step title="Specify whether the last page matches the Footer element">
    Select **Last page of document matches Footer** if the **Footer** element must be matched with the last page of a document. Do not select this option if no **Footer** element is used to assemble documents (that is, a set number of pages is used instead) or if there is no **Footer** element on the selected pages or it cannot be reliably matched.
  </Step>

  <Step title="Click OK">
    The reference assembly will be displayed in **Reference layout** viewing mode: the beginning and end of the document will be indicated by blue markers in the corners.
  </Step>
</Steps>

## Change the Header and Footer options for individual pages

You can clear the **First page of document matches Header** and **Last page of document matches Footer** options for individual pages (for example, if there is no footer in a document). The pages will still be assembled: the end of the document will be detected based on the **Header** element found on the first page of the next document.

<Steps>
  <Step title="Select the page or pages" />

  <Step title="Open the Change Reference Header/Footer dialog box">
    Right-click the selection and select **Change Reference Header/Footer...** on the shortcut menu.
  </Step>

  <Step title="Select or clear the options">
    Select or clear the **First page of document matches Header** and **Last page of document matches Footer** options.
  </Step>
</Steps>

## View the reference assembly

To view the reference assembly, activate **Reference layout** viewing mode by clicking the <img src="https://mintcdn.com/abbyy/fmgRWFNHKYN2MLSg/images/flexi-capture/fls/Mode_ReferenceLayout.gif?fit=max&auto=format&n=fmgRWFNHKYN2MLSg&q=85&s=ae59515ce5497aabaeb0a780685df3f6" alt="Reference layout viewing mode button" style={{display:"inline-block",verticalAlign:"middle",margin:0}} width="21" height="23" data-path="images/flexi-capture/fls/Mode_ReferenceLayout.gif" /> button on the toolbar.

To review the differences between the reference document assembly and the assembly obtained with your FlexiLayout, activate **Difference layout** viewing mode by clicking the <img src="https://mintcdn.com/abbyy/fmgRWFNHKYN2MLSg/images/flexi-capture/fls/Mode_Differences.gif?fit=max&auto=format&n=fmgRWFNHKYN2MLSg&q=85&s=8858abb0b1940432238e7581c56f75f1" alt="Difference layout viewing mode button" style={{display:"inline-block",verticalAlign:"middle",margin:0}} width="24" height="24" data-path="images/flexi-capture/fls/Mode_Differences.gif" /> button on the toolbar.

The corner markers show where the two assemblies differ:

* **Red markers** – The beginning or end of a document specified in the reference assembly but not detected by the current FlexiLayout
* **Green markers** – The beginning or end of a document detected by the FlexiLayout but not specified in the reference assembly

## Reference assembly columns in the Batch window

The **Batch** window shows information about the reference assembly alongside the corresponding information for the matched FlexiLayout.

| Column                        | Description                                                                   |
| ----------------------------- | ----------------------------------------------------------------------------- |
| **Reference Document Number** | Number of the document to which the page belongs in the reference assembly    |
| **Reference Sequence Number** | Number of the page within that document in the reference assembly             |
| **Matched Document Number**   | Number of the document to which the page belongs, for the matched FlexiLayout |
| **Matched Sequence Number**   | Number of the page within that document, for the matched FlexiLayout          |

The letters H or F in brackets show whether the **Header** or **Footer** element must be matched with the page.

Aim to create a FlexiLayout whose **Matched Document Number** and **Matched Sequence Number** columns coincide with the **Reference Document Number** and **Reference Sequence Number** columns of the reference assembly.
