FastReport_FMX_2.8.12/LibD28x64/FMX.Linux.frxPrinter.pas

1325 lines
63 KiB
ObjectPascal
Raw Permalink Normal View History

2024-01-10 21:50:38 +01:00
{******************************************}
{ }
{ FastReport FMX v2.0 }
{ Linux printer classes }
{ }
{ Copyright (c) 1998-2021 }
{ by Fast Reports Inc. }
{ }
{******************************************}
unit FMX.Linux.frxPrinter;
interface
{$I fmx.inc}
{$I frx.inc}
uses
System.Classes, System.SysUtils, System.Types, System.UITypes,
System.Variants, FMX.Types, FMX.frxPrinter, FMX.Printer.Linux, FMX.Printer
{$IFDEF DELPHI19}
, FMX.Graphics
{$ENDIF};
type
TPGtkPrinter = Pointer;
TPGtkPrintBackend = Pointer;
TPGtkPrintJob = Pointer;
TPGtkPrintSettings = Pointer;
TPGtkPageSetup = Pointer;
TPGtkPaperSize = Pointer;
TPcairo_surface_t = Pointer;
TPcairo_t = Pointer;
TfrxDevUpdateType = (fdtMargins, fdtPageSize, fdtBin, fdtDuplex, fdtOrientation);
TfrxDevUpdateTypes = set of TfrxDevUpdateType;
TfrxPrinter = class(TfrxCustomPrinter)
private
FIsFirst: Boolean;
FPrinterContext: Pointer;
FPageSet: TPGtkPageSetup;
FCustomPaper: TPGtkPaperSize;
FSettings: TPGtkPrintSettings;
FJob: TPGtkPrintJob;
FSurf: TPcairo_surface_t;
FGTKPapers: TStrings;
FTerminated: Boolean;
protected
procedure ClearGTKPapers;
public
constructor Create(const AName: String; ADevice: NativeInt); reintroduce;
destructor Destroy; override;
procedure Init; override;
procedure Abort; override;
procedure BeginDoc; override;
procedure BeginPage; override;
procedure BeginRAWDoc; override;
procedure EndDoc; override;
procedure EndPage; override;
procedure EndRAWDoc; override;
procedure WriteRAWDoc(const buf: AnsiString); override;
procedure SetViewParams(APaperSize: Integer;
APaperWidth, APaperHeight: Extended;
AOrientation: TPrinterOrientation); override;
procedure SetPrintParams(APaperSize: Integer;
APaperWidth, APaperHeight: Extended; AOrientation: TPrinterOrientation;
ABin, ADuplex, ACopies: Integer); override;
procedure PropertiesDlg; override;
function ShowPrintDialog: Boolean; override;
function UpdateFromDeviceCaps: Boolean;
function UpdateToDeviceCaps(Params: TfrxDevUpdateTypes): Boolean;
procedure UpdatePageSettings;
end;
TfrxPrinters = class(TfrxCustomPrinters)
protected
function GetDefaultPrinter: String; override;
public
constructor Create;
destructor Destroy; override;
procedure FillPrinters; override;
end;
function ActualfrxPrinterClass: TfrxCustomPrintersClass;
implementation
uses
FMX.frxUtils, FMX.frxRes, FMX.frxFMX, System.Math.Vectors, System.Math,
System.AnsiStrings, FMX.Canvas.Linux, FMX.frxCanvas.Linux, FMX.frxClass, FMX.Forms, System.Diagnostics;
type
TPaperInfo = { packed } record
Typ: Integer;
Name: String;
X, Y: Integer;
end;
TGList = record
pData: Pointer;
pNext: ^TGList;
pPrev: ^TGList;
end;
TPGList = ^TGList;
TPGtkWidget = Pointer;
TPGtkPrintUnixDialog = Pointer;
TGConnectFlags = (G_CONNECT_AFTER, G_CONNECT_SWAPPED);
TGtkPageOrientation = (GTK_PAGE_ORIENTATION_PORTRAIT,
GTK_PAGE_ORIENTATION_LANDSCAPE, GTK_PAGE_ORIENTATION_REVERSE_PORTRAIT,
GTK_PAGE_ORIENTATION_REVERSE_LANDSCAPE);
TGtkPrintDuplex = (GTK_PRINT_DUPLEX_SIMPLEX, GTK_PRINT_DUPLEX_HORIZONTAL,
GTK_PRINT_DUPLEX_VERTICAL);
TGtkUnit = (GTK_UNIT_NONE, GTK_UNIT_POINTS, GTK_UNIT_INCH, GTK_UNIT_MM);
TCairo_surface_type = (
CAIRO_SURFACE_TYPE_IMAGE, CAIRO_SURFACE_TYPE_PDF, CAIRO_SURFACE_TYPE_PS,
CAIRO_SURFACE_TYPE_XLIB, CAIRO_SURFACE_TYPE_XCB, CAIRO_SURFACE_TYPE_GLITZ,
CAIRO_SURFACE_TYPE_QUARTZ, CAIRO_SURFACE_TYPE_WIN32,
CAIRO_SURFACE_TYPE_BEOS, CAIRO_SURFACE_TYPE_DIRECTFB,
CAIRO_SURFACE_TYPE_SVG, CAIRO_SURFACE_TYPE_OS2,
CAIRO_SURFACE_TYPE_WIN32_PRINTING, CAIRO_SURFACE_TYPE_QUARTZ_IMAGE,
CAIRO_SURFACE_TYPE_SCRIPT, CAIRO_SURFACE_TYPE_QT,
CAIRO_SURFACE_TYPE_RECORDING, CAIRO_SURFACE_TYPE_VG, CAIRO_SURFACE_TYPE_GL,
CAIRO_SURFACE_TYPE_DRM, CAIRO_SURFACE_TYPE_TEE, CAIRO_SURFACE_TYPE_XML,
CAIRO_SURFACE_TYPE_SKIA, CAIRO_SURFACE_TYPE_SUBSURFACE);
TPGtkPrintJobCompleteFunc = procedure(print_job: TPGtkPrintJob;
user_data: Pointer; error: Pointer); cdecl;
TPGDestroyNotify = procedure(pData: Pointer); cdecl;
TPGtkPrinterFunc = function(printer: TPGtkPrinter; pData: Pointer): LongBool; cdecl;
TPDetails_acquiredFunc = procedure(printer: TpGtkPrinter; success: LongBool; user_data: Pointer); cdecl;
Tfn_g_free = procedure(prt: Pointer); cdecl;
Tfn_g_list_free = procedure(prt: Pointer); cdecl;
Tfn_cairo_surface_finish = procedure(surface: TPcairo_surface_t); cdecl;
Tfn_cairo_create = function(target: TPcairo_surface_t): TPcairo_t; cdecl;
Tfn_cairo_destroy = procedure(cr: TPcairo_t); cdecl;
Tfn_cairo_show_page = procedure(cr: TPcairo_t); cdecl;
Tfn_cairo_surface_get_type = function(surface: TPcairo_surface_t): TCairo_surface_type; cdecl;
Tfn_cairo_ps_surface_set_size = procedure(surface: TPcairo_surface_t; width_in_points: double; height_in_points: double); cdecl;
Tfn_cairo_ps_surface_dsc_begin_setup = procedure(surface: TPcairo_surface_t); cdecl;
Tfn_cairo_ps_surface_dsc_begin_page_setup = procedure(surface: TPcairo_surface_t); cdecl;
Tfn_cairo_ps_surface_dsc_comment = procedure(surface: TPcairo_surface_t; const comment: PAnsiChar); cdecl;
Tfn_cairo_pdf_surface_set_size = procedure(surface: TPcairo_surface_t; width_in_points: double; height_in_points: double); cdecl;
Tfn_g_signal_connect_data = function(instance: Pointer; const detailed_signal: PAnsiChar; c_handler: Pointer; data: Pointer; destroy_data: Pointer; connect_flags: TGConnectFlags): UInt32; cdecl;
Tfn_g_object_unref = procedure(obj: Pointer); cdecl;
Tfn_g_object_ref = function(obj: Pointer): Pointer; cdecl;
Tfn_gtk_print_job_new = function(const title: PAnsiChar; Printer: TPGtkPrinter; settings: TPGtkPrintSettings; page_setup: TPGtkPageSetup): TPGtkPrintJob; cdecl;
Tfn_gtk_print_job_get_surface = function(job: TPGtkPrintJob; error: Pointer): TPcairo_surface_t; cdecl;
Tfn_gtk_print_job_send = procedure(job: TPGtkPrintJob; callback: TPGtkPrintJobCompleteFunc; user_data: Pointer; dnotify: TPGDestroyNotify); cdecl;
Tfn_gtk_printer_get_default_page_size = function(Printer: TPGtkPrinter): TPGtkPageSetup; cdecl;
Tfn_gtk_print_job_get_settings = function(job: TPGtkPrintJob): TPGtkPrintSettings; cdecl;
Tfn_gtk_enumerate_printers = procedure(GtkPrinterFunc: TPGtkPrinterFunc; data: Pointer; destroy: TPGDestroyNotify; wait: LongBool ); cdecl;
Tfn_gtk_printer_list_papers = function(printer: TPGtkPrinter): TPGList; cdecl;
Tfn_gtk_printer_has_details = function(printer: TPGtkPrinter): LongBool; cdecl;
Tfn_gtk_printer_request_details = procedure(printer: TPGtkPrinter); cdecl;
Tfn_gtk_printer_get_name = function(printer: TPGtkPrinter): PAnsiChar; cdecl;
Tfn_gtk_printer_is_default = function(printer: TPGtkPrinter): LongBool; cdecl;
// Tfn_gtk_print_context_get_page_setup = function(context: TPGtkPrintContext): TPGtkPageSetup;
Tfn_gtk_print_unix_dialog_new = function(const title: PAnsiChar; parent: TPGtkWidget): TPGtkPrintUnixDialog; cdecl;
Tfn_gtk_print_unix_dialog_set_page_setup = procedure(dialog: TPGtkPrintUnixDialog; page_setup: TPGtkPageSetup); cdecl;
Tfn_gtk_print_unix_dialog_get_page_setup = function(dialog: TPGtkPrintUnixDialog): TPGtkPageSetup; cdecl;
Tfn_gtk_print_unix_dialog_set_settings = procedure(dialog: TPGtkPrintUnixDialog; settings: TPGtkPrintSettings); cdecl;
Tfn_gtk_print_unix_dialog_get_settings = function(dialog: TPGtkPrintUnixDialog): TPGtkPrintSettings; cdecl;
Tfn_gtk_dialog_run = function(dialog: TPGtkPrintUnixDialog): Integer; cdecl;
{ page_setup }
Tfn_gtk_page_setup_new = function: TPGtkPageSetup; cdecl;
Tfn_gtk_page_setup_copy = function(other: TPGtkPageSetup): TPGtkPageSetup; cdecl;
Tfn_gtk_page_setup_get_paper_size = function(setup: TPGtkPageSetup): TPGtkPaperSize; cdecl;
Tfn_gtk_page_setup_set_paper_size = procedure(setup: TPGtkPageSetup; size: TPGtkPaperSize); cdecl;
Tfn_gtk_page_setup_get_orientation = function(setup: TPGtkPageSetup): TGtkPageOrientation; cdecl;
Tfn_gtk_page_setup_set_orientation = procedure(setup: TPGtkPageSetup; orientation: TGtkPageOrientation); cdecl;
Tfn_gtk_page_setup_get_top_margin = function(setup: TPGtkPageSetup; units: TGtkUnit): double; cdecl;
Tfn_gtk_page_setup_set_top_margin = procedure(setup: TPGtkPageSetup; margin: double; units: TGtkUnit); cdecl;
Tfn_gtk_page_setup_get_bottom_margin = function(setup: TPGtkPageSetup; units: TGtkUnit): double; cdecl;
Tfn_gtk_page_setup_set_bottom_margin = procedure(setup: TPGtkPageSetup; margin: double; units: TGtkUnit); cdecl;
Tfn_gtk_page_setup_get_left_margin = function(setup: TPGtkPageSetup; units: TGtkUnit): double; cdecl;
Tfn_gtk_page_setup_set_left_margin = procedure(setup: TPGtkPageSetup; margin: double; units: TGtkUnit); cdecl;
Tfn_gtk_page_setup_get_right_margin = function(setup: TPGtkPageSetup; units: TGtkUnit): double; cdecl;
Tfn_gtk_page_setup_set_right_margin = procedure(setup: TPGtkPageSetup; margin: double; units: TGtkUnit); cdecl;
Tfn_gtk_page_setup_get_paper_width = function(setup: TPGtkPageSetup; units: TGtkUnit): double; cdecl;
Tfn_gtk_page_setup_get_paper_height = function(setup: TPGtkPageSetup; units: TGtkUnit): double; cdecl;
Tfn_gtk_page_setup_get_page_width = function(setup: TPGtkPageSetup; units: TGtkUnit): double; cdecl;
Tfn_gtk_page_setup_get_page_height = function(setup: TPGtkPageSetup; units: TGtkUnit): double; cdecl;
{ paper_size }
Tfn_gtk_paper_size_new = function(const Name: PAnsiChar): TPGtkPaperSize; cdecl;
Tfn_gtk_paper_size_new_from_ppd = function(const ppd_name: PAnsiChar; const ppd_display_name: PAnsiChar; width: double; height: double) : TPGtkPaperSize; cdecl;
Tfn_gtk_paper_size_new_from_ipp = function(const ipp_name: PAnsiChar; width: double; height: double): TPGtkPaperSize; cdecl;
Tfn_gtk_paper_size_new_custom = function(const Name: PAnsiChar; const display_name: PAnsiChar; width: double; height: double; units: TGtkUnit) : TPGtkPaperSize; cdecl;
Tfn_gtk_paper_size_copy = function(other: TPGtkPaperSize) : TPGtkPaperSize; cdecl;
Tfn_gtk_paper_size_free = procedure(size: TPGtkPaperSize); cdecl;
Tfn_gtk_paper_size_is_equal = function(size1: TPGtkPaperSize; size2: TPGtkPaperSize): LongBool; cdecl;
// GList *Tfn_gtk_paper_size_get_paper_sizes (gboolean include_custom);
Tfn_gtk_paper_size_get_name = function(size: TPGtkPaperSize): PAnsiChar; cdecl;
Tfn_gtk_paper_size_get_display_name = function(size: TPGtkPaperSize): PAnsiChar; cdecl;
Tfn_gtk_paper_size_get_ppd_name = function(size: TPGtkPaperSize): PAnsiChar; cdecl;
Tfn_gtk_paper_size_get_width = function(size: TPGtkPaperSize; units: TGtkUnit): double; cdecl;
Tfn_gtk_paper_size_get_height = function(size: TPGtkPaperSize; units: TGtkUnit): double; cdecl;
Tfn_gtk_paper_size_is_custom = function(size: TPGtkPaperSize): LongBool; cdecl;
Tfn_gtk_paper_size_is_ipp = function(size: TPGtkPaperSize): LongBool; cdecl;
Tfn_gtk_paper_size_set_size = procedure(size: TPGtkPaperSize; width: double; height: double; units: TGtkUnit); cdecl;
Tfn_gtk_paper_size_get_default_top_margin = function(size: TPGtkPaperSize; units: TGtkUnit): double; cdecl;
Tfn_gtk_paper_size_get_default_bottom_margin = function(size: TPGtkPaperSize; units: TGtkUnit): double; cdecl;
Tfn_gtk_paper_size_get_default_left_margin = function(size: TPGtkPaperSize; units: TGtkUnit): double; cdecl;
Tfn_gtk_paper_size_get_default_right_margin = function(size: TPGtkPaperSize; units: TGtkUnit): double; cdecl;
Tfn_gtk_paper_size_get_default = function: PAnsiChar; cdecl;
{ print_settings }
Tfn_gtk_print_settings_new = function: TPGtkPrintSettings; cdecl;
Tfn_gtk_print_settings_get_printer = function(settings: TPGtkPrintSettings): PAnsiChar; cdecl;
Tfn_gtk_print_settings_set_printer = procedure(settings: TPGtkPrintSettings; const Printer: PAnsiChar); cdecl;
Tfn_gtk_print_settings_get_orientation = function(settings: TPGtkPrintSettings): TGtkPageOrientation; cdecl;
Tfn_gtk_print_settings_set_orientation = procedure(settings: TPGtkPrintSettings; orientation: TGtkPageOrientation); cdecl;
Tfn_gtk_print_settings_get_paper_size = function(settings: TPGtkPrintSettings): TPGtkPaperSize; cdecl;
Tfn_gtk_print_settings_set_paper_size = procedure(settings: TPGtkPrintSettings; paper_size: TPGtkPaperSize); cdecl;
Tfn_gtk_print_settings_get_paper_width = function(settings: TPGtkPrintSettings; units: TGtkUnit): double; cdecl;
Tfn_gtk_print_settings_set_paper_width = procedure(settings: TPGtkPrintSettings; width: double; units: TGtkUnit); cdecl;
Tfn_gtk_print_settings_get_paper_height = function(settings: TPGtkPrintSettings; units: TGtkUnit): double; cdecl;
Tfn_gtk_print_settings_set_paper_height = procedure(settings: TPGtkPrintSettings; height: double; units: TGtkUnit); cdecl;
Tfn_gtk_print_settings_get_collate = function(settings: TPGtkPrintSettings): LongBool; cdecl;
Tfn_gtk_print_settings_set_collate = procedure(settings: TPGtkPrintSettings; collate: LongBool); cdecl;
Tfn_gtk_print_settings_get_duplex = function(settings: TPGtkPrintSettings): TGtkPrintDuplex; cdecl;
Tfn_gtk_print_settings_set_duplex = procedure(settings: TPGtkPrintSettings; duplex: TGtkPrintDuplex); cdecl;
Tfn_gtk_print_settings_get_n_copies = function(settings: TPGtkPrintSettings): Integer; cdecl;
Tfn_gtk_print_settings_set_n_copies = procedure(settings: TPGtkPrintSettings; num_copies: Integer); cdecl;
Tfn_gtk_print_settings_get_resolution_x = function(settings: TPGtkPrintSettings): Integer; cdecl;
Tfn_gtk_print_settings_get_resolution_y = function(settings: TPGtkPrintSettings): Integer; cdecl;
Tfn_gtk_print_settings_get_default_source = function(settings: TPGtkPrintSettings): PAnsiChar; cdecl;
Tfn_gtk_print_settings_set_default_source = procedure(settings: TPGtkPrintSettings; const default_source: PAnsiChar); cdecl;
Tfn_gtk_print_settings_get_media_type = function(settings: TPGtkPrintSettings): PAnsiChar; cdecl;
Tfn_gtk_print_settings_set_media_type = procedure(settings: TPGtkPrintSettings; const media_type: PAnsiChar); cdecl;
Tfn_gtk_print_settings_get_output_bin = function(settings: TPGtkPrintSettings): PAnsiChar; cdecl;
Tfn_gtk_print_settings_set_output_bin = procedure(settings: TPGtkPrintSettings; output_bin: PAnsiChar); cdecl;
const
PAPERCOUNT = 66;
PaperInfo: array[0..PAPERCOUNT - 1] of TPaperInfo = (
(Typ:1; Name: ''; X:2159; Y:2794),
(Typ:2; Name: ''; X:2159; Y:2794),
(Typ:3; Name: ''; X:2794; Y:4318),
(Typ:4; Name: ''; X:4318; Y:2794),
(Typ:5; Name: ''; X:2159; Y:3556),
(Typ:6; Name: ''; X:1397; Y:2159),
(Typ:7; Name: ''; X:1842; Y:2667),
(Typ:8; Name: ''; X:2970; Y:4200),
(Typ:9; Name: ''; X:2100; Y:2970),
(Typ:10; Name: ''; X:2100; Y:2970),
(Typ:11; Name: ''; X:1480; Y:2100),
(Typ:12; Name: ''; X:2500; Y:3540),
(Typ:13; Name: ''; X:1820; Y:2570),
(Typ:14; Name: ''; X:2159; Y:3302),
(Typ:15; Name: ''; X:2150; Y:2750),
(Typ:16; Name: ''; X:2540; Y:3556),
(Typ:17; Name: ''; X:2794; Y:4318),
(Typ:18; Name: ''; X:2159; Y:2794),
(Typ:19; Name: ''; X:984; Y:2254),
(Typ:20; Name: ''; X:1048; Y:2413),
(Typ:21; Name: ''; X:1143; Y:2635),
(Typ:22; Name: ''; X:1207; Y:2794),
(Typ:23; Name: ''; X:1270; Y:2921),
(Typ:24; Name: ''; X:4318; Y:5588),
(Typ:25; Name: ''; X:5588; Y:8636),
(Typ:26; Name: ''; X:8636; Y:11176),
(Typ:27; Name: ''; X:1100; Y:2200),
(Typ:28; Name: ''; X:1620; Y:2290),
(Typ:29; Name: ''; X:3240; Y:4580),
(Typ:30; Name: ''; X:2290; Y:3240),
(Typ:31; Name: ''; X:1140; Y:1620),
(Typ:32; Name: ''; X:1140; Y:2290),
(Typ:33; Name: ''; X:2500; Y:3530),
(Typ:34; Name: ''; X:1760; Y:2500),
(Typ:35; Name: ''; X:1760; Y:1250),
(Typ:36; Name: ''; X:1100; Y:2300),
(Typ:37; Name: ''; X:984; Y:1905),
(Typ:38; Name: ''; X:920; Y:1651),
(Typ:39; Name: ''; X:3778; Y:2794),
(Typ:40; Name: ''; X:2159; Y:3048),
(Typ:41; Name: ''; X:2159; Y:3302),
(Typ:42; Name: ''; X:2500; Y:3530),
(Typ:43; Name: ''; X:1000; Y:1480),
(Typ:44; Name: ''; X:2286; Y:2794),
(Typ:45; Name: ''; X:2540; Y:2794),
(Typ:46; Name: ''; X:3810; Y:2794),
(Typ:47; Name: ''; X:2200; Y:2200),
(Typ:50; Name: ''; X:2355; Y:3048),
(Typ:51; Name: ''; X:2355; Y:3810),
(Typ:52; Name: ''; X:2969; Y:4572),
(Typ:53; Name: ''; X:2354; Y:3223),
(Typ:54; Name: ''; X:2101; Y:2794),
(Typ:55; Name: ''; X:2100; Y:2970),
(Typ:56; Name: ''; X:2355; Y:3048),
(Typ:57; Name: ''; X:2270; Y:3560),
(Typ:58; Name: ''; X:3050; Y:4870),
(Typ:59; Name: ''; X:2159; Y:3223),
(Typ:60; Name: ''; X:2100; Y:3300),
(Typ:61; Name: ''; X:1480; Y:2100),
(Typ:62; Name: ''; X:1820; Y:2570),
(Typ:63; Name: ''; X:3220; Y:4450),
(Typ:64; Name: ''; X:1740; Y:2350),
(Typ:65; Name: ''; X:2010; Y:2760),
(Typ:66; Name: ''; X:4200; Y:5940),
(Typ:67; Name: ''; X:2970; Y:4200),
(Typ:68; Name: ''; X:3220; Y:4450));
type
TPaperInfoLCL = {packed} record
Name: String;
W, H: Extended;
end;
TfrxInfoLinkData = packed record
Num : Integer;
Name: AnsiString;
end;
const
LCLPaperCount = 119;
CmPrIn = 2.54;
PtPrCm = frxDefPPIUnits/CmPrIn;
PtPrmm = PtPrCm/10;
LCLPaperInfo : array[0..LCLPAPERCOUNT-1] of TPaperInfoLCL =
((Name: 'Letter 8 1/2 x 11 in'; W: 8.5 * frxDefPPIUnits; H: 11 * frxDefPPIUnits),
(Name: 'Letter Small 8 1/2 x 11 in'; W: 8.5 * frxDefPPIUnits; H: 11 * frxDefPPIUnits),
(Name: 'Tabloid 11 x 17 in'; W: 11 * frxDefPPIUnits; H: 17 * frxDefPPIUnits),
(Name: 'Ledger 17 x 11 in'; W: 17 * frxDefPPIUnits; H: 11 * frxDefPPIUnits),
(Name: 'Legal 8 1/2 x 14 in'; W: 8.5 * frxDefPPIUnits; H: 14 * frxDefPPIUnits),
(Name: 'Statement 5 1/2 x 8 1/2 in'; W: 5.5 * frxDefPPIUnits; H: 8.5 * frxDefPPIUnits),
(Name: 'Executive 7 1/4 x 10 1/2 in'; W: 7.25 * frxDefPPIUnits; H: 10.5 * frxDefPPIUnits),
(Name: 'A3 297 x 420 mm'; W: 297 * PtPrmm; H: 420 * PtPrmm),
(Name: 'A4 210 x 297 mm'; W: 210 * PtPrmm; H: 297 * PtPrmm),
(Name: 'A4 Small 210 x 297 mm'; W: 210 * PtPrmm; H: 297 * PtPrmm),
(Name: 'A5 148 x 210 mm'; W: 148 * PtPrmm; H: 210 * PtPrmm),
(Name: 'B4 (JIS) 250 x 354 mm'; W: 250 * PtPrmm; H: 354 * PtPrmm),
(Name: 'B5 (JIS) 182 x 257 mm'; W: 182 * PtPrmm; H: 257 * PtPrmm),
(Name: 'Folio 8 1/2 x 13 in'; W: 8.5 * frxDefPPIUnits; H: 13 * frxDefPPIUnits),
(Name: 'Quarto 215 x 275 mm'; W: 215 * PtPrmm; H: 275 * PtPrmm),
(Name: '10x14 in'; W: 10 * frxDefPPIUnits; H: 14 * frxDefPPIUnits),
(Name: '11x17 in'; W: 11 * frxDefPPIUnits; H: 17 * frxDefPPIUnits),
(Name: 'Note 8 1/2 x 11 in'; W: 8.5 * frxDefPPIUnits; H: 11 * frxDefPPIUnits),
(Name: 'Envelope #9 3 7/8 x 8 7/8'; W: 3 * 7 / 8 * frxDefPPIUnits; H: 8 * 7 / 8 * frxDefPPIUnits),
(Name: 'Envelope #10 4 1/8 x 9 1/2'; W: 3 * 1 / 8 * frxDefPPIUnits; H: 9.5 * frxDefPPIUnits),
(Name: 'Envelope #11 4 1/2 x 10 3/8'; W: 4.5 * frxDefPPIUnits; H: 10 * 3 / 8 * frxDefPPIUnits),
(Name: 'Envelope #12 4 3/4 x 11'; W: 4.75 * frxDefPPIUnits; H: 11 * frxDefPPIUnits),
(Name: 'Envelope #14 5 x 11 1/2'; W: 5 * frxDefPPIUnits; H: 11.5 * frxDefPPIUnits),
(Name: 'C size sheet 17 x 22 in'; W: 17 * frxDefPPIUnits; H: 22 * frxDefPPIUnits),
(Name: 'D size sheet 22 x 34 in'; W: 22 * frxDefPPIUnits; H: 34 * frxDefPPIUnits),
(Name: 'E size sheet 34 x 44 in'; W: 34 * frxDefPPIUnits; H: 44 * frxDefPPIUnits),
(Name: 'Envelope DL 110 x 220mm'; W: 110 * PtPrmm; H: 220 * PtPrmm),
(Name: 'Envelope C5 162 x 229 mm'; W: 162 * PtPrmm; H: 229 * PtPrmm),
(Name: 'Envelope C3 324 x 458 mm'; W: 324 * PtPrmm; H: 458 * PtPrmm),
(Name: 'Envelope C4 229 x 324 mm'; W: 229 * PtPrmm; H: 324 * PtPrmm),
(Name: 'Envelope C6 114 x 162 mm'; W: 114 * PtPrmm; H: 162 * PtPrmm),
(Name: 'Envelope C65 114 x 229 mm'; W: 114 * PtPrmm; H: 229 * PtPrmm),
(Name: 'Envelope B4 250 x 353 mm'; W: 250 * PtPrmm; H: 353 * PtPrmm),
(Name: 'Envelope B5 176 x 250 mm'; W: 176 * PtPrmm; H: 250 * PtPrmm),
(Name: 'Envelope B6 176 x 125 mm'; W: 176 * PtPrmm; H: 125 * PtPrmm),
(Name: 'Envelope 110 x 230 mm'; W: 110 * PtPrmm; H: 230 * PtPrmm),
(Name: 'Envelope Monarch 3 7/8 x 7 1/2 in'; W: 3 * 7 / 8 * frxDefPPIUnits; H: 7.5 * frxDefPPIUnits),
(Name: '6 34 Envelope 3 5/8 x 6 1/2 in'; W: 3 * 5 / 8 * frxDefPPIUnits; H: 6.5 * frxDefPPIUnits),
(Name: 'US Std Fanfold 14 7/8 x 11 in'; W: 14 * 7 / 8 * frxDefPPIUnits; H: 11 * frxDefPPIUnits),
(Name: 'German Std Fanfold 8 1/2 x 12 in'; W: 8.5 * frxDefPPIUnits; H: 12 * frxDefPPIUnits),
(Name: 'German Legal Fanfold 8 1/2 x 13 in'; W: 8.5 * frxDefPPIUnits; H: 13 * frxDefPPIUnits),
(Name: 'B4 (ISO) 250 x 353 mm'; W: 250 * PtPrmm; H: 353 * PtPrmm),
(Name: 'Japanese Postcard 100 x 148 mm'; W: 100 * PtPrmm; H: 148 * PtPrmm),
(Name: '9 x 11 in'; W: 9 * frxDefPPIUnits; H: 11 * frxDefPPIUnits),
(Name: '10 x 11 in'; W: 10 * frxDefPPIUnits; H: 11 * frxDefPPIUnits),
(Name: '15 x 11 in'; W: 15 * frxDefPPIUnits; H: 11 * frxDefPPIUnits),
(Name: 'Envelope Invite 220 x 220 mm'; W: 220 * PtPrmm; H: 220 * PtPrmm),
(Name: 'RESERVED--DO NOT USE'; W: 0; H: 0),
(Name: 'RESERVED--DO NOT USE'; W: 0; H: 0),
(Name: 'Letter Extra 9 \275 x 12 in'; W: 9.275 * frxDefPPIUnits; H: 12 * frxDefPPIUnits),
(Name: 'Legal Extra 9 \275 x 15 in'; W: 9.275 * frxDefPPIUnits; H: 15 * frxDefPPIUnits),
(Name: 'Tabloid Extra 11.69 x 18 in'; W: 11.69 * frxDefPPIUnits; H: 18 * frxDefPPIUnits),
(Name: 'A4 Extra 9.27 x 12.69 in'; W: 9.27 * frxDefPPIUnits; H: 12.69 * frxDefPPIUnits),
(Name: 'Letter Transverse 8 \275 x 11 in'; W: 8.275 * frxDefPPIUnits; H: 11 * frxDefPPIUnits),
(Name: 'A4 Transverse 210 x 297 mm'; W: 210 * PtPrmm; H: 297 * PtPrmm),
(Name: 'Letter Extra Transverse 9\275 x 12 in'; W: 9.275 * frxDefPPIUnits; H: 12 * frxDefPPIUnits),
(Name: 'SuperASuperAA4 227 x 356 mm'; W: 227 * PtPrmm; H: 356 * PtPrmm),
(Name: 'SuperBSuperBA3 305 x 487 mm'; W: 305 * PtPrmm; H: 487 * PtPrmm),
(Name: 'Letter Plus 8.5 x 12.69 in'; W: 8.5 * frxDefPPIUnits; H: 12.69 * frxDefPPIUnits),
(Name: 'A4 Plus 210 x 330 mm'; W: 210 * PtPrmm; H: 330 * PtPrmm),
(Name: 'A5 Transverse 148 x 210 mm'; W: 148 * PtPrmm; H: 210 * PtPrmm),
(Name: 'B5 (JIS) Transverse 182 x 257 mm'; W: 182 * PtPrmm; H: 257 * PtPrmm),
(Name: 'A3 Extra 322 x 445 mm'; W: 322 * PtPrmm; H: 445 * PtPrmm),
(Name: 'A5 Extra 174 x 235 mm'; W: 174 * PtPrmm; H: 235 * PtPrmm),
(Name: 'B5 (ISO) Extra 201 x 276 mm'; W: 201 * PtPrmm; H: 276 * PtPrmm),
(Name: 'A2 420 x 594 mm'; W: 420 * PtPrmm; H: 594 * PtPrmm),
(Name: 'A3 Transverse 297 x 420 mm'; W: 297 * PtPrmm; H: 420 * PtPrmm),
(Name: 'A3 Extra Transverse 322 x 445 mm'; W: 322 * PtPrmm; H: 445 * PtPrmm),
(Name: 'Japanese Double Postcard 200 x 148 mm'; W: 200 * PtPrmm; H: 148 * PtPrmm),
(Name: 'A6 105 x 148 mm'; W: 105 * PtPrmm; H: 148 * PtPrmm),
(Name: 'Japanese Envelope Kaku #2'; W: 0; H: 0),
(Name: 'Japanese Envelope Kaku #3'; W: 0; H: 0),
(Name: 'Japanese Envelope Chou #3'; W: 0; H: 0),
(Name: 'Japanese Envelope Chou #4'; W: 0; H: 0),
(Name: 'Letter Rotated 11 x 8 1/2 11 in'; W: 11 * frxDefPPIUnits; H: 8.5 * frxDefPPIUnits),
(Name: 'A3 Rotated 420 x 297 mm'; W: 420 * PtPrmm; H: 297 * PtPrmm),
(Name: 'A4 Rotated 297 x 210 mm'; W: 297 * PtPrmm; H: 210 * PtPrmm),
(Name: 'A5 Rotated 210 x 148 mm'; W: 210 * PtPrmm; H: 148 * PtPrmm),
(Name: 'B4 (JIS) Rotated 364 x 257 mm'; W: 364 * PtPrmm; H: 257 * PtPrmm),
(Name: 'B5 (JIS) Rotated 257 x 182 mm'; W: 257 * PtPrmm; H: 182 * PtPrmm),
(Name: 'Japanese Postcard Rotated 148 x 100 mm'; W: 148 * PtPrmm; H: 100 * PtPrmm),
(Name: 'Double Japanese Postcard Rotated 148 x 200 mm'; W: 148 * PtPrmm; H: 200 * PtPrmm),
(Name: 'A6 Rotated 148 x 105 mm'; W: 148 * PtPrmm; H: 105 * PtPrmm),
(Name: 'Japanese Envelope Kaku #2 Rotated'; W: 0; H: 0),
(Name: 'Japanese Envelope Kaku #3 Rotated'; W: 0; H: 0),
(Name: 'Japanese Envelope Chou #3 Rotated'; W: 0; H: 0),
(Name: 'Japanese Envelope Chou #4 Rotated'; W: 0; H: 0),
(Name: 'B6 (JIS) 128 x 182 mm'; W: 128 * PtPrmm; H: 182 * PtPrmm),
(Name: 'B6 (JIS) Rotated 182 x 128 mm'; W: 182 * PtPrmm; H: 128 * PtPrmm),
(Name: '12 x 11 in'; W: 12 * frxDefPPIUnits; H: 11 * frxDefPPIUnits),
(Name: 'Japanese Envelope You #4'; W: 0; H: 0),
(Name: 'Japanese Envelope You #4 Rotated'; W: 0; H: 0),
(Name: 'PRC 16K 146 x 215 mm'; W: 146 * PtPrmm; H: 215 * PtPrmm),
(Name: 'PRC 32K 97 x 151 mm'; W: 97 * PtPrmm; H: 151 * PtPrmm),
(Name: 'PRC 32K(Big) 97 x 151 mm'; W: 97 * PtPrmm; H: 151 * PtPrmm),
(Name: 'PRC Envelope #1 102 x 165 mm'; W: 102 * PtPrmm; H: 165 * PtPrmm),
(Name: 'PRC Envelope #2 102 x 176 mm'; W: 102 * PtPrmm; H: 176 * PtPrmm),
(Name: 'PRC Envelope #3 125 x 176 mm'; W: 125 * PtPrmm; H: 176 * PtPrmm),
(Name: 'PRC Envelope #4 110 x 208 mm'; W: 110 * PtPrmm; H: 208 * PtPrmm),
(Name: 'PRC Envelope #5 110 x 220 mm'; W: 110 * PtPrmm; H: 220 * PtPrmm),
(Name: 'PRC Envelope #6 120 x 230 mm'; W: 120 * PtPrmm; H: 230 * PtPrmm),
(Name: 'PRC Envelope #7 160 x 230 mm'; W: 160 * PtPrmm; H: 230 * PtPrmm),
(Name: 'PRC Envelope #8 120 x 309 mm'; W: 120 * PtPrmm; H: 309 * PtPrmm),
(Name: 'PRC Envelope #9 229 x 324 mm'; W: 229 * PtPrmm; H: 324 * PtPrmm),
(Name: 'PRC Envelope #10 324 x 458 mm'; W: 324 * PtPrmm; H: 458 * PtPrmm),
(Name: 'PRC 16K Rotated 215 x 146 mm'; W: 215 * PtPrmm; H: 146 * PtPrmm),
(Name: 'PRC 32K Rotated 151 x 97 mm'; W: 151 * PtPrmm; H: 97 * PtPrmm),
(Name: 'PRC 32K(Big) Rotated 151 x 97 mm'; W: 151 * PtPrmm; H: 97 * PtPrmm),
(Name: 'PRC Envelope #1 Rotated 165 x 102 mm'; W: 165 * PtPrmm; H: 102 * PtPrmm),
(Name: 'PRC Envelope #2 Rotated 176 x 102 mm'; W: 176 * PtPrmm; H: 102 * PtPrmm),
(Name: 'PRC Envelope #3 Rotated 176 x 125 mm'; W: 176 * PtPrmm; H: 125 * PtPrmm),
(Name: 'PRC Envelope #4 Rotated 208 x 110 mm'; W: 208 * PtPrmm; H: 110 * PtPrmm),
(Name: 'PRC Envelope #5 Rotated 220 x 110 mm'; W: 220 * PtPrmm; H: 110 * PtPrmm),
(Name: 'PRC Envelope #6 Rotated 230 x 120 mm'; W: 230 * PtPrmm; H: 120 * PtPrmm),
(Name: 'PRC Envelope #7 Rotated 230 x 160 mm'; W: 230 * PtPrmm; H: 160 * PtPrmm),
(Name: 'PRC Envelope #8 Rotated 309 x 120 mm'; W: 309 * PtPrmm; H: 120 * PtPrmm),
(Name: 'PRC Envelope #9 Rotated 324 x 229 mm'; W: 324 * PtPrmm; H: 229 * PtPrmm),
(Name: 'PRC Envelope #10 Rotated 458 x 324 mm'; W: 458 * PtPrmm; H: 324 * PtPrmm),
(Name: 'Custom size'; W: 0; H: 0));
DefGtkPapersCount = 63;
GTKPapers: array[0 .. DefGtkPapersCount - 1] of TfrxInfoLinkData = (
(Num: DMPAPER_USER; Name: ''),
(Num: FRX_DMPAPER_LETTER_TRANSVERSE; Name: 'na_letter'),
(Num: FRX_DMPAPER_LETTER; Name: 'na_letter'),
(Num: FRX_DMPAPER_LETTERSMALL; Name: 'na_letter'),
(Num: FRX_DMPAPER_TABLOID; Name: 'na_ledger'),
(Num: FRX_DMPAPER_LEDGER; Name: 'na_ledger'),
(Num: FRX_DMPAPER_LEGAL; Name: 'na_legal'),
(Num: FRX_DMPAPER_STATEMENT; Name: 'na_invoice'),
(Num: FRX_DMPAPER_EXECUTIVE; Name: 'na_executive'),
(Num: FRX_DMPAPER_A3; Name: 'iso_a3'),
(Num: FRX_DMPAPER_A3_TRANSVERSE; Name: 'iso_a3'),
(Num: FRX_DMPAPER_A4; Name: 'iso_a4'),
(Num: FRX_DMPAPER_A4SMALL; Name: 'iso_a4'),
(Num: FRX_DMPAPER_A4_TRANSVERSE; Name: 'iso_a4'),
(Num: FRX_DMPAPER_A5; Name: 'iso_a5'),
(Num: FRX_DMPAPER_A5_TRANSVERSE; Name: 'iso_a5'),
(Num: FRX_DMPAPER_B4; Name: 'jis_b4'),
(Num: FRX_DMPAPER_B5; Name: 'jis_b5'),
(Num: FRX_DMPAPER_B5_TRANSVERSE; Name: 'jis_b5'),
(Num: FRX_DMPAPER_QUARTO; Name: 'na_quarto'),
(Num: FRX_DMPAPER_10X14; Name: 'na_10x14'),
(Num: FRX_DMPAPER_11X17; Name: 'na_ledger'),
(Num: FRX_DMPAPER_NOTE; Name: 'na_letter'),
(Num: FRX_DMPAPER_ENV_9; Name: 'na_number-9'),
(Num: FRX_DMPAPER_ENV_10; Name: 'na_number-10'),
(Num: FRX_DMPAPER_ENV_11; Name: 'na_number-11'),
(Num: FRX_DMPAPER_ENV_12; Name: 'na_number-12'),
(Num: FRX_DMPAPER_ENV_14; Name: 'na_number-14'),
(Num: FRX_DMPAPER_CSHEET; Name: 'na_c'),
(Num: FRX_DMPAPER_DSHEET; Name: 'na_d'),
(Num: FRX_DMPAPER_ESHEET; Name: 'na_e'),
(Num: FRX_DMPAPER_ENV_DL; Name: 'iso_dl'),
(Num: FRX_DMPAPER_ENV_C5; Name: 'iso_c5'),
(Num: FRX_DMPAPER_ENV_C3; Name: 'iso_c3'),
(Num: FRX_DMPAPER_ENV_C4; Name: 'iso_c4'),
(Num: FRX_DMPAPER_ENV_C6; Name: 'iso_c6'),
(Num: FRX_DMPAPER_ENV_C65; Name: 'iso_c6c5'),
(Num: FRX_DMPAPER_ENV_B4; Name: 'iso_b4'),
(Num: FRX_DMPAPER_ENV_B5; Name: 'iso_b5'),
(Num: FRX_DMPAPER_ENV_B6; Name: 'iso_b6'),
(Num: FRX_DMPAPER_ENV_ITALY; Name: 'om_italian'),
(Num: FRX_DMPAPER_ENV_MONARCH; Name: 'na_monarch'),
(Num: FRX_DMPAPER_ENV_PERSONAL; Name: 'na_personal'),
(Num: FRX_DMPAPER_FANFOLD_US; Name: 'na_fanfold-us'),
(Num: FRX_DMPAPER_FANFOLD_STD_GERMAN; Name: 'na_fanfold-eur'),
(Num: FRX_DMPAPER_FANFOLD_LGL_GERMAN; Name: 'na_foolscap'),
(Num: FRX_DMPAPER_ISO_B4; Name: 'iso_b4'),
(Num: FRX_DMPAPER_JAPANESE_POSTCARD; Name: 'jpn_hagaki'),
(Num: FRX_DMPAPER_9X11; Name: 'na_9x11'),
(Num: FRX_DMPAPER_10X11; Name: 'na_10x11'),
(Num: FRX_DMPAPER_ENV_INVITE; Name: 'om_invite'),
(Num: FRX_DMPAPER_LETTER_EXTRA; Name: 'na_letter-extra'),
(Num: FRX_DMPAPER_LETTER_EXTRA_TRANSVERSE; Name: 'na_letter-extra'),
(Num: FRX_DMPAPER_LEGAL_EXTRA; Name: 'na_legal-extra'),
(Num: FRX_DMPAPER_TABLOID_EXTRA; Name: 'na_arch'),
(Num: FRX_DMPAPER_A4_EXTRA; Name: 'iso_a4-extra'),
(Num: FRX_DMPAPER_B_PLUS; Name: 'na_b-plus'),
(Num: FRX_DMPAPER_LETTER_PLUS; Name: 'na_letter-plus'),
(Num: FRX_DMPAPER_A3_EXTRA; Name: 'iso_a3-extra'),
(Num: FRX_DMPAPER_A3_EXTRA_TRANSVERSE; Name: 'iso_a3-extra'),
(Num: FRX_DMPAPER_A5_EXTRA; Name: 'iso_a5-extra'),
(Num: FRX_DMPAPER_B5_EXTRA; Name: 'iso_b5-extra'),
(Num: FRX_DMPAPER_A2; Name: 'iso_a2'));
DefGtkBinsCount = 13;
GTKBins: array[0 .. DefGtkBinsCount - 1] of TfrxInfoLinkData = (
(Num: FRX_DMBIN_AUTO; Name: 'auto'),
(Num: FRX_DMBIN_CASSETTE; Name: 'cassette'),
(Num: FRX_DMBIN_ENVELOPE; Name: 'envelope'),
(Num: FRX_DMBIN_ENVMANUAL; Name: 'envelope-manual'),
(Num: FRX_DMBIN_LOWER; Name: 'lower'),
(Num: FRX_DMBIN_MANUAL; Name: 'manual'),
(Num: FRX_DMBIN_MIDDLE; Name: 'middle'),
(Num: FRX_DMBIN_ONLYONE; Name: 'only-one'),
(Num: FRX_DMBIN_FORMSOURCE; Name: 'form-source'),
(Num: FRX_DMBIN_LARGECAPACITY; Name: 'large-capacity'),
(Num: FRX_DMBIN_LARGEFMT; Name: 'large-format'),
(Num: FRX_DMBIN_TRACTOR; Name: 'tractor'),
(Num: FRX_DMBIN_SMALLFMT; Name: 'small-format'));
var
cairo_surface_finish: Tfn_cairo_surface_finish;
cairo_create: Tfn_cairo_create;
cairo_destroy: Tfn_cairo_destroy;
cairo_show_page: Tfn_cairo_show_page;
cairo_surface_get_type: Tfn_cairo_surface_get_type;
cairo_ps_surface_set_size: Tfn_cairo_ps_surface_set_size;
cairo_ps_surface_dsc_begin_setup: Tfn_cairo_ps_surface_dsc_begin_setup;
cairo_ps_surface_dsc_begin_page_setup: Tfn_cairo_ps_surface_dsc_begin_page_setup;
cairo_ps_surface_dsc_comment: Tfn_cairo_ps_surface_dsc_comment;
cairo_pdf_surface_set_size: Tfn_cairo_pdf_surface_set_size;
g_free: Tfn_g_free;
g_list_free: Tfn_g_list_free;
g_signal_connect_data: Tfn_g_signal_connect_data;
g_object_unref: Tfn_g_object_unref;
g_object_ref: Tfn_g_object_ref;
gtk_print_job_new: Tfn_gtk_print_job_new;
gtk_print_job_get_surface: Tfn_gtk_print_job_get_surface;
gtk_print_job_send: Tfn_gtk_print_job_send;
gtk_printer_get_default_page_size: Tfn_gtk_printer_get_default_page_size;
gtk_print_job_get_settings: Tfn_gtk_print_job_get_settings;
gtk_enumerate_printers: Tfn_gtk_enumerate_printers;
gtk_printer_list_papers: Tfn_gtk_printer_list_papers;
gtk_printer_has_details: Tfn_gtk_printer_has_details;
gtk_printer_request_details: Tfn_gtk_printer_request_details;
gtk_printer_get_name: Tfn_gtk_printer_get_name;
gtk_printer_is_default: Tfn_gtk_printer_is_default;
gtk_print_unix_dialog_new: Tfn_gtk_print_unix_dialog_new;
gtk_print_unix_dialog_set_page_setup: Tfn_gtk_print_unix_dialog_set_page_setup;
gtk_print_unix_dialog_get_page_setup: Tfn_gtk_print_unix_dialog_get_page_setup;
gtk_print_unix_dialog_set_settings: Tfn_gtk_print_unix_dialog_set_settings;
gtk_print_unix_dialog_get_settings: Tfn_gtk_print_unix_dialog_get_settings;
gtk_dialog_run: Tfn_gtk_dialog_run;
{ page_setup }
gtk_page_setup_new: Tfn_gtk_page_setup_new;
gtk_page_setup_copy: Tfn_gtk_page_setup_copy;
gtk_page_setup_get_paper_size: Tfn_gtk_page_setup_get_paper_size;
gtk_page_setup_set_paper_size: Tfn_gtk_page_setup_set_paper_size;
gtk_page_setup_get_orientation: Tfn_gtk_page_setup_get_orientation;
gtk_page_setup_set_orientation: Tfn_gtk_page_setup_set_orientation;
gtk_page_setup_get_top_margin: Tfn_gtk_page_setup_get_top_margin;
gtk_page_setup_set_top_margin: Tfn_gtk_page_setup_set_top_margin;
gtk_page_setup_get_bottom_margin: Tfn_gtk_page_setup_get_bottom_margin;
gtk_page_setup_set_bottom_margin: Tfn_gtk_page_setup_set_bottom_margin;
gtk_page_setup_get_left_margin: Tfn_gtk_page_setup_get_left_margin;
gtk_page_setup_set_left_margin: Tfn_gtk_page_setup_set_left_margin;
gtk_page_setup_get_right_margin: Tfn_gtk_page_setup_get_right_margin;
gtk_page_setup_set_right_margin: Tfn_gtk_page_setup_set_right_margin;
gtk_page_setup_get_paper_width: Tfn_gtk_page_setup_get_paper_width;
gtk_page_setup_get_paper_height: Tfn_gtk_page_setup_get_paper_height;
gtk_page_setup_get_page_width: Tfn_gtk_page_setup_get_page_width;
gtk_page_setup_get_page_height: Tfn_gtk_page_setup_get_page_height;
{ paper_size }
gtk_paper_size_new: Tfn_gtk_paper_size_new;
gtk_paper_size_new_from_ppd: Tfn_gtk_paper_size_new_from_ppd;
gtk_paper_size_new_from_ipp: Tfn_gtk_paper_size_new_from_ipp;
gtk_paper_size_new_custom: Tfn_gtk_paper_size_new_custom;
gtk_paper_size_copy: Tfn_gtk_paper_size_copy;
gtk_paper_size_free: Tfn_gtk_paper_size_free;
gtk_paper_size_is_equal: Tfn_gtk_paper_size_is_equal;
//GList *Tfn_gtk_paper_size_get_paper_sizes (gboolean include_custom);
gtk_paper_size_get_name: Tfn_gtk_paper_size_get_name;
gtk_paper_size_get_display_name: Tfn_gtk_paper_size_get_display_name;
gtk_paper_size_get_ppd_name: Tfn_gtk_paper_size_get_ppd_name;
gtk_paper_size_get_width: Tfn_gtk_paper_size_get_width;
gtk_paper_size_get_height: Tfn_gtk_paper_size_get_height;
gtk_paper_size_is_custom: Tfn_gtk_paper_size_is_custom;
gtk_paper_size_is_ipp: Tfn_gtk_paper_size_is_ipp;
gtk_paper_size_set_size: Tfn_gtk_paper_size_set_size;
gtk_paper_size_get_default_top_margin: Tfn_gtk_paper_size_get_default_top_margin;
gtk_paper_size_get_default_bottom_margin: Tfn_gtk_paper_size_get_default_bottom_margin;
gtk_paper_size_get_default_left_margin: Tfn_gtk_paper_size_get_default_left_margin;
gtk_paper_size_get_default_right_margin: Tfn_gtk_paper_size_get_default_right_margin;
gtk_paper_size_get_default: Tfn_gtk_paper_size_get_default;
{ print_settings }
gtk_print_settings_new: Tfn_gtk_print_settings_new;
gtk_print_settings_get_printer: Tfn_gtk_print_settings_get_printer;
gtk_print_settings_set_printer: Tfn_gtk_print_settings_set_printer;
gtk_print_settings_get_orientation: Tfn_gtk_print_settings_get_orientation;
gtk_print_settings_set_orientation: Tfn_gtk_print_settings_set_orientation;
gtk_print_settings_get_paper_size: Tfn_gtk_print_settings_get_paper_size;
gtk_print_settings_set_paper_size: Tfn_gtk_print_settings_set_paper_size;
gtk_print_settings_get_paper_width: Tfn_gtk_print_settings_get_paper_width;
gtk_print_settings_set_paper_width: Tfn_gtk_print_settings_set_paper_width;
gtk_print_settings_get_paper_height: Tfn_gtk_print_settings_get_paper_height;
gtk_print_settings_set_paper_height: Tfn_gtk_print_settings_set_paper_height;
gtk_print_settings_get_collate: Tfn_gtk_print_settings_get_collate;
gtk_print_settings_set_collate: Tfn_gtk_print_settings_set_collate;
gtk_print_settings_get_duplex: Tfn_gtk_print_settings_get_duplex;
gtk_print_settings_set_duplex: Tfn_gtk_print_settings_set_duplex;
gtk_print_settings_get_n_copies: Tfn_gtk_print_settings_get_n_copies;
gtk_print_settings_set_n_copies: Tfn_gtk_print_settings_set_n_copies;
gtk_print_settings_get_resolution_x: Tfn_gtk_print_settings_get_resolution_x;
gtk_print_settings_get_resolution_y: Tfn_gtk_print_settings_get_resolution_y;
gtk_print_settings_get_default_source: Tfn_gtk_print_settings_get_default_source;
gtk_print_settings_set_default_source: Tfn_gtk_print_settings_set_default_source;
gtk_print_settings_get_media_type: Tfn_gtk_print_settings_get_media_type;
gtk_print_settings_set_media_type: Tfn_gtk_print_settings_set_media_type;
gtk_print_settings_get_output_bin: Tfn_gtk_print_settings_get_output_bin;
gtk_print_settings_set_output_bin: Tfn_gtk_print_settings_set_output_bin;
function frxGtkOrientationToFMX(Orientation: TGtkPageOrientation): TPrinterOrientation; inline;
begin
Result := TPrinterOrientation(Byte(Orientation) div 2);
end;
function frxFMXOrientationToGtk(Orientation: TPrinterOrientation): TGtkPageOrientation;
begin
Result := TGtkPageOrientation(Byte(Orientation));
end;
function GtkInfoNameFromConst(const InfoArr: array of TfrxInfoLinkData; const aConst: Integer): AnsiString;
var
i: Integer;
begin
Result := '';
for I := Low(InfoArr) to High(InfoArr) do
if InfoArr[i].Num = aConst then
begin
Result := InfoArr[i].Name;
break;
end;
end;
function InfoConstFromGtkName(const InfoArr: array of TfrxInfoLinkData; const Name: AnsiString): Integer;
var
i: Integer;
begin
Result := InfoArr[0].Num;
for I := Low(InfoArr) to High(InfoArr) do
if SameText(InfoArr[i].Name, Name) then
begin
Result := InfoArr[i].Num;
break;
end;
end;
function GtkPaperNameFromConst(PaperConst: Integer): AnsiString;
begin
Result := GtkInfoNameFromConst(GTKPapers, PaperConst);
end;
function GtkBinNameFromConst(PaperConst: Integer): AnsiString;
begin
Result := GtkInfoNameFromConst(GTKBins, PaperConst);
end;
function PaperConstFromGtkName(const PaperName: AnsiString): Integer;
begin
Result := InfoConstFromGtkName(GTKPapers, PaperName);
end;
function BinConstFromGtkName(const PBinName: AnsiString): Integer;
begin
Result := InfoConstFromGtkName(GTKBins, PBinName);
end;
destructor TfrxPrinter.Destroy;
begin
inherited;
ClearGTKPapers;
FreeAndNil(FGTKPapers);
if Assigned(FPageSet) then
g_object_unref(FPageSet);
if Assigned(FSettings) then
g_object_unref(FSettings);
if Assigned(FCustomPaper) then
gtk_paper_size_free(FCustomPaper);
end;
procedure TfrxPrinter.Init;
procedure FillPapers;
var
pList, pOrgList: TPGList;
sName: AnsiString;
PSize: TPGtkPaperSize;
begin
pList := gtk_printer_list_papers(Pointer(Handle));
pOrgList := pList;
while pList <> nil do
begin
if pList.pData <> nil then
begin
PSize := gtk_page_setup_get_paper_size(pList.pData);
sName := AnsiString(gtk_paper_size_get_name(PSize));
FPapers.AddObject(String(gtk_paper_size_get_display_name(PSize)), TObject(PaperConstFromGtkName(sName)));
FGTKPapers.AddObject(String(sName), TObject(pList.pData))
end;
pList := TPGList(pList.pNext);
end;
g_list_free(pOrgList);
end;
procedure FillBins;
var
i: Integer;
begin
for i := Low(GTKBins) to High(GTKBins) do
FBins.AddObject(String(GTKBins[i].Name), Pointer(GTKBins[i].Num));
end;
var
LPageSetup: TPGtkPageSetup;
LPaperSize: TPGtkPaperSize;
WaitTimer: TStopwatch;
begin
if FInitialized then Exit;
FDPI := System.Classes.Point(300, 300);
gtk_printer_request_details(Pointer(Handle));
WaitTimer := TStopwatch.StartNew;
{ wait for paper }
while not gtk_printer_has_details(Pointer(Handle)) and (WaitTimer.ElapsedMilliseconds < 30000) do Application.ProcessMessages;
WaitTimer.Stop;
FCanvas := TfrxLinuxCanvas.CreateFromFrxPrinter(Self);
FCanvas.Stroke.Kind := TBrushKind.Solid;
FCanvas.Stroke.Color := TAlphaColors.Black;
FCanvas.Fill.Kind := TBrushKind.Solid;
FCanvas.Fill.Color := TAlphaColors.Black;
FillPapers;
FillBins;
LPageSetup := gtk_printer_get_default_page_size(Pointer(FHandle));
if LPageSetup = nil then
LPageSetup := gtk_page_setup_new;
FPageSet := gtk_page_setup_copy(LPageSetup);
FSettings := gtk_print_settings_new;
FDefOrientation := frxGtkOrientationToFMX(gtk_page_setup_get_orientation(FPageSet));
LPaperSize := gtk_page_setup_get_paper_size(FPageSet);
FPaperHeight := gtk_page_setup_get_paper_height(FPageSet, GTK_UNIT_MM);
FPaperWidth := gtk_page_setup_get_paper_width(FPageSet, GTK_UNIT_MM);
FCustomPaper := gtk_paper_size_new_custom (PAnsiChar('frxPaper'), PAnsiChar('frxPaper'), FPaperWidth, FPaperHeight, GTK_UNIT_MM);
FOrientation := FDefOrientation;
FDefPaper := PaperConstFromGtkName(AnsiString(gtk_paper_size_get_name(LPaperSize)));
FDefBin := BinConstFromGtkName(AnsiString(gtk_print_settings_get_default_source(FSettings)));
FDefDuplex := Integer(gtk_print_settings_get_duplex(FSettings));
FPaper := FDefPaper;
FDefPaperWidth := FPaperWidth;
FDefPaperHeight := FPaperHeight;
FBin := -1;
FDuplex := -1;
FDPI.X := gtk_print_settings_get_resolution_x(FSettings);
FDPI.Y := gtk_print_settings_get_resolution_y(FSettings);
FCanvas.SetSize(Round(FPaperWidth * FDPI.X / frxDefDPIUnits * fr01cm), Round(FPaperHeight * FDPI.Y / frxDefDPIUnits * fr01cm));
FInitialized := True;
g_object_unref(LPageSetup);
end;
procedure TfrxPrinter.Abort;
begin
FTerminated := True;
end;
procedure TfrxPrinter.BeginDoc;
begin
if not FInitialized then Exit;
FTerminated := False;
FPrinting := True;
//UpdateFromDeviceCaps;
gtk_print_settings_set_n_copies(FSettings, 1);
FJob := gtk_print_job_new(PAnsiChar(AnsiString(FTitle)), Pointer(Handle), FSettings, FPageset);
FSurf := gtk_print_job_get_surface(FJob, nil);
FPrinterContext := Pointer(cairo_create(FSurf));
if Assigned(FPrinterContext) then
UpdateToDeviceCaps([fdtMargins, fdtPageSize, fdtBin, fdtDuplex, fdtOrientation])
else
raise Exception.Create('Can''t create canvas for Printer');
FIsFirst := True;
end;
procedure TfrxPrinter.BeginPage;
begin
if FTerminated or not FInitialized then Exit;
FCanvas.BeginScene(nil, NativeInt(FPrinterContext));
inherited;
FIsFirst := False;
end;
procedure TfrxPrinter.EndDoc;
begin
if not FInitialized then Exit;
cairo_surface_finish(FSurf);
FSurf := nil;
if not FTerminated then
gtk_print_job_send(FJob, nil, Pointer(Self), nil);
g_object_unref(FJob);
FJob := nil;
FPrinterContext := nil;
FPrinting := False;
FBin := -1;
FDuplex := -1;
FTerminated := False;
end;
procedure TfrxPrinter.EndPage;
begin
if FTerminated or not FInitialized then Exit;
FCanvas.EndScene;
cairo_show_page(FPrinterContext);
end;
procedure TfrxPrinter.BeginRAWDoc;
begin
//todo
end;
procedure TfrxPrinter.ClearGTKPapers;
var
i: Integer;
begin
for i := 0 to FGTKPapers.Count - 1 do
g_object_unref(Pointer(FGTKPapers.Objects[i]));
FGTKPapers.Clear;
end;
constructor TfrxPrinter.Create(const AName: String; ADevice: NativeInt);
begin
inherited Create(AName, '');
FHandle := ADevice;
FGTKPapers := TStringList.Create;
end;
procedure TfrxPrinter.EndRAWDoc;
begin
//todo
end;
procedure TfrxPrinter.WriteRAWDoc(const buf: AnsiString);
begin
//todo
end;
procedure TfrxPrinter.SetViewParams(APaperSize: Integer;
APaperWidth, APaperHeight: Extended; AOrientation: TPrinterOrientation);
var
LPaperSize: TPGtkPaperSize;
begin
FPaper := APaperSize;
FOrientation := AOrientation;
if not FInitialized then Exit;
if APaperSize = 256 then
begin
// copy the margins from A4 paper
SetViewParams(DMPAPER_A4, 0, 0, AOrientation);
FPaperHeight := APaperHeight;
FPaperWidth := APaperWidth;
end;
UpdateToDeviceCaps([fdtMargins, fdtPageSize, fdtOrientation]);
UpdateFromDeviceCaps;
FOrientation := AOrientation;
{ Page setup doesnt change orientation until Job created }
{ so we need to swap size manually. Used in page dialog }
LPaperSize := gtk_page_setup_get_paper_size(FPageSet);
if FOrientation = poPortrait then
begin
FPaperWidth := gtk_paper_size_get_width(LPaperSize, GTK_UNIT_MM);
FPaperHeight := gtk_paper_size_get_height(LPaperSize, GTK_UNIT_MM);
end
else
begin
FPaperHeight := gtk_paper_size_get_width(LPaperSize, GTK_UNIT_MM);
FPaperWidth := gtk_paper_size_get_height(LPaperSize, GTK_UNIT_MM);
end;
end;
function TfrxPrinter.ShowPrintDialog: Boolean;
begin
Result := False;
end;
procedure TfrxPrinter.SetPrintParams(APaperSize: Integer;
APaperWidth, APaperHeight: Extended; AOrientation: TPrinterOrientation;
ABin, ADuplex, ACopies: Integer);
var
ParamsToUpd: TfrxDevUpdateTypes;
begin
if not FInitialized then Exit;
ParamsToUpd := [];
if FOrientation <> AOrientation then
Include(ParamsToUpd, fdtOrientation);
if (APaperSize <> FPaper) or (not SameValue(APaperWidth, FPaperWidth, 0.001) or not SameValue(APaperHeight, FPaperHeight, 0.001)) then
Include(ParamsToUpd, fdtPageSize);
if FDuplex <> ADuplex then
Include(ParamsToUpd, fdtDuplex);
if FBin <> ABin then
Include(ParamsToUpd, fdtBin);
FPaper := APaperSize;
FPaperHeight := APaperHeight;
FPaperWidth := APaperWidth;
FOrientation := AOrientation;
FBin := ABin;
FDuplex := ADuplex;
UpdateToDeviceCaps(ParamsToUpd);
end;
function TfrxPrinter.UpdateFromDeviceCaps: Boolean;
var
LPSettings: TPGtkPrintSettings;
LPaperSize: TPGtkPaperSize;
begin
Result := False;
if not FInitialized then Exit;
LPSettings := nil;
if Assigned(FJob) then
LPSettings := gtk_print_job_get_settings(FJob);
if LPSettings = nil then
LPSettings := FSettings;
FDPI.X := gtk_print_settings_get_resolution_x(FSettings);
FDPI.Y := gtk_print_settings_get_resolution_y(FSettings);
FLeftMargin := gtk_page_setup_get_left_margin(FPageSet, GTK_UNIT_MM);
FTopMargin := gtk_page_setup_get_top_margin(FPageSet, GTK_UNIT_MM);
FRightMargin := gtk_page_setup_get_right_margin(FPageSet, GTK_UNIT_MM);
FBottomMargin := gtk_page_setup_get_bottom_margin(FPageSet, GTK_UNIT_MM);
FOrientation := frxGtkOrientationToFMX(gtk_page_setup_get_orientation(FPageSet));
LPaperSize := gtk_page_setup_get_paper_size(FPageSet);
FPaperHeight := gtk_page_setup_get_paper_height(FPageSet, GTK_UNIT_MM);
FPaperWidth := gtk_page_setup_get_paper_width(FPageSet, GTK_UNIT_MM);
FPaper := PaperConstFromGtkName(gtk_paper_size_get_name(LPaperSize));
FBin := BinConstFromGtkName(gtk_print_settings_get_default_source(LPSettings));
FDuplex := Integer(gtk_print_settings_get_duplex(LPSettings));
Result := True;
end;
procedure TfrxPrinter.UpdatePageSettings;
var
PaperSize: TPGtkPaperSize;
SurfType: TCairo_surface_type;
W, H: Double;
procedure SetPSSurfSize;
begin
cairo_ps_surface_set_size (FSurf, W, H);
cairo_ps_surface_dsc_begin_page_setup(FSurf);
case gtk_page_setup_get_orientation(FPageset) of
GTK_PAGE_ORIENTATION_PORTRAIT, GTK_PAGE_ORIENTATION_REVERSE_PORTRAIT:
cairo_ps_surface_dsc_comment(FSurf, '%%PageOrientation: Portrait');
GTK_PAGE_ORIENTATION_LANDSCAPE, GTK_PAGE_ORIENTATION_REVERSE_LANDSCAPE:
cairo_ps_surface_dsc_comment(FSurf, '%%PageOrientation: Landscape');
end;
end;
begin
if FSurf = nil then Exit;
PaperSize := gtk_page_setup_get_paper_size(FPageset);
W := gtk_paper_size_get_width(PaperSize, GTK_UNIT_POINTS);
H := gtk_paper_size_get_height(PaperSize, GTK_UNIT_POINTS);
SurfType := cairo_surface_get_type(FSurf);
case SurfType of
CAIRO_SURFACE_TYPE_IMAGE: ;
CAIRO_SURFACE_TYPE_PDF: cairo_pdf_surface_set_size (FSurf, W, H);
CAIRO_SURFACE_TYPE_PS: SetPSSurfSize;
end;
FCanvas.SetSize(Round(FPaperWidth * FDPI.X / frxDefDPIUnits * fr01cm), Round(FPaperHeight * FDPI.Y / frxDefDPIUnits * fr01cm));
end;
function TfrxPrinter.UpdateToDeviceCaps(Params: TfrxDevUpdateTypes): Boolean;
var
LPSettings: TPGtkPrintSettings;
LPaperSize: TPGtkPaperSize;
sName: AnsiString;
i: Integer;
begin
Result := False;
if not FInitialized then Exit;
LPSettings := nil;
if Assigned(FJob) then
LPSettings := gtk_print_job_get_settings(FJob);
if LPSettings = nil then
LPSettings := FSettings;
if fdtOrientation in Params then
gtk_page_setup_set_orientation(FPageSet, frxFMXOrientationToGtk(FOrientation));
LPaperSize := gtk_page_setup_get_paper_size(FPageSet);
if fdtPageSize in Params then
begin
if FPaper <> 256 then
begin
sName := GtkPaperNameFromConst(FPaper);
i := FGTKPapers.IndexOf(String(sName));
if i <> -1 then
LPaperSize := gtk_page_setup_get_paper_size(FGTKPapers.Objects[i])
else
FPaper := 256;
end;
if FPaper = 256 then
begin
gtk_paper_size_set_size(FCustomPaper, FPaperWidth, FPaperHeight, GTK_UNIT_MM);
LPaperSize := FCustomPaper;
end;
gtk_page_setup_set_paper_size(FPageSet, LPaperSize);
end;
{ TODO: Doesnt work. We should start new jobs for each new input slot }
if fdtBin in Params then
gtk_print_settings_set_default_source(LPSettings, PAnsiChar(AnsiString(GtkBinNameFromConst(FBin))));
if fdtDuplex in Params then
gtk_print_settings_set_duplex(LPSettings, TGtkPrintDuplex(FDuplex));
if fdtMargins in Params then
begin
gtk_page_setup_set_left_margin(FPageSet, FLeftMargin, GTK_UNIT_MM);
gtk_page_setup_set_top_margin(FPageSet, FTopMargin, GTK_UNIT_MM);
gtk_page_setup_set_right_margin(FPageSet, FRightMargin, GTK_UNIT_MM);
gtk_page_setup_set_bottom_margin(FPageSet, FBottomMargin, GTK_UNIT_MM);
end;
if fdtOrientation in Params then
gtk_page_setup_set_orientation(FPageSet, frxFMXOrientationToGtk(FOrientation));
if (fdtOrientation in Params) or (fdtPageSize in Params) then
UpdatePageSettings;
Result := True;
end;
procedure TfrxPrinter.PropertiesDlg;
//var
// Dlg: TPGtkPrintUnixDialog;
begin
// TODO need export more functions
// Dlg := gtk_print_unix_dialog_new(PAnsiChar(AnsiString('Settings')), nil);
// gtk_print_unix_dialog_set_page_setup(Dlg, FPageSet);
// gtk_print_unix_dialog_set_settings(Dlg, FSettings);
// gtk_dialog_run(Dlg);
end;
{ TfrxPrinters }
constructor TfrxPrinters.Create;
begin
Inherited;
end;
destructor TfrxPrinters.Destroy;
begin
inherited;
end;
function TfrxPrinters.GetDefaultPrinter: String;
var
i: Integer;
begin
Result := '';
for I := 0 to FPrinterList.Count - 1 do
if gtk_printer_is_default(Pointer(TfrxPrinter(FPrinterList[i]).Handle)) then
begin
Result := TfrxPrinter(FPrinterList[i]).Name;
Break;
end;
end;
function PrintersEnum(printer: TPGtkPrinter; pData: Pointer): LongBool; cdecl;
var
sName: String;
pStr: PAnsiChar;
begin
Result := False;
if printer = nil then Exit;
g_object_ref(printer);
pStr := gtk_printer_get_name(printer);
gtk_printer_request_details(printer);
sName := String(AnsiString(pStr));
TfrxPrinters(pData).FPrinterList.Add(TfrxPrinter.Create(sName, NativeInt(Printer)));
TfrxPrinters(pData).FPrinters.Add(sName);
end;
procedure TfrxPrinters.FillPrinters;
begin
Clear;
gtk_enumerate_printers(@PrintersEnum, Pointer(Self), nil, True);
end;
function ActualfrxPrinterClass : TfrxCustomPrintersClass;
begin
Result := TfrxPrinters;
end;
const
cairoLib: String = 'libcairo.so.2';
ObjectsLib: String = 'libgobject-2.0.so.0';
GLIBLib: String = 'libglib-2.0.so.0';
cairoLoadError: String = 'Could not load libcairo library.';
GTKLib: String = 'libgtk-3.so.0';
GTKLoadError: String = 'Could not load GTK 3 library.';
procedure InitGtkAPI;
var
H: NativeInt;
begin
H := LoadLibrary(PChar(cairoLib));
if H = 0 then raise Exception.Create(cairoLoadError);
cairo_surface_finish := GetProcAddress(H, 'cairo_surface_finish');
cairo_create := GetProcAddress(H, 'cairo_create');
cairo_destroy := GetProcAddress(H, 'cairo_destroy');
cairo_show_page := GetProcAddress(H, 'cairo_show_page');
cairo_surface_get_type := GetProcAddress(H, 'cairo_surface_get_type');
cairo_ps_surface_set_size := GetProcAddress(H, 'cairo_ps_surface_set_size');
cairo_ps_surface_dsc_begin_setup := GetProcAddress(H, 'cairo_ps_surface_dsc_begin_setup');
cairo_ps_surface_dsc_begin_page_setup := GetProcAddress(H, 'cairo_ps_surface_dsc_begin_page_setup');
cairo_ps_surface_dsc_comment := GetProcAddress(H, 'cairo_ps_surface_dsc_comment');
cairo_pdf_surface_set_size := GetProcAddress(H, 'cairo_pdf_surface_set_size');
if (@cairo_surface_finish = nil) or (@cairo_create = nil) or (@cairo_destroy = nil) or (@cairo_show_page = nil) or
(@cairo_surface_get_type = nil) or (@cairo_ps_surface_set_size = nil) or (@cairo_ps_surface_dsc_begin_setup = nil) or (@cairo_ps_surface_dsc_begin_page_setup = nil) or
(@cairo_ps_surface_dsc_comment = nil) or (@cairo_pdf_surface_set_size = nil) then
raise Exception.Create(cairoLoadError);
H := LoadLibrary(PChar(ObjectsLib));
if H = 0 then raise Exception.Create(GTKLoadError);
g_object_unref := GetProcAddress(H, 'g_object_unref');
g_object_ref := GetProcAddress(H, 'g_object_ref');
g_signal_connect_data := GetProcAddress(H, 'g_signal_connect_data');
H := LoadLibrary(PChar(GLIBLib));
if H = 0 then raise Exception.Create(GTKLoadError);
g_free := GetProcAddress(H, 'g_free');
g_list_free := GetProcAddress(H, 'g_list_free');
H := LoadLibrary(PChar(GTKLib));
if H = 0 then raise Exception.Create(GTKLoadError);
gtk_print_job_new := GetProcAddress(H, 'gtk_print_job_new');
gtk_print_job_get_surface := GetProcAddress(H, 'gtk_print_job_get_surface');
gtk_print_job_send := GetProcAddress(H, 'gtk_print_job_send');
gtk_printer_get_default_page_size := GetProcAddress(H, 'gtk_printer_get_default_page_size');
gtk_print_job_get_settings := GetProcAddress(H, 'gtk_print_job_get_settings');
gtk_enumerate_printers := GetProcAddress(H, 'gtk_enumerate_printers');
gtk_printer_list_papers := GetProcAddress(H, 'gtk_printer_list_papers');
gtk_printer_has_details := GetProcAddress(H, 'gtk_printer_has_details');
gtk_printer_request_details := GetProcAddress(H, 'gtk_printer_request_details');
gtk_printer_get_name := GetProcAddress(H, 'gtk_printer_get_name');
gtk_printer_is_default := GetProcAddress(H, 'gtk_printer_is_default');
if (@gtk_print_job_new = nil) or (@gtk_print_job_get_surface = nil) or (@gtk_print_job_send = nil) or
(@g_object_unref = nil) or (@gtk_printer_get_default_page_size = nil) or (@gtk_print_job_get_settings = nil) or
(@gtk_printer_has_details = nil) or (@g_free = nil) or (@gtk_printer_list_papers = nil) or
(@gtk_printer_request_details = nil) or (@g_free = nil) or (@gtk_printer_get_name = nil) or
(@g_object_ref = nil) or (@g_list_free = nil) or (@gtk_printer_is_default = nil) or
(@g_signal_connect_data = nil) then
raise Exception.Create(GTKLoadError);
gtk_print_unix_dialog_new := GetProcAddress(H, 'gtk_print_unix_dialog_new');
gtk_print_unix_dialog_set_page_setup := GetProcAddress(H, 'gtk_print_unix_dialog_set_page_setup');
gtk_print_unix_dialog_get_page_setup := GetProcAddress(H, 'gtk_print_unix_dialog_get_page_setup');
gtk_print_unix_dialog_set_settings := GetProcAddress(H, 'gtk_print_unix_dialog_set_settings');
gtk_print_unix_dialog_get_settings := GetProcAddress(H, 'gtk_print_unix_dialog_get_settings');
gtk_dialog_run := GetProcAddress(H, 'gtk_dialog_run');
if (@gtk_print_unix_dialog_new = nil) or (@gtk_print_unix_dialog_set_page_setup = nil) or (@gtk_print_unix_dialog_get_page_setup = nil) or
(@gtk_print_unix_dialog_set_settings = nil) or (@gtk_print_unix_dialog_get_settings = nil) or (@gtk_dialog_run = nil) then
raise Exception.Create(GTKLoadError);
gtk_page_setup_new := GetProcAddress(H, 'gtk_page_setup_new');
gtk_page_setup_copy := GetProcAddress(H, 'gtk_page_setup_copy');
gtk_page_setup_get_paper_size := GetProcAddress(H, 'gtk_page_setup_get_paper_size');
gtk_page_setup_set_paper_size := GetProcAddress(H, 'gtk_page_setup_set_paper_size');
gtk_page_setup_get_orientation := GetProcAddress(H, 'gtk_page_setup_get_orientation');
gtk_page_setup_set_orientation := GetProcAddress(H, 'gtk_page_setup_set_orientation');
gtk_page_setup_get_top_margin := GetProcAddress(H, 'gtk_page_setup_get_top_margin');
gtk_page_setup_set_top_margin := GetProcAddress(H, 'gtk_page_setup_set_top_margin');
gtk_page_setup_get_bottom_margin := GetProcAddress(H, 'gtk_page_setup_get_bottom_margin');
gtk_page_setup_set_bottom_margin := GetProcAddress(H, 'gtk_page_setup_set_bottom_margin');
gtk_page_setup_get_left_margin := GetProcAddress(H, 'gtk_page_setup_get_left_margin');
gtk_page_setup_set_left_margin := GetProcAddress(H, 'gtk_page_setup_set_left_margin');
gtk_page_setup_get_right_margin := GetProcAddress(H, 'gtk_page_setup_get_right_margin');
gtk_page_setup_set_right_margin := GetProcAddress(H, 'gtk_page_setup_set_right_margin');
gtk_page_setup_get_paper_width := GetProcAddress(H, 'gtk_page_setup_get_paper_width');
gtk_page_setup_get_paper_height := GetProcAddress(H, 'gtk_page_setup_get_paper_height');
gtk_page_setup_get_page_width := GetProcAddress(H, 'gtk_page_setup_get_page_width');
gtk_page_setup_get_page_height := GetProcAddress(H, 'gtk_page_setup_get_page_height');
if (@gtk_page_setup_new = nil) or (@gtk_page_setup_get_paper_size = nil) or (@gtk_page_setup_set_paper_size = nil) or
(@gtk_page_setup_get_orientation = nil) or (@gtk_page_setup_set_orientation = nil) or (@gtk_page_setup_get_top_margin = nil) or
(@gtk_page_setup_set_top_margin = nil) or (@gtk_page_setup_get_bottom_margin = nil) or (@gtk_page_setup_set_bottom_margin = nil) or
(@gtk_page_setup_get_left_margin = nil) or (@gtk_page_setup_set_left_margin = nil) or (@gtk_page_setup_get_right_margin = nil) or
(@gtk_page_setup_set_right_margin = nil) or (@gtk_page_setup_get_paper_width = nil) or (@gtk_page_setup_get_paper_height = nil) or
(@gtk_page_setup_get_page_width = nil) or (@gtk_page_setup_get_paper_size = nil) or (@gtk_page_setup_set_paper_size = nil) or
(@gtk_page_setup_new = nil) or (@gtk_page_setup_get_page_height = nil) or (@gtk_page_setup_copy = nil) then
raise Exception.Create(GTKLoadError);
gtk_paper_size_new := GetProcAddress(H, 'gtk_paper_size_new');
gtk_paper_size_new_from_ppd := GetProcAddress(H, 'gtk_paper_size_new_from_ppd');
gtk_paper_size_new_from_ipp := GetProcAddress(H, 'gtk_paper_size_new_from_ipp');
gtk_paper_size_new_custom := GetProcAddress(H, 'gtk_paper_size_new_custom');
gtk_paper_size_copy := GetProcAddress(H, 'gtk_paper_size_copy');
gtk_paper_size_free := GetProcAddress(H, 'gtk_paper_size_free');
gtk_paper_size_is_equal := GetProcAddress(H, 'gtk_paper_size_is_equal');
gtk_paper_size_get_name := GetProcAddress(H, 'gtk_paper_size_get_name');
gtk_paper_size_get_display_name := GetProcAddress(H, 'gtk_paper_size_get_display_name');
gtk_paper_size_get_ppd_name := GetProcAddress(H, 'gtk_paper_size_get_ppd_name');
gtk_paper_size_get_width := GetProcAddress(H, 'gtk_paper_size_get_width');
gtk_paper_size_get_height := GetProcAddress(H, 'gtk_paper_size_get_height');
gtk_paper_size_is_custom := GetProcAddress(H, 'gtk_paper_size_is_custom');
gtk_paper_size_is_ipp := GetProcAddress(H, 'gtk_paper_size_is_ipp');
gtk_paper_size_set_size := GetProcAddress(H, 'gtk_paper_size_set_size');
gtk_paper_size_get_default_top_margin := GetProcAddress(H, 'gtk_paper_size_get_default_top_margin');
gtk_paper_size_get_default_bottom_margin := GetProcAddress(H, 'gtk_paper_size_get_default_bottom_margin');
gtk_paper_size_get_default_left_margin := GetProcAddress(H, 'gtk_paper_size_get_default_left_margin');
gtk_paper_size_get_default_right_margin := GetProcAddress(H, 'gtk_paper_size_get_default_right_margin');
gtk_paper_size_get_default := GetProcAddress(H, 'gtk_paper_size_get_default');
if (@gtk_paper_size_new = nil) or (@gtk_paper_size_new_from_ppd = nil) or (@gtk_paper_size_new_from_ipp = nil) or
(@gtk_paper_size_new_custom = nil) or (@gtk_paper_size_copy = nil) or (@gtk_paper_size_free = nil) or
(@gtk_paper_size_is_equal = nil) or (@gtk_paper_size_get_name = nil) or (@gtk_paper_size_get_display_name = nil) or
(@gtk_paper_size_get_ppd_name = nil) or (@gtk_paper_size_get_width = nil) or (@gtk_paper_size_get_height = nil) or
(@gtk_paper_size_is_custom = nil) or (@gtk_paper_size_is_ipp = nil) or (@gtk_paper_size_set_size = nil) or
(@gtk_paper_size_get_default_top_margin = nil) or (@gtk_paper_size_get_default_bottom_margin = nil) or (@gtk_paper_size_get_default_left_margin = nil) or
(@gtk_paper_size_get_default_right_margin = nil) or (@gtk_paper_size_get_default = nil) then
raise Exception.Create(GTKLoadError);
gtk_print_settings_new := GetProcAddress(H, 'gtk_print_settings_new');
gtk_print_settings_get_printer := GetProcAddress(H, 'gtk_print_settings_get_printer');
gtk_print_settings_set_printer := GetProcAddress(H, 'gtk_print_settings_set_printer');
gtk_print_settings_get_orientation := GetProcAddress(H, 'gtk_print_settings_get_orientation');
gtk_print_settings_set_orientation := GetProcAddress(H, 'gtk_print_settings_set_orientation');
gtk_print_settings_get_paper_size := GetProcAddress(H, 'gtk_print_settings_get_paper_size');
gtk_print_settings_set_paper_size := GetProcAddress(H, 'gtk_print_settings_set_paper_size');
gtk_print_settings_get_paper_width := GetProcAddress(H, 'gtk_print_settings_get_paper_width');
gtk_print_settings_set_paper_width := GetProcAddress(H, 'gtk_print_settings_set_paper_width');
gtk_print_settings_get_paper_height := GetProcAddress(H, 'gtk_print_settings_get_paper_height');
gtk_print_settings_set_paper_height := GetProcAddress(H, 'gtk_print_settings_set_paper_height');
gtk_print_settings_get_collate := GetProcAddress(H, 'gtk_print_settings_get_collate');
gtk_print_settings_set_collate := GetProcAddress(H, 'gtk_print_settings_set_collate');
gtk_print_settings_get_duplex := GetProcAddress(H, 'gtk_print_settings_get_duplex');
gtk_print_settings_set_duplex := GetProcAddress(H, 'gtk_print_settings_set_duplex');
gtk_print_settings_get_n_copies := GetProcAddress(H, 'gtk_print_settings_get_n_copies');
gtk_print_settings_set_n_copies := GetProcAddress(H, 'gtk_print_settings_set_n_copies');
gtk_print_settings_get_resolution_x := GetProcAddress(H, 'gtk_print_settings_get_resolution_x');
gtk_print_settings_get_resolution_y := GetProcAddress(H, 'gtk_print_settings_get_resolution_y');
gtk_print_settings_get_default_source := GetProcAddress(H, 'gtk_print_settings_get_default_source');
gtk_print_settings_set_default_source := GetProcAddress(H, 'gtk_print_settings_set_default_source');
gtk_print_settings_get_media_type := GetProcAddress(H, 'gtk_print_settings_get_media_type');
gtk_print_settings_set_media_type := GetProcAddress(H, 'gtk_print_settings_set_media_type');
gtk_print_settings_get_output_bin := GetProcAddress(H, 'gtk_print_settings_get_output_bin');
gtk_print_settings_set_output_bin := GetProcAddress(H, 'gtk_print_settings_set_output_bin');
if (@gtk_print_settings_new = nil) or (@gtk_print_settings_get_printer = nil) or (@gtk_print_settings_set_printer = nil) or
(@gtk_print_settings_get_orientation = nil) or (@gtk_print_settings_set_orientation = nil) or (@gtk_print_settings_get_paper_size = nil) or
(@gtk_print_settings_set_paper_size = nil) or (@gtk_print_settings_get_paper_width = nil) or (@gtk_print_settings_set_paper_width = nil) or
(@gtk_print_settings_get_paper_height = nil) or (@gtk_print_settings_set_paper_height = nil) or (@gtk_print_settings_get_collate = nil) or
(@gtk_print_settings_set_collate = nil) or (@gtk_print_settings_get_duplex = nil) or (@gtk_print_settings_set_duplex = nil) or
(@gtk_print_settings_get_n_copies = nil) or (@gtk_print_settings_set_n_copies = nil) or (@gtk_print_settings_get_resolution_x = nil) or
(@gtk_print_settings_get_resolution_y = nil) or (@gtk_print_settings_get_default_source = nil) or (@gtk_print_settings_set_default_source = nil) or
(@gtk_print_settings_get_media_type = nil) or (@gtk_print_settings_set_media_type = nil) or (@gtk_print_settings_get_output_bin = nil) or
(@gtk_print_settings_set_output_bin = nil) then
raise Exception.Create(GTKLoadError);
end;
initialization
InitGtkAPI;
finalization
end.