Viscomsoft .NET PDF Viewer SDK

PDFDocument.getPaperSourceNameByPrinter Method

 

Get the name of paper source for specific index by specific printer.

 Visual Basic

Public Sub getPaperSourceByPrinter(strPrinterName as String, iIndex as Integer) as String

 
 C#

public string getPaperSourceNameByPrinter(string strPrinterName, int iIndex)  

 

Parameter

strPrinterName - the string of printer name.
iIndex - the index of paper source. first index is zero.

Namespace: Viscomsoft.PDFViewer

Return Value
Return the name of paper source


Example

   

[C# Syntax] 
using Viscomsoft.PDFViewer;

public partial class Form1 : Form
{

  public PDFView _pdfViewer;
  _pdfViewer = new PDFView();
  _pdfViewer.Canvas.Parent = this;
  _pdfViewer.Canvas.Location = new Point(0, 24);

  private void Form1_Load(object sender, EventArgs e)
  {
    resizeCanvas();

    PDFDocument doc = new PDFDocument();
    if (doc.open("c:\\yourfile.pdf"))
    {
      _pdfViewer.Document = doc;
      _pdfViewer.gotoPage(1);
      int iCount=_pdfViewer.Document.getPaperSourceCountByPrinter();
      for(int i=0; i <iCount; i++)
         MessageBox.Show(_pdfViewer.Document.getPaperSourceNameByPrinter("Microsoft Print to   PDF",i));
     
      _pdfViewer.Document.print2printer("Microsoft Print to PDF",0);
    
    }
  }
 

  private void resizeCanvas()
  {
  _pdfViewer.Canvas.Size = new Size(this.ClientSize.Width, this.ClientSize.Height - 24);
  }
}

 

 


 

   

[Visual Basic Syntax] 
Imports Viscomsoft.PDFViewer

Public Class Form1
 

Private Sub resizeCanvas()

  _pdfviewer.Canvas.Size = New Size(Me.ClientSize.Width, Me.ClientSize.Height - 24)

End Sub

Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load

  _pdfviewer.Canvas.Parent = Me

  _pdfviewer.Canvas.Location = New Point(0, 24)

  resizeCanvas()

 Dim doc As New PDFDocument

 

 Dim i As Integer
 Dim iCount As Integer
 Dim str As String
 

 

  If doc.open("c:\temp\yourfile.pdf") Then

  _pdfviewer.Document = doc

  _pdfviewer.gotoPage(1)
  iCount =_pdfViewer.Document.getPaperSourceCountByPrinter ("Microsoft Print to PDF")

  For i = 0 to iCount -1
    str = _pdfViewer.Document.getPaperSourceNameByPrinter ("Microsoft Print to PDF",i)
    MessageBox.Show(str)
  Next
  _pdfViewer.Document.print2printer "Microsoft Print to PDF",0
  End If

End Sub


End Class