Is there a way to make visual customizations for widgets in a SfPdfViewer?

Hey, I'm wondering whether if it is possible, and if so how to go about

  1. Changing the default gray background color of the SfPdfViewer?
  2. Is there a way to invert the colors of a PDF being loaded into the view i.e. text turns black ?
  3. Changing the page navigation slider color/etc..

Thank you in advance! If this is not possible, any workaround would also be appreciated.

12 Replies 1 reply marked as answer

DR Deepika Ravi Syncfusion Team May 23, 2022 02:24 PM UTC

Hi Pyae Sone,


Regarding customizing the background color of the SfPdfViewer:


Yes, it is possible to customize the background color of the SfPdfViewer. Please use the following code snippet to customize the background color,


@override
Widget build(BuildContext context) {
 
return Scaffold(
    appBar:
AppBar(
      title:
const Text('Syncfusion Flutter PDF Viewer')
    ),
    body:
SfPdfViewerTheme(
      data:
SfPdfViewerThemeData(
        backgroundColor: Colors.
pink,
      ),

      child:
SfPdfViewer.network(
       
'https://cdn.syncfusion.com/content/PDFViewer/flutter-succinctly.pdf',
        key:
_pdfViewerKey,
      ),
    ),
  );
}


Regarding Is there a way to invert the colors of a PDF is loaded into the view i.e. text turns black:


At present we do not have support for night mode in SfPdfViewer. We do not have any immediate plans to implement this feature. At the planning stage for every release cycle, we review all open features and identify features for implementation based on specific parameters including product vision, technological feasibility, and customer interest. We will let you know when this feature is implemented. The status of the feature can be tracked by the following link,

https://www.syncfusion.com/feedback/32848/support-for-night-mode



Regarding changing the page navigation slider color


Yes, it is possible to customize the scroll head in SfPdfViewer. Please use the following code snippet to customize the background color of the scrollhead,


@override
Widget build(BuildContext context) {
 
return Scaffold(
    appBar:
AppBar(title: const Text('Syncfusion Flutter PDF Viewer')),
    body:
SfPdfViewerTheme(
      data: SfPdfViewerThemeData(
          scrollHeadStyle:
             
PdfScrollHeadStyle(backgroundColor: Colors.purple)),
      child:
SfPdfViewer.network(
       
'https://cdn.syncfusion.com/content/PDFViewer/flutter-succinctly.pdf',
        key:
_pdfViewerKey,
      ),
    ),
  );
}

Kindly refer to the following UG documentation link to know morcustomizingustomize the scroll head in SfPdfViewer.

https://pub.dev/documentation/syncfusion_flutter_core/latest/theme/PdfScrollHeadStyle-class.html



Regards,

Deepika R


Marked as answer

DR Deepika Ravi Syncfusion Team May 23, 2022 02:26 PM UTC

Hi Pyae Sone,


Regarding customizing the background color of the SfPdfViewer:


Yes, it is possible to customize the background color of the SfPdfViewer. Please use the following code snippet to customize the background color,


@override
Widget build(BuildContext context) {
 
return Scaffold(
    appBar:
AppBar(
      title:
const Text('Syncfusion Flutter PDF Viewer')
    ),
    body:
SfPdfViewerTheme(
      data:
SfPdfViewerThemeData(
        backgroundColor: Colors.
pink,
      ),

      child:
SfPdfViewer.network(
       
'https://cdn.syncfusion.com/content/PDFViewer/flutter-succinctly.pdf',
        key:
_pdfViewerKey,
      ),
    ),
  );
}


Regarding Is there a way to invert the colors of a PDF is loaded into the view i.e. text turns black:


At present we do not have support for night mode in SfPdfViewer. We do not have any immediate plans to implement this feature. At the planning stage for every release cycle, we review all open features and identify features for implementation based on specific parameters including product vision, technological feasibility, and customer interest. We will let you know when this feature is implemented. The status of the feature can be tracked by the following link,

https://www.syncfusion.com/feedback/32848/support-for-night-mode



Regarding changing the page navigation slider color


Yes, it is possible to customize the scroll head in SfPdfViewer. Please use the following code snippet to customize the background color of the scrollhead,


@override
Widget build(BuildContext context) {
 
return Scaffold(
    appBar:
AppBar(title: const Text('Syncfusion Flutter PDF Viewer')),
    body:
SfPdfViewerTheme(
      data: SfPdfViewerThemeData(
          scrollHeadStyle:
             
PdfScrollHeadStyle(backgroundColor: Colors.purple)),
      child:
SfPdfViewer.network(
       
'https://cdn.syncfusion.com/content/PDFViewer/flutter-succinctly.pdf',
        key:
_pdfViewerKey,
      ),
    ),
  );
}


Kindly refer to the following UG documentation link to know more about customizing the scroll head in SfPdfViewer.

https://pub.dev/documentation/syncfusion_flutter_core/latest/theme/PdfScrollHeadStyle-class.html


Regards,

Deepika R



PS Pyae Sone May 23, 2022 06:04 PM UTC

Hey Deepika,

Thank you very much!

Do i need any more dependencies for this?

I have this so far:

syncfusion_flutter_pdfviewer: ^20.1.56-beta


DR Deepika Ravi Syncfusion Team May 24, 2022 04:15 PM UTC

Hi Pyae Sone,


No, this does not require additional dependencies, but to use the SfPdfViewerTheme widget you need to import 'package: syncfusion_flutter_core / theme. dart' in the dart code.


Regards,

Deepika R





T- Thoxh - Tim March 10, 2023 08:24 PM UTC

Thanks, that was exactly what I searched for <3



SS Swetha Srikumar Syncfusion Team March 13, 2023 05:14 AM UTC

Most welcome.



DB Digitalizze Brasil July 25, 2024 07:17 PM UTC

A cor transparente não funciona bem



IP ImmanKumarP Palanikumar Syncfusion Team July 26, 2024 08:50 AM UTC

Hi Digitalizze Brasil,

Could you please share a screenshot of the issue and the expected output when you apply the transparent color? This will help us determine whether it is an issue or expected behavior.

Regards,
Imman Kumar P



AR ABDUL RAFEY WALEED 160422733033 October 19, 2024 09:56 AM UTC

Can we add additional effect when changing a page, like page flip or any other animation affect for SfPdfViewer



KP Krithiga Perumal Syncfusion Team October 21, 2024 09:11 AM UTC

Hi ABDUL RAFEY WALEED,

At present, Syncfusion Flutter PDF Viewer does not support additional effects such as "page flip" when switching pages and only supports linear transitions when flipping through pages.




AR ABDUL RAFEY WALEED 160422733033 replied to Krithiga Perumal October 24, 2024 06:12 AM UTC

But atleast can we render all the pages together initially itself, the experience is very laggy




KP Krithiga Perumal Syncfusion Team October 28, 2024 11:28 AM UTC

Hi ABDUL RAFEY WALEED,

Currently, our Flutter PDF Viewer does not support rendering all pages at once. PDF pages are retrieved from the native platform’s renderer to display in the PDF Viewer. Rendering all pages at once would increase the initial loading time and memory usage, especially for larger documents. Therefore, we render PDF pages on demand based on the visible area in the PDF Viewer. As the user scrolls, additional pages load incrementally, while previous pages are disposed of to optimize memory.

To enhance the scrolling experience, our current approach includes rendering buffer pages before and after the current page. Since you mentioned the user experiencing lag, could you please share the document with us? This will help us investigate further and provide you with a better solution.

If you need to share the document privately, please create a ticket in our support portal.


Regards,

Krithiga Perumal.


Loader.
Up arrow icon