473,385 Members | 2,014 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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

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
8 12545

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
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
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
by: dcrespo | last post by:
Hi all... Is there a way to print a PDF file directly from Python without having Acrobat installed? I know about ReportLab. It's a python module that lets you create almost any PDF document, but I...
1
by: S Taylor | last post by:
I have looked through many newsgroups to see how I can print several pdf documents to a printer, from Access using vba. The documents are scans of images, so I don't think they can be open through...
16
by: cyranoVR | last post by:
This is the approach I used to automate printing of Microsoft Access reports to PDF format i.e. unattended and without annoying "Save As..." dialogs, and - more importantly - without having to use...
1
by: chatmili | last post by:
I am very frustrated after searching for three days. My problem seems to be so hard that no one really had an answer for it. I have seen postings with similar problem but they were either ignored...
11
by: cybertof | last post by:
Hello, Is there a way to easily print a .pdf file to the printer ? (without an external component) Thanks.
2
by: ACaunter | last post by:
Hi all, i was wondering if there was a way to directly print a document to the user's printer, without having to download it first... I needed something like a button, and when the user clicks the...
13
by: Sumant | last post by:
printing text in VB6 can be done just by "Printing.Print". is there any replacement for this in .NET? Drawing.Print won't work coz it converts text into image and then prints. so when we use Adobe...
6
by: Chris | last post by:
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...
1
by: billelev | last post by:
Here is some code that I have adapted slightly. It allows a report to be printed to a specific location. It works by calling SaveReportAsPDF and specifying the access report name, and the root...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.