1
0
mirror of https://github.com/salvadordf/CEF4Delphi.git synced 2025-11-23 21:34:53 +02:00

Update to CEF 121.3.2

This commit is contained in:
salvadordf
2024-02-01 15:13:22 +01:00
parent f614c4b6a4
commit a000f59f97
14 changed files with 183 additions and 140 deletions

View File

@@ -25,22 +25,23 @@ type
/// </summary>
TPDFPrintOptions = class
protected
FLandscape : boolean;
FPrintBackground : boolean;
FScale : double;
FPaperWidth : double;
FPaperHeight : double;
FPreferCSSPageSize : boolean;
FMarginType : TCefPdfPrintMarginType;
FMarginTop : double;
FMarginRight : double;
FMarginBottom : double;
FMarginLeft : double;
FPageRanges : ustring;
FDisplayHeaderFooter : boolean;
FHeaderTemplate : ustring;
FFooterTemplate : ustring;
FGenerateTaggedPDF : boolean;
FLandscape : boolean;
FPrintBackground : boolean;
FScale : double;
FPaperWidth : double;
FPaperHeight : double;
FPreferCSSPageSize : boolean;
FMarginType : TCefPdfPrintMarginType;
FMarginTop : double;
FMarginRight : double;
FMarginBottom : double;
FMarginLeft : double;
FPageRanges : ustring;
FDisplayHeaderFooter : boolean;
FHeaderTemplate : ustring;
FFooterTemplate : ustring;
FGenerateTaggedPDF : boolean;
FGenerateDocumentOutline : boolean;
function GetScalePct: double;
function GetPaperWidthMM: double;
@@ -73,16 +74,16 @@ type
/// <summary>
/// Set to true for landscape mode or false for portrait mode.
/// </summary>
property Landscape : boolean read FLandscape write FLandscape;
property Landscape : boolean read FLandscape write FLandscape;
/// <summary>
/// Set to true to print background graphics.
/// </summary>
property PrintBackground : boolean read FPrintBackground write FPrintBackground;
property PrintBackground : boolean read FPrintBackground write FPrintBackground;
/// <summary>
/// Set to true to prefer page size as defined by css. Defaults to false,
/// in which case the content will be scaled to fit the paper size.
/// </summary>
property PreferCSSPageSize : boolean read FPreferCSSPageSize write FPreferCSSPageSize;
property PreferCSSPageSize : boolean read FPreferCSSPageSize write FPreferCSSPageSize;
/// <summary>
/// <para>Paper ranges to print, one based, e.g., '1-5, 8, 11-13'. Pages are printed
/// in the document order, not in the order specified, and no more than once.
@@ -92,12 +93,12 @@ type
/// no pages to print, an error is reported. It is an error to specify a range
/// with start greater than end.</para>
/// </summary>
property PageRanges : ustring read FPageRanges write FPageRanges;
property PageRanges : ustring read FPageRanges write FPageRanges;
/// <summary>
/// Set to true to display the header and/or footer. Modify
/// HeaderTemplate and/or FooterTemplate to customize the display.
/// </summary>
property DisplayHeaderFooter : boolean read FDisplayHeaderFooter write FDisplayHeaderFooter;
property DisplayHeaderFooter : boolean read FDisplayHeaderFooter write FDisplayHeaderFooter;
/// <summary>
/// <para>HTML template for the print header. Only displayed if
/// DisplayHeaderFooter is true. Should be valid HTML markup with
@@ -112,87 +113,91 @@ type
/// <para>For example, "<span class=title></span>" would generate a span containing
/// the title.</para>
/// </summary>
property HeaderTemplate : ustring read FHeaderTemplate write FHeaderTemplate;
property HeaderTemplate : ustring read FHeaderTemplate write FHeaderTemplate;
/// <summary>
/// HTML template for the print footer. Only displayed if
/// DisplayHeaderFooter is true. Uses the same format as
/// HeaderTemplate.
/// </summary>
property FooterTemplate : ustring read FFooterTemplate write FFooterTemplate;
property FooterTemplate : ustring read FFooterTemplate write FFooterTemplate;
/// <summary>
/// Set to true to generate tagged (accessible) PDF.
/// </summary>
property GenerateTaggedPDF : boolean read FGenerateTaggedPDF write FGenerateTaggedPDF;
property GenerateTaggedPDF : boolean read FGenerateTaggedPDF write FGenerateTaggedPDF;
/// <summary>
/// Set to true to generate a document outline.
/// </summary>
property GenerateDocumentOutline : boolean read FGenerateDocumentOutline write FGenerateDocumentOutline;
/// <summary>
/// The percentage to scale the PDF by before printing (e.g. .5 is 50%).
/// If this value is less than or equal to zero the default value of 1.0
/// will be used.
/// </summary>
property Scale : double read FScale write FScale;
property Scale : double read FScale write FScale;
/// <summary>
/// The percentage value to scale the PDF by before printing (e.g. 50 is 50%).
/// </summary>
property ScalePct : double read GetScalePct write SetScalePct;
property ScalePct : double read GetScalePct write SetScalePct;
/// <summary>
/// Output paper width in inches. If either of these values is less than or
/// equal to zero then the default paper size (letter, 8.5 x 11 inches) will
/// be used.
/// </summary>
property PaperWidthInch : double read FPaperWidth write FPaperWidth;
property PaperWidthInch : double read FPaperWidth write FPaperWidth;
/// <summary>
/// Output paper height in inches. If either of these values is less than or
/// equal to zero then the default paper size (letter, 8.5 x 11 inches) will
/// be used.
/// </summary>
property PaperHeightInch : double read FPaperHeight write FPaperHeight;
property PaperHeightInch : double read FPaperHeight write FPaperHeight;
/// <summary>
/// Output paper width in mm.
/// </summary>
property PaperWidthMM : double read GetPaperWidthMM write SetPaperWidthMM;
property PaperWidthMM : double read GetPaperWidthMM write SetPaperWidthMM;
/// <summary>
/// Output paper height in mm.
/// </summary>
property PaperHeightMM : double read GetPaperHeightMM write SetPaperHeightMM;
property PaperHeightMM : double read GetPaperHeightMM write SetPaperHeightMM;
/// <summary>
/// Margin type.
/// </summary>
property MarginType : TCefPdfPrintMarginType read FMarginType write FMarginType;
property MarginType : TCefPdfPrintMarginType read FMarginType write FMarginType;
/// <summary>
/// Top margin in inches. Only used if MarginType is set to
/// PDF_PRINT_MARGIN_CUSTOM.
/// </summary>
property MarginTopInch : double read FMarginTop write FMarginTop;
property MarginTopInch : double read FMarginTop write FMarginTop;
/// <summary>
/// Right margin in inches. Only used if MarginType is set to
/// PDF_PRINT_MARGIN_CUSTOM.
/// </summary>
property MarginRightInch : double read FMarginRight write FMarginRight;
property MarginRightInch : double read FMarginRight write FMarginRight;
/// <summary>
/// Bottom margin in inches. Only used if MarginType is set to
/// PDF_PRINT_MARGIN_CUSTOM.
/// </summary>
property MarginBottomInch : double read FMarginBottom write FMarginBottom;
property MarginBottomInch : double read FMarginBottom write FMarginBottom;
/// <summary>
/// Left margin in inches. Only used if MarginType is set to
/// PDF_PRINT_MARGIN_CUSTOM.
/// </summary>
property MarginLeftInch : double read FMarginLeft write FMarginLeft;
property MarginLeftInch : double read FMarginLeft write FMarginLeft;
/// <summary>
/// Top margin in mm.
/// </summary>
property MarginTopMM : double read GetMarginTopMM write SetMarginTopMM;
property MarginTopMM : double read GetMarginTopMM write SetMarginTopMM;
/// <summary>
/// Right margin in mm.
/// </summary>
property MarginRightMM : double read GetMarginRightMM write SetMarginRightMM;
property MarginRightMM : double read GetMarginRightMM write SetMarginRightMM;
/// <summary>
/// Bottom margin in mm.
/// </summary>
property MarginBottomMM : double read GetMarginBottomMM write SetMarginBottomMM;
property MarginBottomMM : double read GetMarginBottomMM write SetMarginBottomMM;
/// <summary>
/// Left margin in mm.
/// </summary>
property MarginLeftMM : double read GetMarginLeftMM write SetMarginLeftMM;
property MarginLeftMM : double read GetMarginLeftMM write SetMarginLeftMM;
end;
implementation
@@ -205,22 +210,23 @@ const
constructor TPDFPrintOptions.Create;
begin
FLandscape := False;
FPrintBackground := False;
FScale := 0;
FPaperWidth := 0;
FPaperHeight := 0;
FPreferCSSPageSize := False;
FMarginType := PDF_PRINT_MARGIN_DEFAULT;
FMarginTop := 0;
FMarginRight := 0;
FMarginBottom := 0;
FMarginLeft := 0;
FPageRanges := '';
FDisplayHeaderFooter := False;
FHeaderTemplate := '';
FFooterTemplate := '';
FGenerateTaggedPDF := False;
FLandscape := False;
FPrintBackground := False;
FScale := 0;
FPaperWidth := 0;
FPaperHeight := 0;
FPreferCSSPageSize := False;
FMarginType := PDF_PRINT_MARGIN_DEFAULT;
FMarginTop := 0;
FMarginRight := 0;
FMarginBottom := 0;
FMarginLeft := 0;
FPageRanges := '';
FDisplayHeaderFooter := False;
FHeaderTemplate := '';
FFooterTemplate := '';
FGenerateTaggedPDF := False;
FGenerateDocumentOutline := False;
end;
function TPDFPrintOptions.InchesToMM(const aInches: double): double;
@@ -329,22 +335,23 @@ end;
procedure TPDFPrintOptions.CopyToSettings(var aSettings : TCefPdfPrintSettings);
begin
aSettings.landscape := Ord(FLandscape);
aSettings.print_background := Ord(FPrintBackground);
aSettings.scale := FScale;
aSettings.paper_width := FPaperWidth;
aSettings.paper_height := FPaperHeight;
aSettings.prefer_css_page_size := Ord(FPreferCSSPageSize);
aSettings.margin_type := FMarginType;
aSettings.margin_top := FMarginTop;
aSettings.margin_right := FMarginRight;
aSettings.margin_bottom := FMarginBottom;
aSettings.margin_left := FMarginLeft;
aSettings.page_ranges := CefString(FPageRanges);
aSettings.display_header_footer := Ord(FDisplayHeaderFooter);
aSettings.header_template := CefString(FHeaderTemplate);
aSettings.footer_template := CefString(FFooterTemplate);
aSettings.generate_tagged_pdf := Ord(FGenerateTaggedPDF);
aSettings.landscape := Ord(FLandscape);
aSettings.print_background := Ord(FPrintBackground);
aSettings.scale := FScale;
aSettings.paper_width := FPaperWidth;
aSettings.paper_height := FPaperHeight;
aSettings.prefer_css_page_size := Ord(FPreferCSSPageSize);
aSettings.margin_type := FMarginType;
aSettings.margin_top := FMarginTop;
aSettings.margin_right := FMarginRight;
aSettings.margin_bottom := FMarginBottom;
aSettings.margin_left := FMarginLeft;
aSettings.page_ranges := CefString(FPageRanges);
aSettings.display_header_footer := Ord(FDisplayHeaderFooter);
aSettings.header_template := CefString(FHeaderTemplate);
aSettings.footer_template := CefString(FFooterTemplate);
aSettings.generate_tagged_pdf := Ord(FGenerateTaggedPDF);
aSettings.generate_document_outline := Ord(FGenerateDocumentOutline);
end;
end.