Click here to Skip to main content
15,893,904 members
Home / Discussions / C#
   

C#

 
AnswerRe: multithreading issue Pin
BobJanova30-May-14 0:06
BobJanova30-May-14 0:06 
QuestionIIf Statement - Different Problem With RDLC Pin
Paramu197329-May-14 15:10
Paramu197329-May-14 15:10 
AnswerRe: IIf Statement - Different Problem With RDLC Pin
Karen Mitchelle29-May-14 16:04
professionalKaren Mitchelle29-May-14 16:04 
GeneralRe: IIf Statement - Different Problem With RDLC Pin
Paramu197329-May-14 19:15
Paramu197329-May-14 19:15 
Questionhow do i send notifications using web services? Pin
tanywali29-May-14 1:12
tanywali29-May-14 1:12 
AnswerRe: how do i send notifications using web services? Pin
BobJanova29-May-14 1:21
BobJanova29-May-14 1:21 
AnswerRe: how do i send notifications using web services? Pin
Pete O'Hanlon29-May-14 1:28
mvePete O'Hanlon29-May-14 1:28 
QuestionActivex code to print pdf files on client machine Pin
Sachin Mehndiratta29-May-14 1:03
Sachin Mehndiratta29-May-14 1:03 
Hi All,

I am looking for expert advice on printing the pdf files at client machine.

I have created a sample project named ClientPrint as

XML
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Printing;
using System.Runtime.InteropServices;

namespace ActiveX
{
	public interface IActiveXPrintLib
	{
		void PrintFile(string filePath);
	}

	[ProgId("ActiveX.PrintFile")]
	[ClassInterface(ClassInterfaceType.AutoDual)]
	[ComVisible(true)]
	public class ActiveXPrintLib : IActiveXPrintLib
	{

		[ComVisible(true)]
		public void PrintFile(string filePath)
		{
			AcroPDFLib.AcroPDF AcroPdf = new AcroPDFLib.AcroPDF();
			AcroPdf.LoadFile(filePath);
			AcroPdf.printAll();

		}

	}
}


I have created the dll and register the dll using regasm command on client machine.

Now at time of consuming the print method at client side using javascript as

<object id="myControl1" name="myControl1" classid="clsid:ActiveX.ActiveXPrintLib"> </object>

XML
var axComponent = new ActiveXObject("ActiveX.ActiveXPrintLib");
    alert(axComponent);
    if (axComponent == null) {
        alert('Probably not installed');
    }
    else {
        axComponent.PrintFile('<%= Page.ResolveUrl("~/PdfTemp/0d818b57-9384-4f52-ae89-8ef5868064b7.pdf")  %>');
        alert('yes');
    }


I am getting the error that automation server can't create object, using IE I have enabled the active x and permisssions to download the activex. but it still gives me same error.

I am not sure whether my code is correct or not.

Any advice is really helpful.

Thanks in advance.
Sachin Mehndiratta
mehndi.sachin@gmail.com


modified 30-May-14 4:55am.

AnswerRe: Activex code to print pdf files on client machine Pin
Pete O'Hanlon29-May-14 1:23
mvePete O'Hanlon29-May-14 1:23 
GeneralRe: Activex code to print pdf files on client machine Pin
Sachin Mehndiratta29-May-14 1:30
Sachin Mehndiratta29-May-14 1:30 
GeneralRe: Activex code to print pdf files on client machine Pin
Richard MacCutchan29-May-14 2:09
mveRichard MacCutchan29-May-14 2:09 
GeneralRe: Activex code to print pdf files on client machine Pin
Sachin Mehndiratta29-May-14 22:57
Sachin Mehndiratta29-May-14 22:57 
GeneralRe: Activex code to print pdf files on client machine Pin
Sachin Mehndiratta29-May-14 22:57
Sachin Mehndiratta29-May-14 22:57 
AnswerRe: Activex code to print pdf files on client machine Pin
Eddy Vluggen29-May-14 4:12
professionalEddy Vluggen29-May-14 4:12 
GeneralRe: Activex code to print pdf files on client machine Pin
Richard Deeming29-May-14 7:57
mveRichard Deeming29-May-14 7:57 
QuestionHow can I get the file name with full path of File which is Sent to Print to Printer++ Pin
Shohel Ahsan28-May-14 22:54
Shohel Ahsan28-May-14 22:54 
AnswerRe: How can I get the file name with full path of File which is Sent to Print to Printer++ Pin
Richard MacCutchan29-May-14 0:38
mveRichard MacCutchan29-May-14 0:38 
GeneralRe: How can I get the file name with full path of File which is Sent to Print to Printer++ Pin
Shohel Ahsan29-May-14 0:52
Shohel Ahsan29-May-14 0:52 
GeneralRe: How can I get the file name with full path of File which is Sent to Print to Printer++ Pin
OriginalGriff29-May-14 1:09
mveOriginalGriff29-May-14 1:09 
GeneralRe: How can I get the file name with full path of File which is Sent to Print to Printer++ Pin
Richard MacCutchan29-May-14 1:22
mveRichard MacCutchan29-May-14 1:22 
GeneralRe: How can I get the file name with full path of File which is Sent to Print to Printer++ Pin
Shohel Ahsan29-May-14 1:25
Shohel Ahsan29-May-14 1:25 
QuestionHow do I add a video bookmark? Pin
Member 1085116328-May-14 19:16
Member 1085116328-May-14 19:16 
Questionoverloading a construtor Pin
sneezesnoeze28-May-14 11:00
sneezesnoeze28-May-14 11:00 
AnswerRe: overloading a construtor Pin
Matt T Heffron28-May-14 11:04
professionalMatt T Heffron28-May-14 11:04 
GeneralRe: overloading a construtor Pin
sneezesnoeze28-May-14 11:21
sneezesnoeze28-May-14 11:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.