diff --git a/packages/pdfx/lib/src/renderer/interfaces/page.dart b/packages/pdfx/lib/src/renderer/interfaces/page.dart index 96f22ae8..b85bb136 100644 --- a/packages/pdfx/lib/src/renderer/interfaces/page.dart +++ b/packages/pdfx/lib/src/renderer/interfaces/page.dart @@ -66,7 +66,7 @@ abstract class PdfPage { Future render({ required double width, required double height, - PdfPageImageFormat format = PdfPageImageFormat.jpeg, + PdfPageImageFormat format = PdfPageImageFormat.png, String? backgroundColor, Rect? cropRect, int quality = 100, diff --git a/packages/pdfx/test/pdfx_test.dart b/packages/pdfx/test/pdfx_test.dart index c72c8ebd..5f90f6fa 100644 --- a/packages/pdfx/test/pdfx_test.dart +++ b/packages/pdfx/test/pdfx_test.dart @@ -184,6 +184,37 @@ void main() { expect(pageImage.quality, 100); }); + test('render default args', () async { + final width = page.width * 2, height = page.height * 2; + final pageImage = (await page.render( + width: width, + height: height, + removeTempFile: false, + ))!; + + expect(log, [ + isMethodCall( + 'render', + arguments: { + 'pageId': page.id, + 'width': width, + 'height': height, + 'format': PdfPageImageFormat.png.value, + 'backgroundColor': '#00FFFFFF', + 'crop': false, + 'crop_x': null, + 'crop_y': null, + 'crop_height': null, + 'crop_width': null, + 'quality': 100, + 'forPrint': false, + }, + ), + ]); + + expect(pageImage.format, PdfPageImageFormat.png); + }); + test('close', () async { await page.close(); expect(page.isClosed, isTrue);