import {NativeModules} from 'react-native';

interface PdfToBitmapInterface {
    convertPdfToBitmaps(pdfBase64: string): Promise<string[]>;
}

const { PdfToBitmap } = NativeModules as { PdfToBitmap: PdfToBitmapInterface };

export async function convertPdfToBitmaps(pdfBase64: string): Promise<string[]> {
    try {
        return await PdfToBitmap.convertPdfToBitmaps(pdfBase64);
    } catch (error) {
        throw new Error(`Failed to convert PDF to bitmaps: ${error}`);
    }
}