\documentclass{book}

\newif\ifbackground
\makeatletter
\@ifpackageloaded{background}%
{\backgroundtrue}{\backgroundfalse}
\makeatother

\usepackage{xepersian}
\settextfont[Scale=1.4]{XB Zar}



\begin{document}
	\frontmatter
	\ifbackground
	{\addtocontents{toc}{\protect\hypertarget{mytoc}{}}
	\tableofcontents
	\NoBgThispage}%TRUE
	{\tableofcontents}%FALSE
	\fi
	\mainmatter
	\chapter{فصل اول}
	\section{بخش اول}
	نوشته بخش اول
	\section{بخش دوم}
	نوشته بخش دوم
\end{document}