how to get the page number for the case where if the data is not sufficient

hi All,
how to get the page number for the case where if the data is not sufficient and will print on the next page. i want a functionality that if the data is not sufficient and move to the next page i want to create one pdf not different pdf for them . with the code iam using iam creating two pdfs. i want to know which page got extended so that i give the range. please help me in vc++.

adding to my code just loop through and addd the data into the file ,iam sure how can we determine the data is for same page?

//i have recordset looping through this function based on the query , i dont know how to determine.
LlDefineFieldExt(m_hLLJob, strPrefix + strName, varContent.ToString(), nType, NULL);

CString strOptions;
strOptions.Format(_T(“PDF;Export.PageIndexRange=%d;PDF.FontMode=1”), lPagNo);

LlStgsysStorageConvert(strNewRptLL, strFile, strOptions);