fpCEF: how to use printToPDF function lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- rapra · 2015-11-27 14:59 Hello! I made simple Web Browser with fpCEF and I need to print document with function: Chromium1.Browser.Host.PrintToPdf I need to do silent print to PDF to specified location ( ParamStr(0) ) with filename := document title. Similiar funciton works in cefclient example which I found at cefbuilds.com (this example ask where to save a file - I dont even need that), but it is wroten in C language and I cant copy that. My knowledge ends at this moment. I know that I have to build a callback function, but I dont have idea how to make it properly. Could anyone help me with that? ---------------------------------------------------------------------- Michl · 2016-02-04 07:54 You can do it so:Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.Button1Click(Sender: TObject);var  CefPdfPrintSettings: TCefPdfPrintSettings;  EmptyCefStringUtf16: TCefStringUtf16;begin  FillByte(EmptyCefStringUtf16, SizeOf(EmptyCefStringUtf16), 0);   CefPdfPrintSettings.backgrounds_enabled := 1;  CefPdfPrintSettings.header_footer_enabled := 0;  CefPdfPrintSettings.header_footer_title := EmptyCefStringUtf16;  CefPdfPrintSettings.header_footer_url := EmptyCefStringUtf16;  CefPdfPrintSettings.landscape := 0;  CefPdfPrintSettings.margin_bottom := 0;  CefPdfPrintSettings.margin_left := 0;  CefPdfPrintSettings.margin_right := 0;  CefPdfPrintSettings.margin_top := 0;  CefPdfPrintSettings.margin_type := PDF_PRINT_MARGIN_DEFAULT;  CefPdfPrintSettings.page_height := 0;  CefPdfPrintSettings.page_width := 0;  CefPdfPrintSettings.selection_only := 0;   Chromium.Browser.Host.PrintToPdf('C:\01\test.pdf', CefPdfPrintSettings, Nil);end; The description of the Settings are in the definition. [Edit] I also added some infos here http://wiki.freepascal.org/fpCEF3 (please correct the grammar and spelling, English isn't my native language).