QuickReport 6 exception when we build PDF with embedded font(s)

360 Views Asked by At

We used to build PDF document using QuickReport for years. Now we have the customer who uses uncommon font for print layouts and we have to embed this font inside PDF so it can be opened with this font on any device.

This can be achieved when we add this line of code:

pdfFilter.FontHandling := fhAutoembed;

We've got access violation error now...

1

There are 1 best solutions below

0
khablander62 On

Debugging ... and we can see we write to uninitialized TStream. After changes in qrpdffilt.pas all working as expected. Changes are:

#1 add new function

function ArrayCharToString(A: array of AnsiChar): String;
var i: integer;
begin
  Result := '';
  for i := 0 to High(A) do
    Result := Result + A[i];
end;

#2 and in line 1810

//      for K := 0 to PDFFont.FileLength-1 do
//        WriteByte(Byte(Buff[K]));
      WriteStr(ArrayCharToString(Buff));

Hope it will help some other devs