thegrizzlylabs / geniusscan-sdk-demo

Demo apps for Genius Scan SDK
30 stars 38 forks source link

Can I merge multiple pdfs into one #64

Closed komritza closed 1 year ago

komritza commented 1 year ago

Hi there, I wanted to know if it's possible to merge multiple pdfs(created by genius scan) into one pdf file with your library?

As written in the docs this

  var appFolder = await getApplicationDocumentsDirectory();
          var documentUrl = appFolder.path + '/mydocument.pdf';
          var document = {
            'pages': [{ 'imageUrl': scanResult['scans'][0]['enhancedUrl'] }]
          };
          var documentGenerationConfiguration = { 'outputFileUrl': documentUrl };
          await FlutterGeniusScan.generateDocument(document, documentGenerationConfiguration);
          await OpenFile.open(documentUrl);

can be used to generate a PDF document but it requires an image type in order to do that.

Other question would be, can genius scan, when in single take mode, return a png/jpg file and not pdf?

Any help would be highly appreciated.

Thanks!

bvirlet commented 1 year ago

The return value of scanWithConfiguration contains the images (https://pub.dev/documentation/flutter_genius_scan/latest/flutter_genius_scan/FlutterGeniusScan/scanWithConfiguration.html)

In your snippet above, when it builds the input of the document generation, it does use the result from scanWithConfiguration when it accesses scanResult['scans'][0]['enhancedUrl'].

komritza commented 1 year ago

Thanks a lot, I also saw that option 5 minutes after I posted a ticket...