Problem after updating to wPDF3
Bern,
Julian's suggestion to rem out the Application. ProcessesMessages is an excellent one.
While the method can be quite useful, I've found time and time again it is an application killer, forcing statements to be executed out of synch, fetching commands from the Windows queue before they should be processed.
Looking at your code, it appears ProcessMessages shouldn't be executed, since it's is in the exception handler, but stranger things have happened under the sun - and it certainly might explain what you're experiencing.
Unless you've single-stepped through, and know the exception handler is never executed, maybe throw in a MessageDlg statement in the handler to see if that gets triggered.
Best of luck..🙂
richard diamond
Hi,
In unit WPPDFR1.pas you will find this source:
implementation
const
{$IFDEF WPDF3}
{$DEFINE DEF_ENHMETAFILE}
Please change this to
implementation
const
{$IFDEF WPDF3}
{---$DEFINE DEF_ENHMETAFILE}
This way the "old" way to create a temporary metafile is used. That is the only relevant difference I can image which can cause a problem.
I tried wPDF on a multi CPU system for threadsavety and never had such a resource leak. I wonder what it is. Maybe removed the Application.ProcessMessage for a test.
Julian
Hello,
We have an application that uses wPDF and WPtools. When we have wPDF v2 this application worked perfectly but since updating to wPDF V3 (January 2007 build) we are getting errors, we get either an "Not enough storage to is available to process this command" in WPCTRMemo Line 8330
if not Transparent and not FDidTriggerPaintEvent then DoPaint;
or a "Canvas does not allow drawing" error that happens in WPPDFR1 line 959
FCanvas := TMetafileCanvas.Create(Self, dc);
Here is the code used to make the pdfs
procedure TForm1.Button1Click(Sender: TObject);
var
PDF: TWPPDFExport;
strFileName: string;
begin
RzProgressBar1.PartsComplete:=0;
WPDF_Start('xxx, 'xxx');
PDF := TWPPDFExport.Create(nil);
try
PDF.CidFontMode := wpCIDUnicode;
PDF.Source := WPRichText1;
PDF.FontMode := wpEmbedSymbolTrueTypeFonts;
PDF.CompressStreamMethod := wpCompressFlate;
PDF.JPEGQuality := wpJPEG_50;
dbisamtable1.open;
wprichtext1.TextLoadFormat := 'Auto';
RzProgressBar1.TotalParts:=dbisamtable1.RecordCount;
while not dbisamtable1.Eof do
begin
// Load Text
try
WPRichText1.TextLoadFormat := 'Auto';
WPRichText1.BeginUpdate;
WPRichText1.AsString := dbisamtable1.FieldByName('DrugInfoSheet').AsString;
WPRichText1.EndUpdate;
RzProgressBar1.IncPartsByOne;
WPRichText1.ReformatAll(True, False);
pdf.Filename := 'D:\Documents and Settings\bernr\Desktop\!test\' + dbisamtable1.FieldByName('DrugInfoSheet_GUID').AsString + '.pdf';
PDF.BeginDoc;
PDF.Print;
PDF.EndDoc;
except
application.ProcessMessages;
end;
dbisamtable1.Next;
end;
finally
dbisamtable1.Close;
pdf.free;
end;
end;
Any ideas.
Bern
WPTools 5.22
wPDF dll version 3.0.6.5 Dated 1/25/2007
BDS 2006