Announcement

Collapse
No announcement yet.

Assigned Shortcut Key to Printer Function Issue!

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Assigned Shortcut Key to Printer Function Issue!

    ​Hello all, I'm new to the forums. Our company recently purchased a seat of the Foxit PDF SDK ActiveX Control for Windows Form Applications. I'm using Microsoft Visual Studio 2015 Community version. My current project is a Windows form application that is written in the Visual Basic .net language on a .NET Framework 4.5.2.

    The application works well and I have no issues with viewing the pdf documents. I think the control is a great piece of work. That being said I'm currently having an issue with assigning a shortcut key to the print function. I know that there is an icon on the toolbar but, most of the end users are keyboard jockeys and I have had a ton of request to add the old school CTRL + P to open the print dialog. This is the code I have so far:

    Private Sub tsmiPrint_Click(sender As Object, e As EventArgs) Handles tsmiPrint.Click
    AxFoxitPDFSDK1.PrintWithDialog()
    End Sub

    I have created a ToolStripMenuItem named tsmiPrint. When I click on tsmiPrint and look at the properties I have added the CRTL + P. So here is where it gets weird. When I use the CTRL + P Keystroke the Print dialog won't come up unless I have clicked in a text box or list box somewhere on the form. If I click on the Foxit ActiveX Control and hit CTRL + P, I get nothing. The tsmiPrint.Click function works perfectly anytime I choose "print" from the menu it comes up as it should.

    If anyone else has had this problem or knows what may be causing the issue I would love to hear what you have to say.

    huy_tran My Support Ticket # is 25317

  • #2
    Hello sgwilliams,

    I believe you already got my answer for this, however, I am going to post it here for other users. Below is the VB event that will handle the hotkeys for printing.

    Private Sub AxFoxitPDFSDK1_PreviewKeyDown(sender As System.Object, e As System.Windows.Forms.PreviewKeyDownEventArgs) Handles AxFoxitPDFSDK1.PreviewKeyDown
    If (e.Control AndAlso (e.KeyCode = Keys.P)) Then
    AxFoxitPDFSDK1.PrintWithDialog()
    End If
    End Sub
    Sincerely,

    Huy Tran
    Solution Engineer
    42840 Christy Street, Suite 201, Fremont CA 94538

    Comment

    Working...
    X