The Peng--Robinson equation of state (PR-EoS) has become one of the most extensively applied equations of state in chemical engineering and the petroleum industry due to its excellent accuracy in predicting the thermodynamic properties of a wide variety of materials, especially hydrocarbons. Although great effort has been made to construct efficient numerical methods for the diffuse interface models with PR-EoS, there is still not a linear numerical scheme that can be proved to preserve the original energy dissipation law. In order to pursue such a numerical scheme, we propose a novel energy factorization (EF) approach, which first factorizes an energy function into a product of several factors and then treats the factors using their properties to obtain the semi-implicit linear schemes. We apply the EF approach to deal with the Helmholtz free energy density determined by PR-EoS, and then propose a linear semi-implicit numerical scheme that inherits the original energy dissipation law. Moreover, the proposed scheme is proved to satisfy the maximum principle in both time semidiscrete form and cell-centered finite difference fully discrete form under certain conditions. Numerical results are presented to demonstrate the stability and efficiency of the proposed scheme.