Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/pdfx/lib/src/renderer/interfaces/page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ abstract class PdfPage {
Future<PdfPageImage?> render({
required double width,
required double height,
PdfPageImageFormat format = PdfPageImageFormat.jpeg,
PdfPageImageFormat format = PdfPageImageFormat.png,
String? backgroundColor,
Rect? cropRect,
int quality = 100,
Expand Down
31 changes: 31 additions & 0 deletions packages/pdfx/test/pdfx_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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, <Matcher>[
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);
Expand Down