Skip to content

I Get an empty page when I create a pdf #1

Description

@hyderali0889

I am new to this library and when I try to create pdf from files from my computer an empty output.pdf is opened
This is how I am creating my pdf

 try {
      for (var img in files) {
        page.graphics.drawImage(PdfBitmap(File(img.path).readAsBytesSync()),
            const Rect.fromLTWH(0, 120, 500, 200));
        File('Output.pdf').writeAsBytes(PdfDocument().save());
       

        PdfDocument().dispose();
      }
    } catch (e) {
      print(e);
    } 

and this is how I am saving and opening it

 try {
      final path = await provider.getDownloadsPath();
      final file = File('$path/Output.pdf');
      await file.writeAsBytes(bytes, flush: true);
      OpenFile.open('$path/Output.pdf');
    } catch (e) {
      print(e);
    } 

and this is how I am getting the files

 try {
      FilePickerResult? result =
          await FilePicker.platform.pickFiles(allowMultiple: true);

      if (result != null) {
        files = result.paths.map((path) => File(path!)).toList();

        setState(() {
          filesthere = true;
        });
      } else {}
    } catch (e) {
      print(e);
    }

I am using file_picker , path_provider , path_provider_windows , syncfusion_flutter_pdf and open_file packages

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions