How to use ActiveX component from console program?

PDF-XChange Viewer SDK for Developer's
(ActiveX and Simple DLL Versions)

Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan

Post Reply
ErikG
User
Posts: 6
Joined: Sun Mar 22, 2009 8:59 pm

How to use ActiveX component from console program?

Post by ErikG »

Hello!
I am currently evaluating different tools for printing pdf. I am happy to say that you are ranked at top in rendering quality. However when printing a document with lot of pictures in it it takes significantly longer time and results in a bigger print job.

But when I am using the readymade ActiveX-based program instead of the simple dll, both printing-time and size are OK. I have problem implementing the ActiveX in my program, so I would appreciate some help. I get S_FALSE as result when calling

hr = viewer.CreateDispatch("PDFXCviewAx.CoPDFXCview",NULL);

and then I get an exception on the first call to the viewer method.

I enclose a zip with the code I have used. The main source has the following lines:

int _tmain(int argc, _TCHAR* argv[])
{
HRESULT hr = CoInitialize(NULL);
PrintPdfDocumentWithPDFXChangeAX(argv[1], "", "", "");
PrintPdfDocumentWithPDFXChange(argv[1], "", "", "");
return 0;
}

TIA

Erik
Attachments
PDFXChange.zip
(3.16 KiB) Downloaded 132 times
User avatar
Ivan - Tracker Software
Site Admin
Posts: 3550
Joined: Thu Jul 08, 2004 10:36 pm
Location: Vancouver Island - Canada
Contact:

Re: How to use ActiveX component from console program?

Post by Ivan - Tracker Software »

When you are using Simple SDK (dll), which flags are you specifying in the Flags parameter?
Tracker Software (Project Director)

When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
ErikG
User
Posts: 6
Joined: Sun Mar 22, 2009 8:59 pm

Re: How to use ActiveX component from console program?

Post by ErikG »

Hello Ivan!

Thanks for your prompt posting. I had my simple dll method in the attached files, but here are the code:

for (i=0; i<page_num; i++) {
StartPage(hDC);
hr = PXCV_GetPageRotation(pDoc,i,&angle);
hr = PXCV_GetPageDimensions(pDoc,i,&width,&height);
if (angle == 0 && width > height)
pParams.Flags = pxvrpf_UseVectorRenderer | pxvrpf_Rotate_Rotate90CCW;
else
pParams.Flags = pxvrpf_UseVectorRenderer;
hr = PXCV_DrawPageToDC(pDoc,i,hDC,&pParams);
PXCV_ReleasePageCachedData(pDoc,i,0);
PXCV_ReleaseCachedData(pDoc,pxvrcd_ReleaseDocumentImages);
EndPage(hDC);
}

The test file I was using are this http://www.adobe.com/devnet/actionscrip ... okbook.pdf, in fact Tracker and Adobe were the only programs that could render the shadows and other drawings correctly. But for Tracker it took 3 minutes before everything was delivered to the print manager and the size of print job was also bigger. Standard test program and my code was the same, but the standard test did not switch printing to landscape. When using the activeX printtime and size were OK, but landscape were not used. Thats the reason I like to use activeX for the final tests.

Erik
User avatar
Vasyl-Tracker Dev Team
Site Admin
Posts: 2353
Joined: Thu Jun 30, 2005 4:11 pm
Location: Canada

Re: How to use ActiveX component from console program?

Post by Vasyl-Tracker Dev Team »

1. We will have to add possibility for change page rotation to ActiveX in the near future.
You can use custom activeX hosting for console mode (for example: http://www.codeproject.com/KB/cpp/Activ ... utMFC.aspx).
2. For simple SDK,
you can try (as workaround):

Code: Select all

for (i=0; i<page_num; i++) {
StartPage(hDC);
hr = PXCV_GetPageRotation(pDoc,i,&angle);
hr = PXCV_GetPageDimensions(pDoc,i,&width,&height);
if (angle == 0 && width > height)
pParams.Flags = pxvrpf_UseVectorRenderer | pxvrpf_Rotate_Rotate90CCW;
else
pParams.Flags = pxvrpf_UseVectorRenderer;
hr = PXCV_DrawPageToDC(pDoc,i,hDC,&pParams);
if ((i%10)==0)
  PXCV_ReleasePageCachedData(pDoc,i,0);
EndPage(hDC);
}
PXCV_ReleaseCachedData(pDoc, pxvrcd_ReleaseDocumentImages);
Also, we will to resolve this problem in the near future.

Thanks.
Vasyl Yaremyn
Tracker Software Products
Project Developer

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
Post Reply