55143681 Posted December 29, 2021 Share Posted December 29, 2021 I use fastreport to design my report, then save to pdf files. I need to pring the pdf file, First,I preview the pdf file, Second,I press the pring button. Can I print the pdf file directly without open it in browser first? Link to comment Share on other sites More sharing options...
irigsoft Posted December 29, 2021 Share Posted December 29, 2021 6 hours ago, 55143681 said: I use fastreport to design my report, then save to pdf files. I need to pring the pdf file, First,I preview the pdf file, Second,I press the pring button. Can I print the pdf file directly without open it in browser first? hello, look here : https://www.google.com/search?q=javascript+print+directly+to+default+printer&oq=javascript+print+direct&aqs=chrome.2.69i57j0i19l4j0i19i22i30l5.10143j0j7&sourceid=chrome&ie=UTF-8 for many examples in javascript. or look here: Link to comment Share on other sites More sharing options...
irigsoft Posted December 29, 2021 Share Posted December 29, 2021 You can create a Windows based service (with uniGui) and install it on a client machine. Then, when the application from the browser wants to print directly, send data such as Base64 string to this service and use it to print. Link to comment Share on other sites More sharing options...
55143681 Posted December 29, 2021 Author Share Posted December 29, 2021 1 minute ago, irigsoft said: You can create a Windows based service (with uniGui) and install it on a client machine. Then, when the application from the browser wants to print directly, send data such as Base64 string to this service and use it to print. How to do that? Thanks. Link to comment Share on other sites More sharing options...
leons Posted December 29, 2021 Share Posted December 29, 2021 We use https://www.neodynamic.com/products/printing/js-print-manager/articles/. Is the same solution like QZ.io Link to comment Share on other sites More sharing options...
irigsoft Posted December 29, 2021 Share Posted December 29, 2021 22 minutes ago, 55143681 said: How to do that? Thanks. 1. Create uniGui Application as Service (or StandAlone application if You want to show some data in a windows tray) 2. On this application You get sended data and then send it to the default printer. uniMainModule: function mmReadDocument (iType: Integer; sDocument: String): String; var ParamsList, sAnswerList, sDataList : TStringList; Wait : Integer; I : Integer; begin Wait := 0; repeat sleep (5); Inc (Wait); If (Wait >= 36000) then break; until (not ServerModule.isBusy); TRY sAnswerList := TStringList.Create; sAnswerList.StrictDelimiter := True; ParamsList := TStringList.Create; sDataList := TStringList.Create; sDataList.StrictDelimiter := True; sDataList.Delimiter := '#'; sAnswerList.Text := ''; sDataList.DelimitedText := DecodeBase64 (sDocument); ServerModule.isBusy := True; TRY SEND DATA TO The default PRINTER ServerModule.isBusy := False; sAnswerList.Clear; ParamsList.Clear; sDataList.Clear; EXCEPT on E:Exception do begin sAnswerList.Text := e.Message; ShowMessage ('2 ExecuteCommands Error:' + e.Message); end; END; end; uniServerModule: procedure TUniServerModule.UniGUIServerModuleHTTPCommand begin //check if pdf file is sended if (POS ('/pdf',ARequestInfo.URI) > 0) then begin // DO YOUR REST STUFF AResponseInfo.ResponseNo := 200; AResponseInfo.ContentEncoding := '1251'; ARequestInfo.Document := mmReadDocument (2,Copy (ARequestInfo.Document,Length ('/pdf=')+1,Length (ARequestInfo.Document))); AResponseInfo.ContentText := ARequestInfo.Document; AResponseInfo.WriteContent; Handled := True; AResponseInfo.CloseSession; end; end; 3. from Server Application just send data. Link to comment Share on other sites More sharing options...
rencarnacion Posted January 4, 2022 Share Posted January 4, 2022 On 12/28/2021 at 8:26 PM, 55143681 said: I use fastreport to design my report, then save to pdf files. I need to pring the pdf file, First,I preview the pdf file, Second,I press the pring button. Can I print the pdf file directly without open it in browser first? Try QZ Tray !!! Link to comment Share on other sites More sharing options...
55143681 Posted January 11, 2022 Author Share Posted January 11, 2022 On 1/4/2022 at 7:53 PM, rencarnacion said: Try QZ Tray !!! What is QZ Tray? Link to comment Share on other sites More sharing options...
irigsoft Posted January 11, 2022 Share Posted January 11, 2022 6 hours ago, 55143681 said: What is QZ Tray? https://qz.io/ https://qz.io/download/ Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now