createImageFromPDF method
Future<List<String> >
createImageFromPDF({
- required String inputPath,
- required String outputPath,
- int maxWidth = 360,
- int maxHeight = 360,
- bool createOneImage = true,
override
Creates an image or multiple images from a PDF file.
Converts a PDF to either a single image or multiple images based on the createOneImage
flag.
inputPath
- The path to the input PDF file.
outputPath
- The output path where the image(s) will be saved.
maxWidth
- Optional maximum width of the image(s) (default is 360).
maxHeight
- Optional maximum height of the image(s) (default is 360).
createOneImage
- A flag indicating whether to create one image (true) or multiple images (false).
Implementation
@override
Future<List<String>> createImageFromPDF({
required String inputPath,
required String outputPath,
int maxWidth = 360,
int maxHeight = 360,
bool createOneImage = true,
}) async {
final JSString jsInputPath = inputPath.toJS;
final JSArray<JSString> result = createOneImage
? (await pdfToImage(jsInputPath).toDart) as JSArray<JSString>
: (await convertPdfToImages(jsInputPath).toDart) as JSArray<JSString>;
return result.toList();
}