Page 1 of 1

C++Builder5 - Optiondialog still visible

Posted: Thu Apr 07, 2011 5:03 pm
by DATAMED
We want to automatically convert a Word-document into a pdf-file.
That's not possible, because the user has to click on save-button in optiondialog.
what can we do?

Here's the code:

Variant obj = Variant::CreateObject("Bullzip.PDFPrinterSettings");
AnsiString printername = obj.OleFunction("GetPrinterName");

AnsiString output = "C:\\test_23523.pdf";

obj.OleFunction("Init");
obj.OleFunction("SetValue", "printerName", printername);
obj.OleFunction("SetValue", "Output", output );
obj.OleFunction("SetValue", "ShowSaveAS", "never"); //never
obj.OleFunction("SetValue", "ShowSettings", "never" ); //never
obj.OleFunction("SetValue", "ConfirmOverwrite", "no" );
obj.OleFunction("SetValue", "ShowPDF", "no" );
obj.OleFunction("SetValue", "WatermarkText", "Hallo" );
obj.OleFunction("SetValue", "ShowProgress", "no" );
obj.OleFunction("SetValue", "ShowProgressFinished", "no" );
obj.OleFunction("SetValue", "SuppressErrors", "yes" );
obj.OleFunction("SetValue", "ConfirmOverwrite", "no" );
obj.OleFunction("WriteSettings", "true");

AnsiString currentdir = ExtractFilePath(Application->ExeName);
AnsiString printfile = currentdir + "test2.doc";

AnsiString cmd = "\"" + printfile + "\"";// + " " + printername;

int Result = (int)ShellExecute( Handle,
"open",
AnsiString(currentdir + "printto.exe").c_str(),
cmd.c_str(),
currentdir.c_str(),
SW_SHOWNORMAL );

if(Result>32) Edit1->Text = "ok";
else Edit1->Text = "bad";

obj = Unassigned;


best regards,
datamed