FR5 frxExportPDF.pas bug - fixed!

Kept getting AV errors with PDF exports with around 8500 outlines. My exports were dieing at around page 350 Then a big EOutOfMemory error.

Work around was to turn off "Outline" on report export.

Fix was to remove the recursive iterations of TfrxPDFOutlineNode.Destroy, for each item if there was a next it would go deeper in recursion, a great way to kill your app...

I can now run 1700+ page exports with Outline on.

Also goes for the Outline exporting routine.

Major functions added to TfrxPDFExport.Finish:

Procedure RecursiveOutline(OutlineNode:TfrxPDFOutlineNode);
var
TempOutlineTreeNode : TfrxPDFOutlineNode;
OutlineCount : Integer;

begin

if OutlineNode <> nil then
begin

TempOutlineTreeNode := OutlineNode.First;

for OutlineCount := 0 to OutlineNode.Count -1 do
begin

if TempOutlineTreeNode <> nil then
begin
WriteOutline(TempOutlineTreeNode);

RecursiveOutline(TempOutlineTreeNode);

end;
TempOutlineTreeNode := TempOutlineTreeNode.Next;
end;
end;

end;

Procedure RecursiveFreeOutline(OutlineNode:TfrxPDFOutlineNode);
var
TempOutlineTreeNode : TfrxPDFOutlineNode;
PrevOutlineNode : TfrxPDFOutlineNode;
OutlineCount : Integer;

begin

if OutlineNode <> nil then
begin


TempOutlineTreeNode := OutlineNode.Last;

for OutlineCount := 0 to OutlineNode.Count -1 do
begin

if TempOutlineTreeNode <> nil then
begin
PrevOutlineNode := TempOutlineTreeNode.Prev;

RecursiveFreeOutline(TempOutlineTreeNode);

TempOutlineTreeNode.Free;
TempOutlineTreeNode := nil;
end;

TempOutlineTreeNode := PrevOutlineNode;
end;

end;

end;

May help someone who has to use the built in PDF engine.

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.