Dev-OS=Win11-64Bit
Laz 4.3-64Bit
FPC 3.2.3-64Bit
target=Win64
gemäss Wiki mal das Beispiel ausprobiert
Code: Alles auswählen
program Project1;
{$mode ObjFPC}{$H+}
Uses Sysutils, Classes, fppdf;
var
FontID,FontBoldID: Integer;
Document: TPDFDocument;
Section: TPDFSection;
Page: TPDFPage;
begin
Document := TPDFDocument.Create(nil);
Document.FontDirectory := 'C:\Windows\Fonts';
Document.Options := Document.Options + [poPageOriginAtTop, poNoEmbeddedFonts];
//Document.Options := Document.Options + [poPageOriginAtTop, poNoEmbeddedFonts, poOutLine]; //"poOutline" = KABOOM
Document.StartDocument;
FontID := Document.AddFont('arial.ttf', 'Arial');
FontBoldID := Document.AddFont('arialbd.ttf', 'Arial Bold');
Section := Document.Sections.AddSection;
Section.Title:='Test-Title';
Page := Document.Pages.AddPage;
Page.Orientation := ppoLandscape;
Page.UnitOfMeasure := uomPixels;
Page.PaperType := ptA4;
Section.AddPage(Page);
Page.SetFont(FontID, 11);
Page.WriteText(20, 20, 'This is normal text');
Page.SetFont(FontBoldID, 11);
Page.WriteText(20, 30, 'This is bold text');
Document.SaveToFile('c:\temp\output.pdf');
Document.Free;
end.ABER: Wenn ich "poOutline" in die Options reinnehme (siehe auskommentierte Zeile), knallts mit
"List index (20956928) out of bounds"
Kann das jemand bestätigen?