Page 1 of 2
How To Active print setting in Local html File
Posted: Fri Jan 05, 2018 7:16 am
by crystalxp
Hello, I Try to load a html with flash plugin , and here is a button to Call System printer setting , In IE, It Calls well(Of course , It will ask for script run permission )。but in CEF, When Click the button ,Nothing appened, I have Tried GlobalCEFApp.AddCustomCommandLine('--enable-local-file-accesses');
anythings should I go before call this?
Re: How To Active print setting in Local html File
Posted: Fri Jan 05, 2018 9:41 am
by salvadordf
Hi,
If you are loading a local html file with a file:/// URL, you will have some restrictions.
Chromium do that for safety reasons and that's why it's recommended to load local files in CEF with a custom resource handler.
Check the CustomResourceBrowser demo.
Re: How To Active print setting in Local html File
Posted: Wed Jan 10, 2018 1:56 am
by crystalxp
Re: How To Active print setting in Local html File
Posted: Fri Jan 19, 2018 5:19 am
by crystalxp
Hello,I have tried load it from Chromium_OnGetResourceHandler
if request.Url = '
http://printerpage/' then
begin
TempStream := TFileStream.Create(ExtractFilePath(Application.ExeName) +
'printerpagesetting.html',fmOpenRead);//which has a swf embedded in it
Result := TCustomResourceHandler.Create(browser, frame, '', request,
TStream(TempStream), CefGetMimeType('html'));
end
else if request.Url = '
http://printerpage/flashwithprintbutton.swf' then
Begin
TempStream := TFileStream.Create(ExtractFilePath(Application.ExeName) +
'flashwithprintbutton.swf',fmOpenRead);//press the button will show system printer setting well in ie(win10)
Result := TCustomResourceHandler.Create(browser, frame, '', request,
TStream(TempStream), CefGetMimeType('swf'));
end;
But the flash button still have (no right?) to show printer setting, what's wrong or any other solution
Re: How To Active print setting in Local html File
Posted: Fri Jan 19, 2018 6:30 am
by crystalxp
More:If it not because of right problem? then how to call printer in flash with cef
Re: How To Active print setting in Local html File
Posted: Fri Jan 19, 2018 9:23 am
by salvadordf
I know nothing about Adobe Flash programming but If you can't find a way to make it work you can also try the other workarounds for this kind of issues :
- Use a custom scheme. You could use URLs that start with 'myprotocol://' instead of 'http://' and load your contents from disk. Take a look at the SchemeRegistrationBrowser demo for more info.
- Another suggested workaround is using DATA urls.
Re: How To Active print setting in Local html File
Posted: Fri Jan 19, 2018 9:50 am
by crystalxp
Sorry for this, I have to add some information:
I test it in Chrome,IE,and Firefox, they can load and run print setting using file://......html , so i think it no need to understand how flash program it.....
but it can't work well in Cef4delphi demo browser...
Why?
I'm sorrry, but could you give us some demo on printer call (beside the window.print() using js

)
thank you very much!

Re: How To Active print setting in Local html File
Posted: Fri Jan 19, 2018 9:54 am
by crystalxp
testfile is what i tested ...
thank you again.
Re: How To Active print setting in Local html File
Posted: Fri Jan 19, 2018 7:23 pm
by salvadordf
I'll take a look this weekend but I can't promise anything because I know nothing about Flash programming...
Re: How To Active print setting in Local html File
Posted: Sat Jan 20, 2018 12:26 am
by crystalxp