Click here to Skip to main content
11,926,395 members (63,819 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# PDF
I have created a PDF Viewer from Adobe Reader and I have created setup file and installed to the machine and all pdf files are looks like my viewer icon.

My problem is, once open a pdf file from double click, pdf is not view, only the program is opening. Kindly see below my full code and please advise? Thanks!

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace QUICK_PDF_VIEWER_V2008
    public partial class Form1 : Form
        public Form1()
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
            OpenFileDialog open = new OpenFileDialog();
            open.Title = "Open";
            open.Filter = "All File|*.*";
                if (open.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            catch (ArgumentException ex)
                MessageBox.Show(ex.Message.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            catch (Exception ex)
                MessageBox.Show(ex.Message.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
        private void aboutUsToolStripMenuItem_Click(object sender, EventArgs e)
            MessageBox.Show("This is a Product of Adobe, Thanks", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
        private void axAcroPDF1_OnError(object sender, EventArgs e)
        private void Form1_Load(object sender, EventArgs e)
Posted 16-Nov-12 6:22am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

There is no code here to handle that. your code starting code which launches this window, is passed arguments if you opened the file by double clicking after associating it with the file. You need to read those arguments and pass the file path through so that this code auto opens it.

abdulsafran 16-Nov-12 11:47am
Hi Christian Graus, can you provide sample code for that? It would really help for me. Thanks!
Christian Graus 16-Nov-12 11:49am
Added a link to my answer. By the way, if you gave me a 1 vote, that is a bad vote. The correct vote if I helped you, is 5.
abdulsafran 16-Nov-12 12:01pm
Hey Christian, sorry for the vote, it's a mistake, just now i have voted you with full votes. Thanks for your support and if there are any concern I'll get back to you. Thanks again.
Christian Graus 16-Nov-12 12:05pm
np, I don't normally trawl for votes, but you've confirmed my suspicion that there are people who assume that a 1 vote is a good vote :-)
abdulsafran 16-Nov-12 12:19pm
Christian, I have checked the provided link, but still trouble me to how to get to the axAcroPDF1.LoadFile(); the correct path, can you advise with better code? Also, what is args in default?
abdulsafran 16-Nov-12 12:46pm
Working, thanks Christian.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web04 | 2.8.151126.1 | Last Updated 16 Nov 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100