Jump to content

Muhammad Idris

uniGUI Subscriber
  • Posts

    121
  • Joined

  • Last visited

  • Days Won

    3

Posts posted by Muhammad Idris

  1. On 3/3/2024 at 10:34 PM, Kurt said:

    install pdftk in your environment


    and you can use this code:
     

    procedure MergeAndEncryptPDFs(const AInputFiles: string; const AOutputFile: string; const AUserPassword: string);
    var
      CommandLine: string;
      StartupInfo: TStartupInfo;
      ProcessInfo: TProcessInformation;
    begin
      CommandLine := 'pdftk ' + AInputFiles + ' cat output ' + AOutputFile + ' user_pw ' + AUserPassword;
    
      FillChar(StartupInfo, SizeOf(StartupInfo), 0);
      StartupInfo.cb := SizeOf(StartupInfo);
    
      if CreateProcess(nil, PChar(CommandLine), nil, nil, False, 0, nil, nil, StartupInfo, ProcessInfo) then
      begin
        WaitForSingleObject(ProcessInfo.hProcess, INFINITE);
        CloseHandle(ProcessInfo.hProcess);
        CloseHandle(ProcessInfo.hThread);
    	end
    	else
    		raise Exception.Create('not created');
    end;


    to call it:

     

    procedure TMainForm.UniButton1Click(Sender: TObject);
    var 
    	OutPdf: string;
    begin
    	OutPdf :=  UniServerModule.NewCacheFile('pdf', fileName);
    	MergeAndEncryptPDFs('example1.pdf,example2.pdf', OutPdf, '');
    end;


    you can modify the code to omit the password protection for your pdf.

    hope it helps

     

    image.png.2c88f733bc4a96615c817d9f000c1b60.png

     

    Thank you sir, I tried but couldn't create a PDF and how do I get the PDF file to be taken from a loop like this?

     

        QBiaya.Close;
        QBiaya.SQL.Clear;
        QBiaya.SQL.Add('SELECT ROW_NUMBER() OVER(ORDER BY A.Id_Hasil ASC) AS Nmr,A.*,C.NAMALENGKAP '+
          'FROM ASESMEN_HASIL_PENUNJANG_LAINNYA_PDF AS A '+
          'INNER JOIN TUSER AS C ON A.NAMAUSER=C.NAMAUSER '+
          'WHERE A.NO_REG = '+QuotedStr(noreg)+' '+
          'ORDER BY A.Id_Hasil');
        QBiaya.Open;
        QBiaya.First;
        while Not QBiaya.Eof do
        begin
          CopyFile(pchar(UniMainModule.folderPath+QBiayaNama_File.AsString),pchar(UniServerModule.LocalCachePath+'\'+QBiayaNama_File.AsString),false);
          pathfile:=trim( Copy(UniServerModule.LocalCachePath,AnsiPos('cache',UniServerModule.LocalCachePath),length(UniServerModule.LocalCachePath)));
          UniSession.SendFile(UniServerModule.LocalCachePath+'\'+QBiayaNama_File.AsString);
          QBiaya.Next;
        end;

        for Path in TDirectory.GetFiles(UniServerModule.LocalCachePath+'\')  do
        begin
          UniListBox1.Items.Add(ExtractFileName( Path ));
        end;

        OutPdf :=  UniServerModule.NewCacheFile('pdf', fileName);
        MergeAndEncryptPDFs('EKG MADAA.pdf,KULTUR MADAA.pdf', OutPdf, '');

  2. how to combine pdf files into one file with UniSession.SendFile ?

    The code I made can only download multiple files, it can't combine into one PDF file :

      QBiaya.Close;
      QBiaya.SQL.Clear;
      QBiaya.SQL.Add('SELECT ROW_NUMBER() OVER(ORDER BY A.Id_Hasil ASC) AS Nmr,A.*,C.NAMALENGKAP '+
        'FROM ASESMEN_HASIL_PENUNJANG_LAINNYA_PDF AS A '+
        'INNER JOIN TUSER AS C ON A.NAMAUSER=C.NAMAUSER '+
        'WHERE A.NO_REG = '+QuotedStr(noreg)+' '+
        'ORDER BY A.Id_Hasil');
      QBiaya.Open;
      QBiaya.First;
      while Not QBiaya.Eof do
      begin
        CopyFile(pchar(UniMainModule.folderPath+QBiayaNama_File.AsString),pchar(UniServerModule.LocalCachePath+'\'+QBiayaNama_File.AsString),false);
        pathfile:=trim( Copy(UniServerModule.LocalCachePath,AnsiPos('cache',UniServerModule.LocalCachePath),length(UniServerModule.LocalCachePath)));
        UniSession.SendFile(UniServerModule.LocalCachePath+'\'+QBiayaNama_File.AsString);
        QBiaya.Next;
      end;

  3. On 9/10/2023 at 12:19 AM, Muhammad Idris said:

    I can combine several reports in FastReport, but How do I combine the report with a PDF file in a file/folder in FastReport ?

    my code :

     

    procedure TFLap_SBPK.PrepareAndShow(Report: TfrxReport; Exp: TfrxPDFExport);
    var
      AUrl : string;
    begin
      Report.PrintOptions.ShowDialog := False;
      Report.ShowProgress := false;

      Report.EngineOptions.SilentMode := True;
      Report.EngineOptions.EnableThreadSafe := True;
      Report.EngineOptions.DestroyForms := False;
      Report.EngineOptions.UseGlobalDataSetList := False;

      Exp.Background := True;
      Exp.ShowProgress := False;
      Exp.ShowDialog := False;
      Exp.FileName := UniServerModule.NewCacheFileUrl(False, 'pdf', '', '', AUrl, True);
      Exp.DefaultPath := '';

      Report.PreviewOptions.AllowEdit := False;
      Report.PrepareReport;

      if Billing = '1' then
      begin
        frxRekapBPJS.PrepareReport;
        Report.PreviewPages.AddFrom(frxRekapBPJS);
      end;
      if Resume = '1' then
      begin
        frxRadiologi.PrepareReport;
        Report.PreviewPages.AddFrom(frxRadiologi);
      end;
      if Konsul = '1' then
      begin
        frxKonsul.PrepareReport;
        Report.PreviewPages.AddFrom(frxKonsul);
      end;
      if Jawab = '1' then
      begin
        frxJawab.PrepareReport;
        Report.PreviewPages.AddFrom(frxJawab);
      end;
      if Terapi = '1' then
      begin
        frxTerapi.PrepareReport;
        Report.PreviewPages.AddFrom(frxTerapi);
      end;
      if Fisik = '1' then
      begin
        frxFisik.PrepareReport;
        Report.PreviewPages.AddFrom(frxFisik);
      end;
      if PermintaanTerapi = '1' then
      begin
        frxPermintaanTerapi.PrepareReport;
        Report.PreviewPages.AddFrom(frxPermintaanTerapi);
      end;
      if Kematian = '1' then
      begin
        frxKematian.PrepareReport;
        Report.PreviewPages.AddFrom(frxKematian);
      end;
      if RujukKeluarRS = '1' then
      begin
        frxRujuk.PrepareReport;
        Report.PreviewPages.AddFrom(frxRujuk);
      end;
      if Lain = '1' then
      begin
        FUrl := UniServerModule.FilesFolderURL + 'eKlaim_PDF/';
        frxReport1.LoadFromFile(FUrl+QBiayaNama_File.AsString);
        frxReport1.PrepareReport;
        Report.PreviewPages.AddFrom(frxReport1);
      end;

      Report.Export(Exp);

      UniPDFFrame1.PdfURL := AUrl + '#page=1&zoom=100';
    end;

    Is there a solution to this problem?

  4. 3 hours ago, Wilton Ergon said:

    I was having random problems with losing connection with the SQL server 2019, and I used MSOLEDB 18 to connect, I updated to the latest version of MSOLEDB 19.3.2, and these problems stopped.

    I have more than 2000 k of simultaneous connections without performance problems.
    see that if you use FIREDAC it may not use MSOLEDB to connect but ODBC


    I use SDAC.

    https://learn.microsoft.com/pt-br/sql/connect/oledb/download-oledb-driver-for-sql-server?view=sql-server-ver16

    Is MSOLEDB 19.3.2 installed on the database server or client side on the web server?

    and I use ADOConnection to connect to SQL Server

    image.png.b387485dc411a20c456f8fa3c88a12b3.png

  5. On 11/15/2023 at 10:14 PM, Kos said:

    nginx   .conf

    
    split_clients "${remote_addr}AAA" $app_addr {
     30.0% "127.0.0.1:8075";
     30.0% "127.0.0.1:8077";
     *     "127.0.0.1:8078";
    }
    
    server {
     
     #...
     
     location / {
      proxy_pass http://$app_addr;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header Host $host:$server_port;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Host $host;
     }
     
    }

     

    Sir, how do I set it to read and save PDF files in the specified folder?

    because when using Nginx the PDF file is not readable, whereas using the hyperserver itself it can be read.

    Thank You

  6. On 11/14/2023 at 7:32 AM, 55143681 said:

    MY project in my office network,

    about seventy users,

    a *.exe runs fast.

    My application is accessed by more than 250 users.

    and before using UniGui, our SQL Server database had been running and accessed from 2012 with various performance tuning indexes, queries and partiton tables.

    If there is someone in this group whose application is accessed by more than 250 users and is stable and not slow, then please provide a solution.

  7. On 11/28/2023 at 7:45 AM, Sherzod said:

    Hello,

    This post may help you:

     

    thankyou Sherzod,

    and I use this for number formats but not for line charts.

    I've changed this
    position : line

    function chart.beforeInit(sender, config)
    {
        config.axes = {
            type: 'numeric',
            position: 'gauge',
            majorTickSteps: 5,
            renderer: function(axis, label, layoutContext) {
                return Ext.util.Format.number(label, "#")
            }
        }
    }
  8. and I use this for number formats but not for line charts.

    I've changed this
    position : line

    function chart.beforeInit(sender, config)
    {
        config.axes = {
            type: 'numeric',
            position: 'gauge',
            majorTickSteps: 5,
            renderer: function(axis, label, layoutContext) {
                return Ext.util.Format.number(label, "#")
            }
        }
    }
  9. On 11/19/2023 at 10:17 PM, Sherzod said:

    Hello,

    Try this approach:

    procedure TMainForm.UniFormCreate(Sender: TObject);
    begin
      UniDBVerticalGrid1.JSInterface.JSAddListener('afterrender', 'function(){this.setBorder(false)}');
    end;

     

    The border line is still showing, sir

    image.thumb.png.e9c6116fa9f4a8d77e1924371b20a5fb.png

     

×
×
  • Create New...