Hi,
I got problem when create an instance/object CAcroPDDoc in User laptop for
second PDF.
But it can run successfully in my laptop.
The following is my code:
private void PrintPDF(string pFileName)
{
bool BOpenDoc = false;
Type TypeAcrobatAVDoc;
TypeAcrobatAVDoc = Type.GetTypeFromProgID("AcroExch.AVDoc");
Acrobat.CAcroAVDoc ObjAdobeAVDoc = (Acrobat.CAcroAVDoc)Activator.CreateInstance(TypeAcrobatAVDoc);
BOpenDoc = ObjAdobeAVDoc.Open(pFileName, "");
if (BOpenDoc)
{
Type TypeAcrobatPDDoc;
TypeAcrobatPDDoc = Type.GetTypeFromProgID("AcroExch.PDDoc");
Acrobat.CAcroPDDoc ObjAdobePDDoc = (Acrobat.CAcroPDDoc)Activator.CreateInstance(TypeAcrobatPDDoc);
ObjAdobePDDoc = ObjAdobeAVDoc.GetPDDoc();
int IntStartLine = 0;
int IntEndLine = ObjAdobePDDoc.GetNumPages() - 1;
ObjAdobeAVDoc.PrintPagesSilent(IntStartLine, IntEndLine, 3, 1, 1);
ObjAdobePDDoc.Close();
}
ObjAdobeAVDoc.Close(Convert.ToInt32(true));
}
private void Button_Click(object sender, EventArgs e)
{
string strFile1 = "File1.pdf";
string strFile2 = "File2.pdf";
PrintPDF(strFile1);
PrintPDF(strFile2);
}
Then I got error in below code:
Acrobat.CAcroAVDoc ObjAdobeAVDoc = (Acrobat.CAcroAVDoc)Activator.CreateInstance(TypeAcrobatAVDoc);
Below is the error message:
Creating an instance of the COM component with CLSID {72498821-3203-101B-B02E-04021C009402} from the IClassFactory failed due to the following error: 80010108 The object invoked has disconnected from its clients. (Exception from HRESULT: 0x80010108 (RPC_E_DISCONNECTED)).
User uses Acrobat XI and physical printer.
I use Acrobat Pro DC and Virtual printer.
I don't know exactly what went wrong.
Anyone can help me please?
Thank you.
What I have tried:
I already used many virtual printer like "Microsoft Print to PDF", "One Note", "Microsoft XPS Document Writer".
But no error.