Create a Ruby script that extracts data from a PDF file, specifically the text content within a certain range of pages and save it into a separate file in a structured format such as CSV or JSON. The script should also be able to handle different types of PDF files, including those with encrypted or compressed content. Additionally, the script should handle any errors and provide useful feedback to the user for troubleshooting purposes.
This prompt doesn't seem malicious.