Welcome to Dream.In.Code
Getting C# Help is Easy!

Join 131,729 C# Programmers for FREE! Get instant access to thousands of C# experts, tutorials, code snippets, and more! There are 2,257 people online right now. Registration is fast and FREE... Join Now!




View PDF in RichTextBox in WindowsForm

 
Reply to this topicStart new topic

View PDF in RichTextBox in WindowsForm, I'm very new to Visual C#, but i've done alot of VBA in Excel.

Engineer Joe
post 13 Oct, 2008 - 03:18 PM
Post #1


New D.I.C Head

*
Joined: 13 Oct, 2008
Posts: 2

I really have two problems.

1) I'm pretty sure I have to add something like PdfLib as a reference. I just installed Adobe Reader 9, which I understand comes with the ActiveX controls I need. However, I do not know which control to add as a reference (PdfLib is not available to be selected from the COM tab.) The other problem I forsee is showing it in the richtext box. I never use richtextboxes, only picture boxes. If anyone could help me out, I'd greatly appreciate it. Like I said, I'm very new to C# and haven't developed my independent reportoire yet.

CODE

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 PdfLib;     <-----I need to use the Acrobat Control for ActiveX or at least the Adobe Reader 9 equivalent.

namespace WindowsFormsApplication1
{
    public partial class ViewerForm : Form
    {
        public ViewerForm()
        {
         InitializeComponent();
         PdfLib.AxAcroPDF axAcroPDF1;
         axAcroPDF1.LoadFile(@"C:\Documents and Settings\jcrowe\Desktop\Medical Gas\_0708170240_001.pdf");
         axAcroPDF1.Show();  
        }

        private void richTextBox1_TextChanged(object sender, EventArgs e)
        {
  
        }
    }
}
User is offlineProfile CardPM

Go to the top of the page

anipirakis
post 21 Oct, 2008 - 11:26 AM
Post #2


New D.I.C Head

*
Joined: 21 Oct, 2008
Posts: 1

QUOTE(Engineer Joe @ 13 Oct, 2008 - 04:18 PM) *

I really have two problems.

1) I'm pretty sure I have to add something like PdfLib as a reference. I just installed Adobe Reader 9, which I understand comes with the ActiveX controls I need. However, I do not know which control to add as a reference (PdfLib is not available to be selected from the COM tab.) The other problem I forsee is showing it in the richtext box. I never use richtextboxes, only picture boxes. If anyone could help me out, I'd greatly appreciate it. Like I said, I'm very new to C# and haven't developed my independent reportoire yet.

CODE

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 PdfLib;     <-----I need to use the Acrobat Control for ActiveX or at least the Adobe Reader 9 equivalent.

namespace WindowsFormsApplication1
{
    public partial class ViewerForm : Form
    {
        public ViewerForm()
        {
         InitializeComponent();
         PdfLib.AxAcroPDF axAcroPDF1;
         axAcroPDF1.LoadFile(@"C:\Documents and Settings\jcrowe\Desktop\Medical Gas\_0708170240_001.pdf");
         axAcroPDF1.Show();  
        }

        private void richTextBox1_TextChanged(object sender, EventArgs e)
        {
  
        }
    }
}



You need to get your hands on the Acrobat SDK. You can get this at http://www.adobe.com/devnet/acrobat/index....navID=downloads . This download will actually get you a couple of examples on how to implement this kind of control.

InterAppCommunicationSupport\C#Samples\BasicIacOCXCS

Let me know if this helps.

Aleksei
User is offlineProfile CardPM

Go to the top of the page

eclipsed4utoo
post 21 Oct, 2008 - 11:40 AM
Post #3


D.I.C Regular

***
Joined: 21 Mar, 2008
Posts: 308



Thanked 17 times
My Contributions


if you like, you can show PDFs without the need of installing adobe(or using the adobe SDK). I had to do this for a client that needed to show PDF "help" documents but didn't want to install adobe on all of the workstations.

Let me find the name of the control and I will post it....unless you are dead set on using a RichTextBox.

This post has been edited by eclipsed4utoo: 21 Oct, 2008 - 11:41 AM
User is online!Profile CardPM

Go to the top of the page

eclipsed4utoo
post 21 Oct, 2008 - 12:01 PM
Post #4


D.I.C Regular

***
Joined: 21 Mar, 2008
Posts: 308



Thanked 17 times
My Contributions


here it is...

http://pdfsharp.com/PDFsharp/index.php?opt...4&Itemid=64

and here is the simple code to view a PDF in .Net.

the "pdfAcroViewer" is a control that I dragged/dropped onto a form.
c#

string helpFile = "C:\HelpFile.pdf";
pdfAcroViewer.LoadFile(helpFile);
pdfAcroViewer.ShowToolbar = false;
pdfAcroViewer.SetPageMode(PdfSharp.Pdf.PdfPageMode.FullScreen);
User is online!Profile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/20/08 10:31AM

Live C# Help!

C# Tutorials

Reference Sheets

C# Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month