PDFViewCtrl: Drag and Drop for re-ordering of pages

Hello everybody,

just wanted to ask if PDFViewCtrl for Winforms / .Net / C# does support Drag and Drop to change the sequence of the pages in the document. Found this only in the documentation of the web viewer, not for our development environment.

Thank you for your help,

Alex

No this is not currently available and not currently planned, for our PDFViewCtrl WinForms class. There are though built in controls for deleting, rotating, inserting and cropping pages.

For our WinForms PDFViewCtrl class you would have to add this new Control effectively outside of PDFViewCtrl class.

For our newer PDFViewWPF WPF viewer, all the UI/UX code is provided with the SDK, so that would be easier to implement such a control, since you could utilize more code written by PDFTron.

Most development now is on our UWP SDK, which is making transition to WinUI 3.

What exact framework+OS+ui are you targeting?

Hello Ryan,

as this question is still open: We’re using VS 2019, C#, .NET 4.7.x and WinForms for the development of application that are strictly for in-house use only.

Does this mean that we have to swap development to some other framework in order to use features in your SDK?

Kind regards,

Axel

Thank you for the clarifications.

Does this mean that we have to swap development to some other framework in order to use features in your SDK?
No, you can use WinForms and .NET framework. Since drag and drop page re-ordering is not built-in, then this is a customization you would add in your own UI.

You would use SetupThumbnails and GetThumbAsync to get the images you need for your custom control.

https://www.pdftron.com/api/PDFTronSDK/dotnet/pdftron.PDF.PDFViewCtrl.html#pdftron_PDF_PDFViewCtrl_SetupThumbnails_System_Boolean_System_Boolean_System_Boolean_System_Int32_System_UInt32_System_Double_
https://www.pdftron.com/api/PDFTronSDK/dotnet/pdftron.PDF.PDFViewCtrl.html#pdftron_PDF_PDFViewCtrl_GetThumbAsync_System_Int32_pdftron_PDF_PDFViewThumbAsyncDelegate_System_Object_

Then when it is time to apply the edit, you would use PDFDoc locking to write lock and unlock.

Then edit the PDF, see this sample for page editing logic.

Finally after unlocking the PDFDoc, you would tell PDFViewCtrl to update to reflect the new layout using this API.
https://www.pdftron.com/api/PDFTronSDK/dotnet/pdftron.PDF.PDFViewCtrl.html#pdftron_PDF_PDFViewCtrl_UpdatePageLayout

Here is a forum post showing a minimal example.

Let me know how this works for you.