Forum moved here!

Home / How to open online pdf files

Ahmad_Hilles

Greetings
I need to open some pdf files without downloading.
I tried using windows cmd with command line arguments in documentation.
But it keeps saying error loading?

I’m trying on this link:

Have anyone tried to do it before

GitHubRulesOK

ALL PDF reader / viewers (even acrobat online plugin reader or a browser extension) for inline reading MUST send a request for a DOWNLOAD, handing over your device IP address and details (you may not always see that request) The PDF is decompressed in the device (mobile PC or local server) then the rendering is uploaded to the screen and downloaded to your eyes for upload to your cognitive reception memory.
THUS no way to avoid upload or download the PDF HAS TO BE stored in the local device where you can modify, read or extract its contents without running embeded code for viewing.

You can call for a remote file within SumatraPDF and it will be invisibly downloaded to your browser cache where it will be stored while you view it but may after your done be deleted by the browsers system settings.

GitHubRulesOK

Hmm that is different to simply either opening or printing an existing file so the windows system does not allow for that “missing” local file in one cmd (a LAN file on local \\server\file.pdf should work). You should get something like

image or similar

You need two separate actions first to download to %temp% so assuming you have Windows 10/11 (different for windows 7/8 as it does not have curl)

curl -o "%temp%\temp.pdf" "https://www.cyberciti.biz/files/sticker/sticker_book.pdf"

then

"C:\Program Files\SumatraPDF\SumatraPDF.exe" -print-to-default "%temp%\temp.pdf"

you can combine into one line using &&
HOWEVER that will not allow for checking if there was a download error due to password or other requirement for download. but && should fail to start SumatraPDF if a download errorlevel is raised.

curl -o "%temp%temp.pdf" "https://www.cyberciti.biz/files/sticker/sticker_book.pdf
" && "C:\Program Files\SumatraPDF\SumatraPDF.exe" -print-to-default "%temp%\temp.pdf"

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 1591k  100 1591k    0     0   470k      0  0:00:03  0:00:03 --:--:--  470k
Ahmad_Hilles

thanks
I did the same but using autohotkey

^q::
Input, OutputVar, B L1, {LControl}{RControl}{LAlt}{RAlt}{LShift}{RShift}{LWin}{RWin}{AppsKey}{F1}{F2}{F3}{F4}{F5}{F6}{F7}{F8}{F9}{F10}{F11}{F12}{Left}{Right}{Up}{Down}{Home}{End}{PgUp}{PgDn}{Del}{Ins}{BS}{CapsLock}{NumLock}{PrintScreen}{Pause}
if OutputVar is not integer
{
return
}
UrlDownloadToFile, %clipboard%, "localpath"
if (errorlevel = 1)
{
    MsgBox File doesn't download.   
return
}
else if FileExist("localpath")
{
clipboard := ""
RunWait SumatraPDF.exe /print-to-default /print-settings %OutputVar%x "localpath"
Loop
{
Sleep 1000
FileDelete, "localpath"
    if (errorlevel > 0)
        break
    if (errorlevel < 1)
        continue
}
}
return
Ahmad_Hilles

could you please change the url = i posted it by mistake
since I don’t have the privilege to post it
please use this instead

thanks alot

GitHubRulesOK

Ok changed to use previous example