@Override
    public void onEndPage(PdfWriter writer, Document document) {

        boolean HeaderEnable = false;
        boolean FooterEnable = false;

        //Controllo se devo impostare l'header
        for (int i = 0; i < this._MyHeaderItemList.size(); i++) {
            HeaderEnable = ((HeaderEnable) || (this._MyHeaderItemList.get(i).GetEnable()));
        }
        //Controllo se devo impostare il footer
        for (int i = 0; i < this._MyFooterItemList.size(); i++) {
            FooterEnable = ((FooterEnable) || (this._MyFooterItemList.get(i).GetEnable()));
        }

        if (HeaderEnable) {
            SetHeader(writer, document);
        }
        if (FooterEnable) {
            SetFooter(writer, document);
        }

    }