[C# Syntax] using Viscomsoft.UWP.PDFViewerSDK; private PDFPrintManager _printManager = new PDFPrintManager(); private bool _bRegisterPrint = false;
DocumentFactory factory = new DocumentFactory();
IDocument doc = factory.CreateDocument(file.Name);
bool opened = await doc.OpenAsync(file);
_pdfDisplayManager = new PDFDisplayManager();
_pdfDisplayManager.Width = (int)Window.Current.Bounds.Width;
_pdfDisplayManager.Height = (int)Window.Current.Bounds.Height;
_pdfDisplayManager.Document = doc;
_printManager.Document = doc;
if (_bRegisterPrint == false) {
_printManager.RegisterForPrinting(); _bRegisterPrint = true; }
_pdfDisplayManager.GotoPage(1);
uiViewPanel.Child = createScrollViewControl();
private void btnPrint_Click(object sender, RoutedEventArgs e) { if (_pdfDisplayManager == null) return;
if (_printManager == null) return;
_printManager.CurrentPage = _pdfDisplayManager.CurrentPage; _printManager.ShowAsync(); }
protected override async void OnNavigatedFrom(NavigationEventArgs e) { base.OnNavigatedFrom(e);
if(_printManager!=null) _printManager.UnregisterForPrinting(); }
|