dart_pdf
dart_pdf copied to clipboard
Fully featured pdf_viewer from pdf_preview
Is your feature request related to a problem? Please describe. Not that i am aware of
Describe the solution you'd like Fully feature pdf previewer ( EXAMPLE: using 'embedded' in html for web )
- Searchable Text
- Zoom % buttons on bottom bar
- Fit to page (width, height, etc)
- Mouse wheel scroll speed?
- Scrolling with "click and drag"?
- Action Bar location option (Left, Top, Right, Bottom)
Describe alternatives you've considered None.
Additional context This pdf package is the only one i've been able to find that works with linux. I am building an app that displays instructions/documentation as a pdf document. Although this is used to preview the pdf before printing, I think this is just a few steps away from being an all out "PDF Viewer" that works really well on linux. Below is the equivalent htm usage as well as an image.
Example html usage
<embed id="displayPDFEmb" src="YOUR_PDF_FILE.pdf#navpanes=0&zoom=120" width="100%" height="99vh" type="application/pdf" style="min-height:99vh;">

Flutter Code
My current usage
import 'dart:typed_data';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:printing/printing.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Builder(builder: (context) {
return Scaffold(
appBar: AppBar(title: const Text('View PDF Demo')),
body: PdfPreview(
allowPrinting: false,
allowSharing: false,
canChangeOrientation: false,
canChangePageFormat: false,
canDebug: false,
maxPageWidth: MediaQuery.of(context).size.width * 0.8,
build: (format) => _generatePdf(format),
),
);
}),
);
}
Future<Uint8List> _generatePdf(format) async {
final ByteData myDoc = await NetworkAssetBundle(
Uri.parse("http://192.168.0.16:7600/Documents/pdf/pdf0.pdf"))
.load("");
return myDoc.buffer.asUint8List();
}
}
@DavBfr Just a shout out - are there any plans to implement any of this functionality in the not to distant future ?
Except for searchable text, everything should be possible if someone wants to do it. PdfPreview, as it is, is intended to be simple and quick to be able to design your PDF documents with "hot-reload". But I'm not against improvments.
@DavBfr I havent looked at the codebase was just checking if anything been done or any plans for doing so - Please advise if the codebase architecture will support these features (If so I will take a detailed look at attempting to getting these done if no objections) :
- Showing page number x of y when scrolling pages
- Pinch to zoom for all pages and not just a single page (as is current)
- Scrolling Horizontally as well as Vertically (Current)
- Jump to page
- Setting zoom level
Yes, you can implement all that. You'll have to be careful about performance and memory consumption with the zoom feature, but other than that I see no issue.
enabling pinch zoom without the need to double tap and pageless panning would be amazing ( then this lib could already be used as a fully working pdf viewer ).
this feature would become even more useful after other libraries suffer from this issue
https://github.com/ScerIO/packages.flutter/issues/314
for anyone who needs a smooth pinch zoom pdf viewer. --> https://github.com/espresso3389/flutter_pdf_render/issues/84.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days
Closing this stale issue because it has no activity.