How to print a pdf document through java script

P

pavan.ananthula

Hello,

I have a web page which needs to print a pdf file when the javascript
is called.

I have the java script as

function printPDF(PrintString)
{
var status = 0;
var AccroApp;
var p;
var a;

try
{
AccroApp = new
ActiveXObject('AcroExch.App');

p = new ActiveXObject('AcroExch.PDDoc');

a = new ActiveXObject('AcroExch.AvDoc');

if (PrintString !='')
{
var Str = new String();
Str=PrintString;
p.Open(PrintString);
a = p.OpenAVDoc(p.GetFileName);
i = p.GetNumPages;
a.PrintPagesSilent(0,i,0,0,0);
a.Close(0);
p.Close;
AcroApp.Exit;
}
catch (e)
{

if (e.number != 0)
{
alert("Unable to Print - " + e.description);

}
}


But it throws an exception "Automation server cannot create object". I
have Acrobat 7.0 full version installed in my system. It will of agreat
help for me if anyone can tell me, how to solve this issue.

Thanks & Regards,
Pavan
 
B

bruce barker \(sqlwork.com\)

you will have to set the browser trust level to full for the website.

-- bruce (sqlwork.com)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top