show pdf from URL and print in Flutter

25 Views Asked by At

I am using printing and pdf package then when i use this code:

  void _displayPdf() async {
final doc = pw.Document();
final netImage = await networkImage(
    'myPdfLink');

doc.addPage(pw.Page(
    pageFormat: PdfPageFormat.a4,
    build: (pw.Context context) {
      return pw.Center(
        child: pw.Image(netImage),
      ); // Center
    }));

It not work and return error like this : Unable to guess the image type 148939 bytes So what is the problem, my pdf file ussually more than 2 pages.

0

There are 0 best solutions below