0

There's a website where information is available to view publicly and one can share that information anywhere but only by taking screenshots. I want to save it as pdf in my device for future reference.

I tried looking for ways on the web but nothing helpful found.

Here's the link of the PDF that I want to download: https://www.ibps.in/pdfview.html?pdfNameaHR0cHM6Ly93d3cuaWJwcy5pbi93cC1jb250ZW50L3VwbG9hZHMvQ1JQLVBPLUlYdmdndi1OT1RJQ0UucGRm

Instead of saving it to my storage as screenshot it would be much more user friendly to save it as PDF for future use.

Note: It takes a long time to load if you are visiting the link via smartphone or trying to open it using Google Chrome. I had to use Safari to open the link and it opened immediately.

Edit 1: Some people are having issues locating this link on website. To know how to reach this link kindly watch this, I have recorded a small video. Kindly use this link : https://youtu.be/cpAWQIPOIOg

Note to Superusers: I am surprised to see that despite being a genuine question it couldn't get the required attention it should have got. People without giving it a try considered it the link as expired or website is dead while that wasn't the case. The answer that I have accepted shows the depth of the question. Its sad how sometimes really good questions end up getting no upvotes at all. Not at all expected this response from Superusers.

12
  • This website is dead. After 1.5 hours on 3 browsers it has still not arrived.
    – harrymc
    Commented May 23, 2020 at 8:14
  • @harrymc No the website isn't dead. Try Opening the link in Safari Browser or UC browser if you are using mobile.
    – Heisenberg
    Commented May 23, 2020 at 12:04
  • @harrymc Which browsers did you use? It won't load in Google Chrome.
    – Heisenberg
    Commented May 23, 2020 at 12:05
  • Firefox, Chrome, Edge.
    – harrymc
    Commented May 23, 2020 at 12:23
  • @harrymc I don't know it's not working on those browsers. But it's working in UC browser using mobile and using Safari in PC. I have just checked.
    – Heisenberg
    Commented May 23, 2020 at 12:37

3 Answers 3

3
+50

Is that this one?

The url of this website can be broken down to https://www.ibps.in/pdfview.html?pdfName(base64 encoded URL of the PDF)

Decode that last part (using any one of many online base64 decoders) , and you get the link.

I can't verify if it's correct, since the pdf on the page itself won't load for me (Chrome refuses to load js scripts with MIME type 'application/octet-stream' instead of 'text/javascript')


Edit to expand on how I discovered the link:

I opened up the websites source code using the Inspect function of Chrome, then started reading JavaScript that attempts to display the pdf. At the end of the source there is part:

  /**
   * Asynchronously downloads PDF.
   */
  PDFJS.getDocument(url).then(function (pdfDoc_)

The url paremeter looked promising, so I looked where it was defined:

var url = Base64.decode(getParameterByName('pdfName'));  

Function getParameterByName:

    function getParameterByName(name) { 
        name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
        var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
        results = regex.exec(location.search);
        return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
    }

This function takes parameter name you give it, escapes any square brackets (adds \ before any [ and ] characters), and adds it to a regular expression that looks for a string looking like (in this example) ?pdfName=(any string not containing & or #). You can see how the regular expression works here.

Function then grabs the part of the website url after pdfview.html (using location.search) and applies to it the regular expression it made earier and if it matches, returning the part after = character.

This is where it all falls apart a little, since the URL provided doesn't contain any = characters and the function returns an empty string, but that's where humans pattern matching ability is better than computers - it's easy to see that the URL contains part ?pdfName, so the rest is probably the parameter we are looking for. All that was left was to stick the string aHR0cHM6Ly93d3cuaWJwcy5pbi93cC1jb250ZW50L3VwbG9hZHMvQ1JQLVBPLUlYdmdndi1OT1RJQ0UucGRm into a Base64 decoder and I was pleasantly surprised to see a working URL for the PDF file. I also suspected that, despite the name, the Base64 decoder used in the script wasn't completely standard, so I copied it's definition from the pages source code (var Base64={...), pasted it into console in Chrome DevTools and ran

Base64.decode('aHR0cHM6Ly93d3cuaWJwcy5pbi93cC1jb250ZW50L3VwbG9hZHMvQ1JQLVBPLUlYdmdndi1OT1RJQ0UucGRm')

to verify I got the same answer.


Sorry if this is too high level, but once you discover how to get one link, getting others using the same method is trivial: simply copy part of the address after ?pdfName to a base64 decoder and click decode to get the PDF link.

1
  • Wow! It works, amazing this is the best hack to get such link working. Can you please write a little elaborated answer so that I can accept it. Please write it from the point of view of a novice (person with little or no knowledge of computers functioning). Moreover I feel that the question should have some upvotes but that didn't happen, maybe because everyone thought that the link is not working but you nailed it.
    – Heisenberg
    Commented May 28, 2020 at 6:45
1

The direct link to PDF is visible in source code of the website:

http://221.135.110.204/website/career_pdf/CWEPO3_Reserve.pdf

Is this the document you were looking for?

6
  • No this is a different PDF but yes the one I was looking for is also available in the source code of the website. If you've got any other way to deal with this PDF please let me know.
    – Heisenberg
    Commented May 24, 2020 at 14:59
  • I have edited the question details, kindly have a look.
    – Heisenberg
    Commented May 24, 2020 at 15:00
  • I've seen the video and on my PC the PDF is not loading. What do you mean by "any other way to deal with this PDF"?
    – pbies
    Commented May 24, 2020 at 18:10
  • by any other way I mean apart from finding the link using source code using Is there any way other way to download this PDF? And in PC the PDF will load only if you're using Safari browser and if you are using smartphone then it will load only in UC browser. Try.
    – Heisenberg
    Commented May 24, 2020 at 20:00
  • Specific files can be downloaded only via direct link. Surely when website does not provide other option. Eventually you can write a script which can scrap webpages and search for links to download.
    – pbies
    Commented May 24, 2020 at 23:04
0

Generally speaking, you can print a web page on MacOS thru a PDF printer (by default). On windows, if you have a PDF printer, you also can print to a PDF.

If you want to store a webpage to a PDF file, simply print it as PDF.

You can then combine the pages using PDF manipulation tools.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .