'How do I call this GetPageCount method in my program?

This is a program which selects a .ps file and shows the number of records and number of pages that will show on the application however after making a GetPageCount method, how do I call that mrthod in my openCVSFile method?

        public void openCVSFile(object sender, EventArgs e)//Opens the csv file
    {
        ofd.Multiselect = false;
        ofd.Filter = "Post Script files (*.ps)|*.ps";
        ofd.FilterIndex = 1;
        if(ofd.ShowDialog() == DialogResult.OK)
        {
            string filePath = ofd.FileName;
            StreamReader streamReader = new StreamReader(filePath);//reads file
            string[] linesOfData = new string[File.ReadAllLines(filePath).Length];
            int recordCount= -1;//title doesnt count towards number of records
            int pageCount = GetPageCount(filePath);
            for(int i = 0; i < linesOfData.Length; i++)//counts how many records there are
            {
                recordCount++;
            }
            

            txtRecordCount.Text = ("Number of Records: "+ recordCount+ " records");
            txtPrintCount.Text = ("Print count: " + pageCount + "pages");
        }
    }
    public static int GetPageCount(PrintDocument printDocument)//counts number of pages ()?
    {
        int count = 0;
        printDocument.PrintController = new PreviewPrintController();
        printDocument.PrintPage += (sender, e) => count++;
        printDocument.Print();
        return count;
    }


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source