View a pdf insiede a Flutter App and print it to a bluetooth/usb printer

3,486 views
Skip to first unread message

Matteo G.

unread,
Apr 29, 2016, 12:58:18 PM4/29/16
to Flutter Dev
I'm considering flutter for writing a front end application for mobile android....

I have the need for:

1) view a pdf inside the application

2) print a pdf inside the application to a bluetooth printer (or usb printer)

Is it possible right now?

If yes what is the best way to do, please?

Thanks!


PS: and thanks very much to the developers - becouse Flutter is looking very promising and very simple to use !!! Love it !

Ian Hickson

unread,
May 5, 2016, 7:55:14 PM5/5/16
to Matteo G., Flutter Dev
The only way I can think of to do that right now would be to show the PDF in the same way as you would for a Java Android app, and then embed the Flutter UI into the Android app the way that this demo does:


Similarly for printing, you would do it via the system APIs on Android from the Java code.

If you would like a way to do this directly inside Flutter instead of having to combine host platform code with Flutter code, please don't hesitate to file a bug, although to set expectations correctly I must point out that I doubt inline PDF viewing and printing is something we'd get to in the near future.

-- 
Ian Hickson

--
You received this message because you are subscribed to the Google Groups "Flutter Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
To post to this group, send email to flutt...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/flutter-dev/4f1259e4-7fed-43c2-803b-15cf319426aa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

rock...@gmail.com

unread,
Jan 28, 2018, 1:00:42 PM1/28/18
to Flutter Dev
I have made a plugin to print to PDF - for the Android side only :

Ged Wed

unread,
Jan 28, 2018, 1:42:27 PM1/28/18
to rock...@gmail.com, Flutter Dev
Thanks "rockvole" !!!

--
You received this message because you are subscribed to a topic in the Google Groups "Flutter Dev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/flutter-dev/CVpiW33bh80/unsubscribe.
To unsubscribe from this group and all its topics, send an email to flutter-dev...@googlegroups.com.

ged...@gmail.com

unread,
Mar 10, 2018, 1:46:09 PM3/10/18
to Flutter Dev
Why is flutter not just using pdfium that is inside Skia ?
If they did then all mobiles and desktops would get printing for free.

I believe skia also has the ability to output for windows print format. Not sure but it's called XPS or something.

Anyway I would have assumed that because flutter is based on skia then it's easy for flutter team to expose a flutter API for PDF output.

? Anyone care to clear this up ?

Chinmay Garde

unread,
Mar 10, 2018, 3:16:07 PM3/10/18
to ged...@gmail.com, Flutter Dev
Skia has many optional dependencies that Flutter does not enable by default because the engine does not need them at present (see the "optional" GN template in //third_party/skia/BUILD.gn).

Even if this specific dependency was enabled, you would only get a PDF/XPS representation of a scene. Conveying this PDF to the underlying platform for printing, etc. would still need to be handled by a platform plugin. Also, additional dependencies add to the size of the engine. The plugin mentioned in this thread seems to be generating a PDF from a piece of text. So Skia is not even needed in this case.

Ultimately, we want the Flutter engine to be as lean as possible and add dependencies that are absolutely critical. This is not to say obtaining rich PDF/XPS representations of scenes is something that we will never support out of the box. Please file a bug if you think this is critical to for your application.

Cheers,
Chinmay

--

You received this message because you are subscribed to the Google Groups "Flutter Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.

Ged Wed

unread,
Mar 10, 2018, 4:26:20 PM3/10/18
to Chinmay Garde, Flutter Dev
 I will file as bug .

For me it's critical to be able to print what's on the screen relaid out to the papersize ( A4 for example ).
I am building various business apps with flutter as well as a 2d CAD system. That's used in some other vertical products.

I definitely agree that file size is critical since the app does not rely on existing framework / shared lib already on the device.
I think the flutter framework adds about 7 mb thereabouts.
But how many kb does pdfium add to the framework versus how useful and expected is PDF output.
Looks like 60 kb compiled.

Sure there will be a bit of extra code to glue flutter to it too.
Reply all
Reply to author
Forward
0 new messages