Search code examples
pdfbinaryconverters

How to get .pdf file from remote server to local?


I have remote virtual server(oracle linux 7.6) contain .pdf file and I open this with Firefox.

Remote server block external network. but I can select, copy string from remote to local. how to get .pdf file to local ?

i think of two solution :

  1. open file pdf with firefox. Then open developer mode after copy html to local. but impossible.
  2. the first convert file PDF to binary file. Then copy binary code to local machine. Finally, covert binary file to PDF. pls, help me. Thank you so much ?

Solution

  • If by “copy string from remote to local” you mean you have command line access to the remote server, you can output the contents of the pdf and encode it with base64 to make the output a selectable, copyable string on the command line.

    If the remote server is running BASH (a Linux server), you can encode a pdf to a base64 string with:

    cat /dir/with/file.pdf | base64
    

    Assuming the psf is in the path /dir/with and is named file.pdf

    To decode it back to a pdf on the local system (also using BASH):

    echo "theStringThatWasOutputted==“ | base64 -d > localfile.pdf
    

    This will save the pdf locally as localfile.pdf