Error Creating PDFs

  • Hello

    I am trying to print almost 40000 letters out and at around 8000 letters, the process fails. I receive an access violation.

    " Project Letter.exe raised exception class EOutOfMemory with message
    'Zu wenig Arbeitsspeicher (4544)' "

    The unit WPPDFR1 is the unit raising the exception. The procedure DrawMetaFileex to be precise.

    Here is my code

    WPPDFExport2 := TWPPDFExport.Create(Application);
    WPPDFExport2.Source := DBWPRichText_1;

    WPPDFExport2.Filename := YesBackSlash(DBPath) +
    oDataSet.FieldByName('Mem_No').AsString +
    cLetterNumber + '.pdf';
    WPPDFExport2.BeginDoc;
    WPPDFExport2.Print;
    WPPDFExport2.EndDoc;


    MyPDF := TMemoryStream.Create;
    try
    BS := oDataSet.CreateBlobStream(oDataSet.FieldByName
    ('LetterImage'), bmWrite);
    try
    MyPDF.Clear;
    MyPDF.LoadFromFile(cPDFFilename);
    MyPDF.SaveToStream(BS);
    finally
    BS.free;
    end;
    finally
    MyPDF.Free;
    end;

    WPPDFExport2.Free;

    Any ideas as to what I could do to improve this code so I don't suck my memory dry?

    Thank!

    Zosox

    • Offizieller Beitrag

    Hi,

    I would suggest to use only one instance of the exporter and use that for export only.

    But often such problems are caused by the drawing code itself, for example if there are images in the exported RTF data.

    Julian