How to add pdf page in UIPageViewController?

Script or hack to show PDF from /YYYY/MM/DD/*.pdf URL?

  • I just noticed that the NYT offers a PDF version of its print front page, which I'd like to be able to access without going through the extra clicks on the website. The file always has the same name as is located in a simple nested date format — but I have no idea how to script something to replace that every day in a new tab or add it to Rainmeter or the like. Any suggestions? Here's the current URL: http://www.nytimes.com/images/2014/05/15/nytfrontpage/scannat.pdf If I could put together a bookmarklet or some kind of scripted grab that would load up today's version of that or put it in a local folder, that would be wonderful. (I can't make rainmeter show a PDF) In case you can't tell, I'm pretty inexperienced in code, but thought this would be a good place to get some practical recommendations for where to start on a small thing like this.

  • Answer:

    MeFi filters JavaScript links, so I can't make this a draggable link/bookmarklet like I'd hoped. You'll have to copy the code below and paste it into a new bookmark manually created in your bookmark manager. When clicked, it will go to the day's front page. javascript:var d = new Date(); window.location.href = 'http://www.nytimes.com/images/'+d.getFullYear()+'/'+(d.getMonth() < 9 ? '0'+(d.getMonth()+1) : d.getMonth()+1)+'/'+(d.getDate() < 10 ? '0'+d.getDate() : d.getDate())+'/nytfrontpage/scannat.pdf';

BlackLeotardFront at Ask.Metafilter.Com Visit the source

Was this solution helpful to you?

Other answers

If I just wanted an easy way to see the thing, I'd do it in TextExpander (I'd guess Windows has something that could do the same thing). Something like: http://www.nytimes.com/images/%Y/%m/%d/nytfrontpage/scannat.pdf with a shortcut of .nytfront or something like that. Put the cursor in the location bar, type the shortcut and you're done.

brentajones

Good idea - I have phraseexpress which does that well - I'd like there to be something more automatic, though. Ideally it would just appear as a borderless front page on my desktop, like I'm passing by the paper dispenser on the street. I don't mind installing an app or engine or whatnot if it's necessary.

BlackLeotardFront

Here's a quick Windows PowerShell script that downloads each day's pdf. $today=get-date$url = "http://www.nytimes.com/images/"+$today.year.ToString()+"/"+$today.month.ToString("00")+"/"+$today.day.ToString("00")+"/nytfrontpage/scannat.pdf"$folderlocal = "C:\Dropbox\"$filelocal=$today.year.ToString()+$today.month.ToString("00")+$today.day.ToString("00")+".pdf"$localfull= $folderlocal+$filelocal$client = New-Object System.Net.WebClient$client.DownloadFile($url, $localfull)You could automate running this script through the task scheduler following the instructions http://blogs.technet.com/b/heyscriptingguy/archive/2012/08/11/weekend-scripter-use-the-windows-task-scheduler-to-run-a-windows-powershell-script.aspx

fjom

You could create a local html file and either bookmark it or use it as your front page: http://jsbin.com/yigezuma/4/edit?html - just paste the contents into a text editor (Notepad for example) and save as a .html file.

backwards guitar

I missed the last line of the script (to open the file with your default PDF reader):start-process $localfull

fjom

Thanks, these are useful. I can't get the PS script to work, though - it wants something different for start-process $localfull, though it does download the file. Not trying to make this a whole big Q&A on scripting, but if there's an obvious fix...

BlackLeotardFront

I don't have a lot of experience with Power Shell versions, but Notepad++ does not highlight Start-Process as a PS Action and it did highlight Invoke-Item which in this case does the same. So maybe if you try changing the last line to: invoke-item $localfull(both work on my PC)

fjom

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.