By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,610 Members | 2,155 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,610 IT Pros & Developers. It's quick & easy.

Automate PDF printing - is there a .net Acrobat object?

P: n/a
Hello all,

I wish to automate printing of PDF documents in a C# application.

Is there an Adobe .net object? I tried to create a reference to the COM
Object Adobe Type Library, but I get error "Exception from HRESULT 0x80131019"

Thanks
Chris
Jul 21 '05 #1
Share this Question
Share on Google+
8 Replies


P: n/a

They do sell the Adobe PDF Library that you can use to do this. I am not
sure if it supports .Net. You should contact them and ask.

--Robby
"Chris" <Ch***@discussions.microsoft.com> wrote in message
news:E2**********************************@microsof t.com...
Hello all,

I wish to automate printing of PDF documents in a C# application.

Is there an Adobe .net object? I tried to create a reference to the COM
Object Adobe Type Library, but I get error "Exception from HRESULT
0x80131019"

Thanks
Chris

Jul 21 '05 #2

P: n/a
There are so many existing .NET libraries/components for PDF generating.
Simply google the net for "PDF & .NET", you get hundreds of links. Many are
commercial products, but a few of them are freeware.

"Chris" <Ch***@discussions.microsoft.com> wrote in message
news:E2**********************************@microsof t.com...
Hello all,

I wish to automate printing of PDF documents in a C# application.

Is there an Adobe .net object? I tried to create a reference to the COM
Object Adobe Type Library, but I get error "Exception from HRESULT 0x80131019"
Thanks
Chris

Jul 21 '05 #3

P: n/a
However, generating PDF and printing PDF is not the same thing.
Yes, there are lots of PDF generation libraries out there, but native print
support
you will hardly find.
Your options is to use the DDE interface towards Acrobat, if Acrobat is
available,
or to use GhostScript.

--
Regards,
Dennis JD Myrén
Oslo Kodebureau
"Norman Yuan" <no****@nowhere.no> wrote in message
news:uO**************@TK2MSFTNGP09.phx.gbl...
There are so many existing .NET libraries/components for PDF generating.
Simply google the net for "PDF & .NET", you get hundreds of links. Many
are
commercial products, but a few of them are freeware.

"Chris" <Ch***@discussions.microsoft.com> wrote in message
news:E2**********************************@microsof t.com...
Hello all,

I wish to automate printing of PDF documents in a C# application.

Is there an Adobe .net object? I tried to create a reference to the COM
Object Adobe Type Library, but I get error "Exception from HRESULT

0x80131019"

Thanks
Chris


Jul 21 '05 #4

P: n/a
Thanks Dennis - quite correct, I am not looking to generate a PDF

I have Acrobat 5.0 installed, and I can see the 'Acrobat 5.0 Type Library'
availabale as a 'COM' object under project references.

However, when I select this, (or any of the COM components) in the
references, it comes up with this error:

"A reference to 'COM obect name here' could not be created. Converting the
type library to a .NET assembly failed. Exception from HRESULT: 0x80131019"

Adding the reference works on another development machine...

Any ideas?

Thanks
Chris

"Dennis Myrén" wrote:
However, generating PDF and printing PDF is not the same thing.
Yes, there are lots of PDF generation libraries out there, but native print
support
you will hardly find.
Your options is to use the DDE interface towards Acrobat, if Acrobat is
available,
or to use GhostScript.

--
Regards,
Dennis JD Myrén
Oslo Kodebureau
"Norman Yuan" <no****@nowhere.no> wrote in message
news:uO**************@TK2MSFTNGP09.phx.gbl...
There are so many existing .NET libraries/components for PDF generating.
Simply google the net for "PDF & .NET", you get hundreds of links. Many
are
commercial products, but a few of them are freeware.

"Chris" <Ch***@discussions.microsoft.com> wrote in message
news:E2**********************************@microsof t.com...
Hello all,

I wish to automate printing of PDF documents in a C# application.

Is there an Adobe .net object? I tried to create a reference to the COM
Object Adobe Type Library, but I get error "Exception from HRESULT

0x80131019"

Thanks
Chris



Jul 21 '05 #5

P: n/a
Sorry for the late reply.

Unfortunately, I have never succeeded using DDE to control Acrobat from C#.
I tried a bit now, getting no errors whatsoever, everything runs, but
nothing happens.
It is really hard, to be honest.

Basically, you will need to use Windows API functions defined in user32.dll,
essentially DdeInitialize, DdeConnect, DdeCreateDataHandle,
DdeClientTransaction, and DdeUninitialize.

