Skip to main content
November 21, 2016
Question

PDF View in c# without toolbar nor any hindrances?

  • November 21, 2016
  • 2 replies
  • 8014 views

I have a windows form developed in Visual C# that displays the content of a PDF file with a reference to AxAcroPDFLib, but my boss doesn't want to see any toolbar nor side menus as shown in my image below here.  Here's what I have coded in my attempts to make this work but it doesn't seem to matter:

            axAcroPDF1.src = tmpTicketPdfPreviewPath;

            axAcroPDF1.setShowToolbar(false);

            axAcroPDF1.setView("FitH");

            axAcroPDF1.setLayoutMode("SinglePage");

            axAcroPDF1.setPageMode("none");

            axAcroPDF1.Show();

Please let me know if I'm missing anything here.  If not possible, I'm willing to look into other 3rd party vendors such as iTextSharp of SumatraPDF if possible.  Please advise, thanks.

4eUEE.png

    This topic has been closed for replies.

    2 replies

    Participant
    July 13, 2022

    try:

    axAcroPDF1.setView("read mode");

    Participant
    July 13, 2022

    Hi, Thanks for your tip ! I tried it, but unfortunately this does not change anything whatsoever. I think SetView() only controls the way the viewer fits into its container.

     

    Participant
    March 4, 2021

    YES!! Has Anyone found a solution to this?? I've been fighting this for months.

    Participant
    May 21, 2021

    I have this same issue, and can't find a way around it. Curiously, for the same pdf the result can be correct (just the pdf, see "ok.jpg") or incorrect (entire reader with the pdf in it surrounded by menus, toolbars, and whatnot, see "no ok.jpg"). There does not seem to be any logic to it. I tried any method or property I think could help, to no effect. 

    Any ideas appreciated !
    Thaks,
    Chris

    Participant
    January 17, 2023

    This is interesting, thanks ! I thought I'd be able to do this programmatically as follows 

    axAcroPDF1.src=fil;
    axAcroPDF1.Focus();
    SendKeys.Send("^h");

    but unfortunately this has no effect whatsoever. It probably would not solve the problem if it worked, because it's a toggle and the problem is inconsistent, i.e. it sometimes occurs and sometimes not.
    I notice your component is AcroPDF1 whereas mine is axAcroPDF1. Did you rename it, or are we using different things ? Does the above code do something for you ?


    if(axAcroPDF1.LoadFile(filePath))
                {
                    System.Threading.Thread.Sleep(1000);
                    axAcroPDF1.setShowToolbar(false);
                    axAcroPDF1.setShowScrollbars(false);
                    axAcroPDF1.Focus();
                    SendKeys.Send("^h");
                }