Viscomsoft UWP PDF Viewer SDK

PDFPrintManager Object

Description

PDFPrintManager represents print a PDF file or Image file.

Namespace: Viscomsoft.UWP.PDFViewerSDK

Example

   

[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();
}

 

 

Double-click on MainPage.xaml to open it in the Design view.  In XAML code window, add Border named uiViewPanel
 the code looks like this
 

<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">

<Grid.RowDefinitions>

<RowDefinition Height="100" />

<RowDefinition Height="*" />

</Grid.RowDefinitions>

<Border Grid.Row="1" x:Name="uiViewPanel" Background="#FFE6E6E6" Margin="-10,10,10,-10"></Border>