This example is C ++, but should give you a start:
http://www.codeproject.com/cpp/ReaderWrapper.asp
If you google a bit, you will find some VB examples of using DDE.
They might be a help as well.

The Acrobat DDE reference you can read about here(section "DDE Messages"):
http://partners.adobe.com/public/dev...CReference.pdf

DDE can be used to control both Acrobat and Acrobat Reader.
However, if you have the full Acrobat Version, then you can and should use
the COM API
instead, which is not available if only the Reader is installed on the
machine.

Finally, if you are out of success, you might consider bying something like
this:
http://www.pdfstore.com/details.asp?ProdID=703&fp
It is relatively cheap.
Hope this helps just a bit.

PS
And please, contact me if you do succeed!

--
Regards,
Dennis JD Myrén
Oslo Kodebureau
"Chris" <Ch***@discussions.microsoft.com> wrote in message
news:EF**********************************@microsof t.com...
Thanks Dennis - quite correct, I am not looking to generate a PDF

I have Acrobat 5.0 installed, and I can see the 'Acrobat 5.0 Type Library'
availabale as a 'COM' object under project references.

However, when I select this, (or any of the COM components) in the
references, it comes up with this error:

"A reference to 'COM obect name here' could not be created. Converting the
type library to a .NET assembly failed. Exception from HRESULT:
0x80131019"

Adding the reference works on another development machine...

Any ideas?

Thanks
Chris

"Dennis Myrén" wrote:
However, generating PDF and printing PDF is not the same thing.
Yes, there are lots of PDF generation libraries out there, but native
print
support
you will hardly find.
Your options is to use the DDE interface towards Acrobat, if Acrobat is
available,
or to use GhostScript.

--
Regards,
Dennis JD Myrén
Oslo Kodebureau
"Norman Yuan" <no****@nowhere.no> wrote in message
news:uO**************@TK2MSFTNGP09.phx.gbl...
> There are so many existing .NET libraries/components for PDF
> generating.
> Simply google the net for "PDF & .NET", you get hundreds of links. Many
> are
> commercial products, but a few of them are freeware.
>
> "Chris" <Ch***@discussions.microsoft.com> wrote in message
> news:E2**********************************@microsof t.com...
>> Hello all,
>>
>> I wish to automate printing of PDF documents in a C# application.
>>
>> Is there an Adobe .net object? I tried to create a reference to the
>> COM
>> Object Adobe Type Library, but I get error "Exception from HRESULT
> 0x80131019"
>>
>> Thanks
>> Chris
>
>


Jul 21 '05 #6

P: n/a
Hi Dennis,

Thanks for the reply! Sorry I'm a bit late too - I have discovered the
easiest way will be to do a command line call to acrord32.exe (acrobat
reader) with switches /h and /p to print, so I'm using:

acrord32.exe /p /h filename.pdf

thanks for the links + advice though!

Chris

"Dennis Myrén" wrote:
Sorry for the late reply.

Unfortunately, I have never succeeded using DDE to control Acrobat from C#.
I tried a bit now, getting no errors whatsoever, everything runs, but
nothing happens.
It is really hard, to be honest.

Basically, you will need to use Windows API functions defined in user32.dll,
essentially DdeInitialize, DdeConnect, DdeCreateDataHandle,
DdeClientTransaction, and DdeUninitialize.

This example is C ++, but should give you a start:
http://www.codeproject.com/cpp/ReaderWrapper.asp
If you google a bit, you will find some VB examples of using DDE.
They might be a help as well.

The Acrobat DDE reference you can read about here(section "DDE Messages"):
http://partners.adobe.com/public/dev...CReference.pdf

DDE can be used to control both Acrobat and Acrobat Reader.
However, if you have the full Acrobat Version, then you can and should use
the COM API
instead, which is not available if only the Reader is installed on the
machine.

Finally, if you are out of success, you might consider bying something like
this:
http://www.pdfstore.com/details.asp?ProdID=703&fp
It is relatively cheap.
Hope this helps just a bit.

PS
And please, contact me if you do succeed!

--
Regards,
Dennis JD Myrén
Oslo Kodebureau
"Chris" <Ch***@discussions.microsoft.com> wrote in message
news:EF**********************************@microsof t.com...
Thanks Dennis - quite correct, I am not looking to generate a PDF

I have Acrobat 5.0 installed, and I can see the 'Acrobat 5.0 Type Library'
availabale as a 'COM' object under project references.

However, when I select this, (or any of the COM components) in the
references, it comes up with this error:

"A reference to 'COM obect name here' could not be created. Converting the
type library to a .NET assembly failed. Exception from HRESULT:
0x80131019"

Adding the reference works on another development machine...

Any ideas?

