dart_pdf icon indicating copy to clipboard operation
dart_pdf copied to clipboard

image converted from pdf formed is blurry

Open RajithShetty619 opened this issue 2 years ago • 0 comments

pdf image formed is blurry

Code snippet to reproduce the behavior:

final http.Response responseData =
          await http.get(Uri.parse(workdone["invoice"]));

      Uint8List data = responseData.bodyBytes;
      var buffer = data.buffer;

      await for (var page in Printing.raster(
        data,
      )) {
        final image = await page.toPng(); // ...or page.toPng()
        pdf.addPage(pw.Page(build: (pw.Context context) {
          return pw.Expanded(
            child: pw.Image(
              pw.MemoryImage(image),
              fit: pw.BoxFit.fill,
            ),
          );
        }));
      }
    }

Expected a clear Image generated pdf file image actual pdf file image

Is there a better way to do this?

RajithShetty619 avatar Aug 03 '22 14:08 RajithShetty619