How to pdf export specific path ( Folder) ?

How to pdf export specific path ( Folder) ?

atulgoyalitatulgoyalit Posts: 4Questions: 1Answers: 0

I pdf export use in datatable then pdf download in download folder but i want to download pdf in specific folder like /pdf/

Answers

  • colincolin Posts: 15,237Questions: 1Answers: 2,598

    Hi @atulgoyalit ,

    That's down to your browser, the website has no control over that. The app can only modify the name of the file itself.

    Cheers,

    Colin

  • atulgoyalitatulgoyalit Posts: 4Questions: 1Answers: 0

    datatable pdf button click to download datatable in pdf in local but i want specific folder path

    oTable = $('#jsontable1').dataTable({

                                                dom: 'Bfrtip',                                                
                                                pageLength: 100000,                                                
                                                buttons: [
                                                           'pdf',
                                                        ]                                                                                                             
                                                    }); 
    
  • kthorngrenkthorngren Posts: 21,117Questions: 26Answers: 4,916

    Like Colin said that is a browser setting. Depending on your browser you would enable it to ask where to save each file for downloading.

    Kevin

  • colincolin Posts: 15,237Questions: 1Answers: 2,598
    edited May 2018

    Yep, see what I said before! Here's how you change the filename, as I said, the folder is down to the browser.

  • atulgoyalitatulgoyalit Posts: 4Questions: 1Answers: 0
    edited May 2018

    Yes i check @colin and @kthorngren When Pdf report download automatically without click then i want to save through coding save in specific folder in specific path not browser setting

    $(document).ready(function()
    {
    $("#jsontable1").dataTable().fnDestroy();

                                                oTable = $('#jsontable1').dataTable({
    
                                                dom: 'Bfrtip',                                                
                                                pageLength: 100000,                                                
                                                buttons: [
                                                           'pdf',
                                                        ]                                                                                                             
                                                    }); 
    
    
                                                    $(document).ready(function() 
                                                     {                
    
                                                        var user = $(this).attr('id');
                                                        if (user != '') {
                                                            $.ajax({
    
                                                                "bDestroy":true,                                        
    
    
                                                                 dataType: 'json',
                                                                 success: function(s) {
                                                                    //console.log(s);
                                                                    oTable.fnClearTable(); 
                                                                    var resultcount=<?php echo $result;?>;
                                                                      $n = 0;                                     
                                                                    for (var i = 0; i < s.length; i++) {
                                                                        oTable.fnAddData([ 
                                                                            ++$n,
    
                                                                         <?php
    
                                                                         for ($j=0; $j<$result+3; $j++)
                                                                         {
                                                                            echo 's[i]['.$j.'],';
                                                                         } 
    
                                                                         echo 's[i]['.($result+2).']';
    
                                                                         ?>     
    
                                                                         //s[i][j],
    
                                                                        ], false);
    
                                                                    } // End For
                                                                    oTable.fnDraw();
                                            **     //automatically pdf click**
                                              $('.buttons-pdf').click();
    
    
                                                                },
                                                                error: function(e) {
                                                                    console.log(e.responseText);
                                                                }
                                                            });
    
    
    
    
                                                        }
    
    
    
                                                    });
    
                                         }); 
    
  • colincolin Posts: 15,237Questions: 1Answers: 2,598

    I feel like I'm in Groundhog Day here...

  • atulgoyalitatulgoyalit Posts: 4Questions: 1Answers: 0

    No @colin Its serious situation discussion.

  • McAuMcAu Posts: 2Questions: 0Answers: 1

    @atulgoyalit Please learn how a website works: You cannot set a specific download directory for your users, because the browser doesn't allow it (for obvious security reasons). Your user has to specify which download directory should be used. This is something you are not allowed and cannot set for any user.

  • allanallan Posts: 63,075Questions: 1Answers: 10,384 Site admin

    Yes - this has now been answered multiple times and as the others have said you cannot do this.

    Closing this thread as asking the same question again will not change the answer.

    Allan

This discussion has been closed.