WPCubed Product Support

Best way to trap exception if file name is in use

support

Hi,

thanks for the suggestion. In the menatime I have changed the code in the engine, it used fmCreate instead of fmOpenReadWrite OR fmShareExclusive.

Julian

#5 ♥ 0
8.2k Views 2 users read 1 min

Thank you Julian.

I have modified the code in WPtoPDFDlg to see if the file can be exclusively opened when the user clicks 'CreatePDF'.

Try
    if FileExists(fileName.text) Then
      begin
        chkStream := TFileStream.Create(fileName.text, fmOpenReadWrite OR fmShareExclusive);
      end;
  except
    on EFOpenError do
    .....

I will look at your suggestion but the I'm sure error being returned was an IO error.

Rob.

#4 ♥ 0
support

Hi,

If the internal file create fails it raises the PDFException exception.

You need to trap the method BeginDoc.

Julian

#3 ♥ 0

Can someone let me know when this bug has been fixed?

Thanks.

Rob

#2 ♥ 0

Hello

How can I trap the exception that occurs if the user creates a pdf and tries to create it later (perhaps having made some changes) not realizing the first copy is open in the Acrobat viewer?

Thanks.

Rob.

#1 ♥ 0