How to convert PDF file to base64 string in ionic

Hello All,

im looking for a way to convert PDF File to base64 string .

i have tried with the ionic base64 plugin which works on Android but for for IOS.

i have also tried the below file plugin

this.file.readAsDataURL(“filepath”, fileName).then(

                          file64 => {
                            console.log('file in 64: ', file64);
                             this returns  == data:application/pdf;base64
                          
                          }).catch(err => {
                          console.log('booooooo');
                        });

filepath looks like this == “file:///Users/venkatswamydandaboina/Library/Developer/CoreSimulator/Devices/9A8C76B7-F443-409E-8B62-377E7713DB67/data/Containers/Data/Application/D1AD60AE-D75C-4065-8B44-32470A3DA5DA/Library/NoCloud/”

but it doesnt returns base64 string it only returns “data:application/pdf;base64”.

Please help me out.
Thanks