First identify if you are using this approach to print to PDF.

Using manual URL manipulation to generate the export link for the sheet.

This approach relies on Google to maintain the URL to be the same. However Google will always changes and make the product better. 

Therefore they will change the URL very often which is not a feasible way to implement the export to PDF.


The more sustainable approach is to use Google's library. For the example below, it uses SpreadsheetApp and DriveApp library provided default within the Google App Script. 
When Google implement changes, these libraries are less likely to be changed that often. They only change it only when they really have to.


Here is an example code to download the download the sheet as PDF.

function downloadAsPDF( folderId ) {
  var pdfFile = SpreadsheetApp.getActiveSpreadsheet().getAs("application/pdf");
  var newfile = DriveApp.createFile(pdfFile);
  
  var destinationFolder = DriveApp.getFolderById(folderId);
  destinationFolder.addFile(newfile);
  DriveApp.getRootFolder().removeFile(newfile);
}