Thanks
Chris

"Dennis Myrén" wrote:
However, generating PDF and printing PDF is not the same thing.
Yes, there are lots of PDF generation libraries out there, but native
print
support
you will hardly find.
Your options is to use the DDE interface towards Acrobat, if Acrobat is
available,
or to use GhostScript.

--
Regards,
Dennis JD Myrén
Oslo Kodebureau
"Norman Yuan" <no****@nowhere.no> wrote in message
news:uO**************@TK2MSFTNGP09.phx.gbl...
> There are so many existing .NET libraries/components for PDF
> generating.
> Simply google the net for "PDF & .NET", you get hundreds of links. Many
> are
> commercial products, but a few of them are freeware.
>
> "Chris" <Ch***@discussions.microsoft.com> wrote in message
> news:E2**********************************@microsof t.com...
>> Hello all,
>>
>> I wish to automate printing of PDF documents in a C# application.
>>
>> Is there an Adobe .net object? I tried to create a reference to the
>> COM
>> Object Adobe Type Library, but I get error "Exception from HRESULT
> 0x80131019"
>>
>> Thanks
>> Chris
>
>


Jul 21 '05 #7

P: n/a
That is cool!
Definitely the easiest way.

--
Regards,
Dennis JD Myrén
Oslo Kodebureau
"Chris" <Ch***@discussions.microsoft.com> wrote in message
news:F5**********************************@microsof t.com...
Hi Dennis,

Thanks for the reply! Sorry I'm a bit late too - I have discovered the
easiest way will be to do a command line call to acrord32.exe (acrobat
reader) with switches /h and /p to print, so I'm using:

acrord32.exe /p /h filename.pdf

thanks for the links + advice though!

Chris

"Dennis Myrén" wrote:
Sorry for the late reply.

Unfortunately, I have never succeeded using DDE to control Acrobat from
C#.
I tried a bit now, getting no errors whatsoever, everything runs, but
nothing happens.
It is really hard, to be honest.

Basically, you will need to use Windows API functions defined in
user32.dll,
essentially DdeInitialize, DdeConnect, DdeCreateDataHandle,
DdeClientTransaction, and DdeUninitialize.

This example is C ++, but should give you a start:
http://www.codeproject.com/cpp/ReaderWrapper.asp
If you google a bit, you will find some VB examples of using DDE.
They might be a help as well.

