How can I Get PDF file name after convert one doc to pdf ?
Posted: Tue Feb 15, 2011 6:22 am
Hi
How can I Get PDF file name after convert one doc to pdf ?
Because the parameter Option is a Write only parameterized property. I can Set the PDF file name , but if the file exists already, and I set property Option like : FPDFPrinter.Option['Save.WhenExists'] := 'ShowWarning';
So the current PDF file name may be changed by user. How can I Get the current PDF file name ?
My code below:
procedure TcxPDFPrinter.Print;
begin
if not FileExists(FSrcFileName) then
begin
if Assigned(FOnError) then
FOnError(Self, Format(CXPDFPRINTER_ERROR_FILENOTEXISTS,[FSrcFileName]));
Exit;
end;
FDstFileName := ChangeFileExt(FSrcFileName, '.pdf');
FPDFPrinter.SetAsDefaultPrinter;
FPDFPrinter.Option['Save.RunApp'] := FIfRunPDFViewer;
FPDFPrinter.Option['Save.File'] := FDstFileName;
FPDFPrinter.Option['Save.SaveType'] := 'Save';
FPDFPrinter.Option['Save.ShowSaveDialog'] := 'No';
FPDFPrinter.Option['Save.WhenExists'] := 'ShowWarning'; // 'Overwrite'
FPDFPrinter.Option['Compression.Graphics'] := 'No';
FPDFPrinter.Option['Compression.Text'] := 'No';
FPDFPrinter.Option['Fonts.EmbedAll'] := 'No';
ShellExecute(HWND(nil), 'print', PChar(FSrcFileName), PChar('"' + FPrinterName + '"'), nil, SW_NORMAL);
// I want to get PDF file name after convert one doc to pdf. But the parameter Opention is Write only.
// FDstFileName := VarToStr(FPDFPrinter.Option['Save.File']);
FPDFPrinter.RestoreDefaultPrinter;
if Assigned(FOnAfterPrint) then
FOnAfterPrint(Self);
end;
Thank in advance.
How can I Get PDF file name after convert one doc to pdf ?
Because the parameter Option is a Write only parameterized property. I can Set the PDF file name , but if the file exists already, and I set property Option like : FPDFPrinter.Option['Save.WhenExists'] := 'ShowWarning';
So the current PDF file name may be changed by user. How can I Get the current PDF file name ?
My code below:
procedure TcxPDFPrinter.Print;
begin
if not FileExists(FSrcFileName) then
begin
if Assigned(FOnError) then
FOnError(Self, Format(CXPDFPRINTER_ERROR_FILENOTEXISTS,[FSrcFileName]));
Exit;
end;
FDstFileName := ChangeFileExt(FSrcFileName, '.pdf');
FPDFPrinter.SetAsDefaultPrinter;
FPDFPrinter.Option['Save.RunApp'] := FIfRunPDFViewer;
FPDFPrinter.Option['Save.File'] := FDstFileName;
FPDFPrinter.Option['Save.SaveType'] := 'Save';
FPDFPrinter.Option['Save.ShowSaveDialog'] := 'No';
FPDFPrinter.Option['Save.WhenExists'] := 'ShowWarning'; // 'Overwrite'
FPDFPrinter.Option['Compression.Graphics'] := 'No';
FPDFPrinter.Option['Compression.Text'] := 'No';
FPDFPrinter.Option['Fonts.EmbedAll'] := 'No';
ShellExecute(HWND(nil), 'print', PChar(FSrcFileName), PChar('"' + FPrinterName + '"'), nil, SW_NORMAL);
// I want to get PDF file name after convert one doc to pdf. But the parameter Opention is Write only.
// FDstFileName := VarToStr(FPDFPrinter.Option['Save.File']);
FPDFPrinter.RestoreDefaultPrinter;
if Assigned(FOnAfterPrint) then
FOnAfterPrint(Self);
end;
Thank in advance.