Access violation during export

  • I want to append the contents of an RTF file to my exported page. Unfortunately I am getting an access violation. The code I use to export is like that:

    Code
    procedure TForm1.isdPdfExpBTClick(Sender: TObject);var  lFile: String;  lTmpRtf: TWPRichText;begin  if nameTF.Text <> '' then    lFile := 'datenabo_'+nameTF.Text+'.pdf'  else    lFile := 'datenabo.pdf';  lTmpRtf := TWPRichText.Create(nil);  lTmpRtf.LoadFromFile('AGB.rtf', false);  isdPdfExp.Filename := lFile;  try    try      WPDF_Start('xxx','xxx');      isdPdfExp.BeginDoc;      isdPdfexp.Source := isdDoc;      isdPdfExp.Print;      isdPdfexp.Source := lTmpRtf;      isdPdfExp.Print;      isdPdfExp.EndDoc;      ShellExecute(handle, 'open', PCHAR(lFile), nil, nil, sw_show );    except on E: Exception do      MessageDlg(E.Message, mtError, [mbOK], 0);    end;  finally    lTmpRtf.Free;  end;end;

    The access violation happens in unit WPPDFWP on line 252:

    Code
    // V2.60 - new way to read page size
              w := MulDiv(FSource.Memo._PaintPages[i].WidthTw,WPScreenPixelsPerInch,1440); // it crashes here
              h := MulDiv(FSource.Memo._PaintPages[i].HeightTw,WPScreenPixelsPerInch,1440);
              if (w=0) or (h=0) then
              begin
               w := Round( FSource.Memo.PaintPageWidth[i] / FSource.Memo.CurrentZooming );
               h := Round( FSource.Memo.PaintPageHeight[i] / FSource.Memo.CurrentZooming );
              end;

    Unless I am doing something wrong I reckon this is a bug.

    Any help is very much appreciated!

    Regards,
    Dirk.