Create Pdf file from application (VC++)

The Amyuni PDF Converter is our Printer Driver that enables you to convert any documents to PDF format. If you have any questions about installing and using the Amyuni PDF Converter please post them here.
Post Reply
Riccardone
Posts: 7
Joined: Fri Dec 17 2004

Create Pdf file from application (VC++)

Post by Riccardone »

Hallo, I'm trying to convert a rtf file to pdf file in a VC++ applications using word.
I had install the PDF Printer on my control pannel using install.exe.
In the source code I had insert the automation class CCDIntfEx (CCDIntfEx.h, CCDIntfEx.cpp), and using this code:

#include "cdintfex.h"
void CProvettaDlg::OnButton1()
{
CCDIntfEx h;
TRY
{
// first step operations
h.Create("",WS_CHILD,CRect(0,0,500,500),this,10001);
h.DriverInit("Amyuni Document Converter");
h.EnablePrinter("Company", "Activation Code");
h.SetDefaultPrinter();

h.SetFileNameOptions(1+2);
h.SetDefaultFileName("d:\\temp.pdf");

// Can't print,error
::ShellExecute*this, "print", "d:\\temp.rtf", "",NULL, SW_SHOWMAXIMIZED);

h.RestoreDefaultPrinter();
h.DriverEnd();
}
CATCH(CException, e)
{
}
END_CATCH
}


The PDF Converter is like a default printer and give the right name of the output file, afterwards launch with ShellExecute word applications for print, here I have the problem and the application doesn't work.

What is wrong?
Is the right way for having a pdf file from a rtf file?

Thanks in advanced.
Ricky
Joan
Amyuni Team
Posts: 2799
Joined: Wed Sep 11 2002
Contact:

Post by Joan »

Hello Ricky,

You need to call EnablePrinter() right before printing too, i.e. right before calling ShellExecute.

This should help.
Post Reply