The Acrobat DDE reference you can read about here(section "DDE
Messages"):
http://partners.adobe.com/public/dev...CReference.pdf

DDE can be used to control both Acrobat and Acrobat Reader.
However, if you have the full Acrobat Version, then you can and should
use
the COM API
instead, which is not available if only the Reader is installed on the
machine.

Finally, if you are out of success, you might consider bying something
like
this:
http://www.pdfstore.com/details.asp?ProdID=703&fp
It is relatively cheap.
Hope this helps just a bit.

PS
And please, contact me if you do succeed!

--
Regards,
Dennis JD Myrén
Oslo Kodebureau
"Chris" <Ch***@discussions.microsoft.com> wrote in message
news:EF**********************************@microsof t.com...
> Thanks Dennis - quite correct, I am not looking to generate a PDF
>
> I have Acrobat 5.0 installed, and I can see the 'Acrobat 5.0 Type
> Library'
> availabale as a 'COM' object under project references.
>
> However, when I select this, (or any of the COM components) in the
> references, it comes up with this error:
>
> "A reference to 'COM obect name here' could not be created. Converting
> the
> type library to a .NET assembly failed. Exception from HRESULT:
> 0x80131019"
>
> Adding the reference works on another development machine...
>
> Any ideas?
>
> Thanks
> Chris
>
> "Dennis Myrén" wrote:
>
>> However, generating PDF and printing PDF is not the same thing.
>> Yes, there are lots of PDF generation libraries out there, but native
>> print
>> support
>> you will hardly find.
>> Your options is to use the DDE interface towards Acrobat, if Acrobat
>> is
>> available,
>> or to use GhostScript.
>>
>> --
>> Regards,
>> Dennis JD Myrén
>> Oslo Kodebureau
>> "Norman Yuan" <no****@nowhere.no> wrote in message
>> news:uO**************@TK2MSFTNGP09.phx.gbl...
>> > There are so many existing .NET libraries/components for PDF
>> > generating.
>> > Simply google the net for "PDF & .NET", you get hundreds of links.
>> > Many
>> > are
>> > commercial products, but a few of them are freeware.
>> >
>> > "Chris" <Ch***@discussions.microsoft.com> wrote in message
>> > news:E2**********************************@microsof t.com...
>> >> Hello all,
>> >>
>> >> I wish to automate printing of PDF documents in a C# application.
>> >>
>> >> Is there an Adobe .net object? I tried to create a reference to the
>> >> COM
>> >> Object Adobe Type Library, but I get error "Exception from HRESULT
>> > 0x80131019"
>> >>
>> >> Thanks
>> >> Chris
>> >
>> >
>>
>>
>>


Jul 21 '05 #8

P: n/a
Guys,

For future readers, I found a way to embed this Acrobat object to .Net
windows form. From the Toolbox, add item, selecte COM component, navigate to
pdf.ocx (normally it is under
program files\Adobe\Acrobat 6.0\Reader\ActiveX\)
That is it!
You can print, save, and other things.

Jo******@gmail.com

"Dennis Myrén" wrote:
That is cool!
Definitely the easiest way.

--
Regards,
Dennis JD Myrén
Oslo Kodebureau
"Chris" <Ch***@discussions.microsoft.com> wrote in message
news:F5**********************************@microsof t.com...
Hi Dennis,

Thanks for the reply! Sorry I'm a bit late too - I have discovered the
easiest way will be to do a command line call to acrord32.exe (acrobat
reader) with switches /h and /p to print, so I'm using:

acrord32.exe /p /h filename.pdf

thanks for the links + advice though!

Chris

"Dennis Myrén" wrote:
Sorry for the late reply.

Unfortunately, I have never succeeded using DDE to control Acrobat from
C#.
I tried a bit now, getting no errors whatsoever, everything runs, but
nothing happens.
It is really hard, to be honest.

Basically, you will need to use Windows API functions defined in
user32.dll,
essentially DdeInitialize, DdeConnect, DdeCreateDataHandle,
DdeClientTransaction, and DdeUninitialize.

This example is C ++, but should give you a start:
http://www.codeproject.com/cpp/ReaderWrapper.asp
If you google a bit, you will find some VB examples of using DDE.
They might be a help as well.

The Acrobat DDE reference you can read about here(section "DDE
Messages"):
http://partners.adobe.com/public/dev...CReference.pdf

DDE can be used to control both Acrobat and Acrobat Reader.
However, if you have the full Acrobat Version, then you can and should
use
the COM API
instead, which is not available if only the Reader is installed on the
machine.

Finally, if you are out of success, you might consider bying something
like
this:
http://www.pdfstore.com/details.asp?ProdID=703&fp
It is relatively cheap.
Hope this helps just a bit.

PS
And please, contact me if you do succeed!

--
Regards,
Dennis JD Myrén
Oslo Kodebureau
"Chris" <Ch***@discussions.microsoft.com> wrote in message
news:EF**********************************@microsof t.com...
> Thanks Dennis - quite correct, I am not looking to generate a PDF
>
> I have Acrobat 5.0 installed, and I can see the 'Acrobat 5.0 Type
> Library'
> availabale as a 'COM' object under project references.
>
> However, when I select this, (or any of the COM components) in the
> references, it comes up with this error:
>
> "A reference to 'COM obect name here' could not be created. Converting
> the
> type library to a .NET assembly failed. Exception from HRESULT:
> 0x80131019"
>
> Adding the reference works on another development machine...
>
> Any ideas?
>
> Thanks
> Chris
>
> "Dennis Myrén" wrote:
>
>> However, generating PDF and printing PDF is not the same thing.
>> Yes, there are lots of PDF generation libraries out there, but native
>> print
>> support
>> you will hardly find.
>> Your options is to use the DDE interface towards Acrobat, if Acrobat
>> is
>> available,
>> or to use GhostScript.
>>
>> --
>> Regards,
>> Dennis JD Myrén
>> Oslo Kodebureau
>> "Norman Yuan" <no****@nowhere.no> wrote in message
>> news:uO**************@TK2MSFTNGP09.phx.gbl...
>> > There are so many existing .NET libraries/components for PDF
>> > generating.
>> > Simply google the net for "PDF & .NET", you get hundreds of links.
>> > Many
>> > are
>> > commercial products, but a few of them are freeware.
>> >
>> > "Chris" <Ch***@discussions.microsoft.com> wrote in message
>> > news:E2**********************************@microsof t.com...
>> >> Hello all,
>> >>
>> >> I wish to automate printing of PDF documents in a C# application.
>> >>
>> >> Is there an Adobe .net object? I tried to create a reference to the
>> >> COM
>> >> Object Adobe Type Library, but I get error "Exception from HRESULT
>> > 0x80131019"
>> >>
>> >> Thanks
>> >> Chris
>> >
>> >
>>
>>
>>


Jul 21 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.