Try this.
Start a new Lazarus GUI application.
In the Project Inspector add a new requirement for the printer4lazarus package.
Drop a listbox on the form.
Double-click the form to generate an OnCreate handler. Complete it as follows:
uses
... PrintersDlgs, ...;
procedure TForm1.FormCreate(Sender: TObject);
var
dlg: TPrintDialog;
begin
dlg := TPrintDialog.Create(Nil);
try
if dlg.Execute then
ListBox1.Items.Assign(Printer.PaperSize.SupportedPapers);
finally
dlg.Free;
end;
end;
If you click the Print button in the dialog that shows when the app starts, it will populate the listbox with whatever paper sizes your default printer supports.