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.
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.