Unplanned
Last Updated: 16 Jun 2023 09:59 by ADMIN
David
Created on: 12 Jun 2023 15:28
Category: PDFViewer
Type: Bug Report
0
PDF Viewer: ToggleLayoutMode also sets Width to Maximum

New PdfViewer is great, but has this undesired side effect:

ToggleLayoutModeCommand also sets Page Width to Maximum, at least in Windows.

If by design, there needs to be a workaround when not desired. Otherwise please retain current zoom level during the toggle.

Thank you.

David Pressman

1 comment
ADMIN
Didi
Posted on: 16 Jun 2023 09:59

Hello David,

We have reviewed the case and I changed the status to this item to Unplanned.

As a workaround: 
Execute a logic that keeps the zoom level, then set this logic to the ToggleLayoutMode command: 

this.pdfViewer.ToggleLayoutModeCommand = new Command(this.ExecuteMyCommand);

public void ExecuteMyCommand()
        {
            double zoom = this.pdfViewer.ZoomLevel;
            this.pdfViewer.LayoutMode = this.pdfViewer.LayoutMode == LayoutMode.ContinuousScroll ? LayoutMode.SinglePage : LayoutMode.ContinuousScroll;

            this.Dispatcher.DispatchDelayed(TimeSpan.FromMilliseconds(50), () => this.pdfViewer.ZoomToLevel(zoom));
        }

Note that you may need to change the delay. I have used 50ms in my case but for your scenario less or more may be required. 

Regards,
Didi
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.