Problem with wxPDFMediaBackend

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
bobmanc
Experienced Solver
Experienced Solver
Posts: 69
Joined: Mon Oct 04, 2004 9:27 pm

Problem with wxPDFMediaBackend

Post by bobmanc »

I am using the code in the help docs trying to view a pdf.
The code hits the CreateControl method in wxPDFMediaBackend so I know it is being compiled in.
Unfortunatley thats all it does.

Code: Select all

        if( ::CoCreateInstance(CLSID_Pdf, NULL,
                                  CLSCTX_INPROC_SERVER,
                                  DIID__DPdf, (void**)&pDispatch) != 0 )
            return false;
returns false every time. Any ideas?
User avatar
Ryan Norton
wxWorld Domination!
wxWorld Domination!
Posts: 1319
Joined: Mon Aug 30, 2004 6:01 pm

Post by Ryan Norton »

Do you have acrobat (or acrobat reader) installed?
[Mostly retired moderator, still check in to clean up some stuff]
bobmanc
Experienced Solver
Experienced Solver
Posts: 69
Joined: Mon Oct 04, 2004 9:27 pm

Post by bobmanc »

Just Reader. Is Acrobat required? If so is there another way to get a preview of a PDF?
tan
wxWorld Domination!
wxWorld Domination!
Posts: 1471
Joined: Tue Nov 14, 2006 7:58 am
Location: Saint-Petersburg, Russia

Post by tan »

Hi,
just suggestion to get more information:

Code: Select all

        HRESULT hr = ::CoCreateInstance(CLSID_Pdf, NULL,
                                  CLSCTX_INPROC_SERVER,
                                  DIID__DPdf, (void**)&pDispatch);
        if( hr != S_OK )
        {
            // Look at errorcode and make conclusion
            return false;
         }
OS: Windows XP Pro
Compiler: MSVC++ 7.1
wxWidgets: 2.8.10
bobmanc
Experienced Solver
Experienced Solver
Posts: 69
Joined: Mon Oct 04, 2004 9:27 pm

Post by bobmanc »

It returns E_NOINTERFACE which I assume means I need the full version of Acrobat. Thats lame. Anybody know of another way?
jb_coder
Super wx Problem Solver
Super wx Problem Solver
Posts: 267
Joined: Mon Oct 18, 2004 10:55 am

Post by jb_coder »

The wxPython demo embeds the Adobe PDF viewer. You could look at that for ideas on how to do this with wxWidgets.
User avatar
Ryan Norton
wxWorld Domination!
wxWorld Domination!
Posts: 1319
Joined: Mon Aug 30, 2004 6:01 pm

Post by Ryan Norton »

bobmanc wrote:It returns E_NOINTERFACE which I assume means I need the full version of Acrobat. Thats lame. Anybody know of another way?
Acrobat Reader should be fine. Keep in mind you need to enable the ActiveX control- sometimes (depending on version) this is an option in the options menu of Acrobat Reader.

Either that or the code is now out of date for the version you have
[Mostly retired moderator, still check in to clean up some stuff]
bobmanc
Experienced Solver
Experienced Solver
Posts: 69
Joined: Mon Oct 04, 2004 9:27 pm

Post by bobmanc »

I am on WinXP and have Acrobat Reader 8. If I go into IE7 Manage Addons it lists Adobe PDF Reader as Enabled. Anything else I can check?
User avatar
Ryan Norton
wxWorld Domination!
wxWorld Domination!
Posts: 1319
Joined: Mon Aug 30, 2004 6:01 pm

Post by Ryan Norton »

bobmanc wrote:I am on WinXP and have Acrobat Reader 8. If I go into IE7 Manage Addons it lists Adobe PDF Reader as Enabled. Anything else I can check?
It may sounds wierd - but within the program's options itself it sometimes has (depending on version) an option to disable the ActiveX component (the adobe website has some FAQs about this too).

Anyway, if it embeds in your browser OK then the sample may be out of date/interface for 8 changed. I think the latest I tried was 7.
[Mostly retired moderator, still check in to clean up some stuff]
Troels
Experienced Solver
Experienced Solver
Posts: 79
Joined: Fri Jan 07, 2005 12:02 pm
Location: Denmark

Re: Problem with wxPDFMediaBackend

Post by Troels »

bobmanc wrote:I am using the code in the help docs trying to view a pdf
http://www.wxwidgets.org/manuals/stable ... ainer.html

wxActiveXContainer isn't exported, you can't do this (follow this example) in user space when linking wx dynamically :(

Regard
bobmanc
Experienced Solver
Experienced Solver
Posts: 69
Joined: Mon Oct 04, 2004 9:27 pm

Post by bobmanc »

Here is the latest.
I was able to download the installers for 6.01 and 7.09. Using the exact same wx code version 6.01 works fine. 7.09 and 8 both get the same error. E_NOINTERFACE returned fro the CoCreateInstance call.

Anybody been able to get this working on the later version?
bobmanc
Experienced Solver
Experienced Solver
Posts: 69
Joined: Mon Oct 04, 2004 9:27 pm

Post by bobmanc »

The Acrobat Reader installers is what I meant.
novato
In need of some credit
In need of some credit
Posts: 7
Joined: Sat Nov 25, 2006 2:40 am

Post by novato »

Hi.
Since AdobeReader7 instead of using pdf.ocx Adobe begins to use pdf.dll. Such change made CLSID_Pdf and DIID__DPdf different from the ones in the wxPDFMediaBackend example, thats why you get E_NOINTERFACE.

I already tried to view pdf into my app and it works fine with AdobeReader6, with AdobeReader7 (and the new CLSID) the CoCreateInstance returns S_OK but wx crashes when i try to load a file.
bobmanc
Experienced Solver
Experienced Solver
Posts: 69
Joined: Mon Oct 04, 2004 9:27 pm

Post by bobmanc »

What are the new values for CLSID_Pdf and DIID__DPdf?
User avatar
Ryan Norton
wxWorld Domination!
wxWorld Domination!
Posts: 1319
Joined: Mon Aug 30, 2004 6:01 pm

Post by Ryan Norton »

Thanks to Bob and others for trying this out!

And yes, wxActiveXContainer should be exported someplace; there are a lot of reasons why it was not but I guess that is ancient history now.

Oddly enough though I thought FOR SURE it worked in 7... guess I was wrong.
[Mostly retired moderator, still check in to clean up some stuff]
Post Reply