-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The pdf page display is not clear when using PdfDocumentViewBuilder.file() #287
Comments
another inforamtion Flutter 3.27.0 • channel stable • https://github.com/flutter/flutter.git windows version Windows 11 pro 23H2 |
import 'package:flutter/material.dart';
import 'package:pdfrx/pdfrx.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return const MaterialApp(
title: 'Pdfrx example',
home: MainPage(),
);
}
}
class MainPage extends StatefulWidget {
const MainPage({super.key});
@override
State<MainPage> createState() => _MainPageState();
}
class _MainPageState extends State<MainPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
leading: IconButton(
icon: const Icon(Icons.menu),
onPressed: () {},
),
title: const Text('Pdfrx example'),
),
body: PdfDocumentViewBuilder.file(
'D:/c.pdf',
builder: (context, document) => ListView.builder(
padding: const EdgeInsets.all(5),
itemExtent: document?.pages.first.height ?? 800,
itemCount: document?.pages.length ?? 0,
// cacheExtent: 500,
itemBuilder: (context, index) {
return Container(
height: document?.pages.first.height,
width: document?.pages.first.width,
child: PdfPageView(
document: document,
pageNumber: index + 1,
alignment: Alignment.center,
),
);
},
),
)
// PdfViewer.file(
// 'D:/c.pdf',
// passwordProvider: () => 'test',
// ),
);
}
} |
Please note that the width/height returned by PdfPage.width/PdfPage.width, is points (height in pixels at 72 dpi), not in pixel. And, if you want to calculate the PDF resolution by yourself, you can use PdfPageView.pageSizeCallback. |
@espresso3389 Thanks for your generosity reminder . I noticed biggestSize and pageSize have a fixed proportional relationship and the calculation logic of PageSize in pdf_widgets.dart ,it helps me |
close |
using PdfDocumentViewBuilder.file() to open a pdf file,the pdf page display is not clear.but when i open the same pdf file with PdfViewer.file(),it is very clear.And I found PdfPageView can set maximumDpi,but no matter how this parameter is set ,it does not work.
So what should i do to Improve the display clarity of PDF pages using PdfDocumentViewBuilder.file?
The text was updated successfully, but these errors were encountered: