pvginkel / PdfiumViewer

PDF viewer based on Google's PDFium.
Apache License 2.0
967 stars 418 forks source link

Make interface for navigation bar. #32

Closed Nedayvozov closed 9 years ago

Nedayvozov commented 9 years ago

Hello,

I use PdfViewer in conjunction with the navigation bar, so it would be very convenient if PdfViewer supported interface, which would allow to communicate with the control panel.

I think it may look something like this:

interface IPdfViewerNavigation
{
    // Print the Document.
    void Print();
    // Fit one full page to window.
    void FitPage();
    // Fit to window width and enable scrolling.
    void FitPageWith();
    // Increase the scale.
    void ZoomIn();
    // Decrease the scale.
    void ZoomOut();
    // The certain value of zoom.
    double ExactZoomValue { get; set; }
    // Turn to the previous page.
    void GoToPreviousPage();
    // Turn to the next page.
    void GoToNextPage();
    // The current page.
    int CurrentPage { get; set; }
    // Returns the number of pages in the document.
    int PageCount { get; }
}

If PdfViewer will inherit this interface, it will be very convenient to associate it with any such navigation bar.

Thanks,

pvginkel commented 9 years ago

I prefer not to implement this. The reason for this is primarily that the control that contains the navigation bar is not really meant to be used in production. Instead you're encouraged to use the raw control and introduce your own functionality based on what the PdfRenderer control makes available. Because of this I do not want to put too much focus on a specific set of functionality. This e.g. is the reason that there is no next/previous page button on the PdfViewer control. The demo application contains this functionality just to show you what type of functionality you can build with the raw components. You should then use the examples to build a PDF viewer that fits your needs. In other words, I try not to be prescriptive.

Is there a specific problem you're encountering with your navigation bar that would be solved by introducing an interface, or is it feasible for you to just directly call the functionality on the PdfRenderer control?

Nedayvozov commented 9 years ago

I understand what you mean. Actually, I don't so much need the interface itself. I just need all those methods that I could call directly. For example, could you implement these methods as well, how to implement some of them in the demo project? This approach is primarily give me the opportunity to use the library with minimal changes, so I can always easy to upgrade to the latest version.

pvginkel commented 9 years ago

I've had a look at this. Most of the functions are available directly in the UI of the demo application. The following were still missing: zoom level, zoon in and zoom out. I've added those too.