
PDF Viewing - gjtorikian
https://github.com/blog/1974-pdf-viewing
======
fiatjaf
Now they are going to show json, xml, yaml, graphviz, audio files, video
files, display docx, xlsx, pptx, prettify your minified code, build a database
for you from SQL backups and let you query it, set up an environment from your
.env files and give you a shell prompt, show you a rendered DOM from your HTML
files and virtual dom declarations, display structured data from microformats,
microdata and json-ld, let you query structured data from inside files so
GitHub can be really used as a database, deploy your app, run your code and
search for actual and potential errors, find your lost TV remote, wash your
car and cook your dinner.

This is partly serious and I think GitHub is awesome.

~~~
lbotos
Zawinski's law - "Every program attempts to expand until it can read mail.
Those programs which cannot so expand are replaced by ones which can."
Humorous and relevant.

~~~
joshschreuder
Is that the same Jamie Zawinski of the "Some people, when confronted with a
problem, think 'I know, I'll use regular expressions.' Now they have two
problems." [1] fame?

[1]
[http://regex.info/blog/2006-09-15/247](http://regex.info/blog/2006-09-15/247)

~~~
jpatokal
Yes.
[https://en.wikiquote.org/wiki/Jamie_Zawinski](https://en.wikiquote.org/wiki/Jamie_Zawinski)

Following his blog is a unique (but not always work-safe) pleasure.
[http://www.jwz.org/blog/](http://www.jwz.org/blog/)

------
kibwen
I'm not sure whether this is due more to the efforts of the PDF.js team or the
Spidermonkey team, but I'm very pleased at the progress the project has made
over the past year. Upon reading this story I happened to realize that I've
had a 57-page PDF open in a separate tab for several days now on this five-
year-old netbook with no performance or memory problems whatsoever (something
that couldn't be said a year ago). I can't even remember the last time that
I've had to resort to Foxit. Here's hoping that Shumway can do the same for
Flash!

~~~
nnethercote
Woo!

------
bentcorner
That gif went by _way_ too fast.

If anyone is confused like me: It looks like Github will now show PDFs inline.

It took me a minute to figure out that the GIF was a demo (and this had
nothing to do with rendering PDFs into realspace using a 3d printing robot),
and the page was from github's official blog.

~~~
long
There really needs to be a standard "pausible gif" format for stuff like this

~~~
yellowapple
You mean webm? :)

~~~
long
I actually mean a format where (1) the number of frames is quite small and (2)
the pauses between frames are there by default and transitions have to be
triggered by a user action.

------
adriancooney
If GitHub continues on this track of making content available directly in the
browser, the use cases are endless as a service. When someone, and someone
will, makes git accessible to the general public, features like these will
propel GitHub into the general consumer space.

~~~
Amorymeltzer
As it stands, git is apparently the only barrier to GitHub being used widely
as a backup, file transfer, and website hosting service.

~~~
xasos
That's what we attempted to solve with LetsGit[1], a hacky way for non-
developers/beginners to use Git to track their work.

[1] [http://LetsGit.herokuapp.com](http://LetsGit.herokuapp.com)
[https://github.com/xasos/LetsGit](https://github.com/xasos/LetsGit)

------
ushi
Checkout the pdfjs test suite, if you want to try it:

[https://github.com/mozilla/pdf.js/tree/master/test/pdfs](https://github.com/mozilla/pdf.js/tree/master/test/pdfs)

------
captainmuon
I don't understand it... what's the benefit of this as opposed to just
embedding an iframe? And whats the role of pdf.js here? They seem to just show
images of the pages - non interactive and non-selectable. When you are using
pdf.js, you can actually get a nice embedded viewer exactly like firefox has
(and similar to chrome). And the embedded pdf.js viewer would also be more
secure than the iframe, if that's your concern.

~~~
MrBuddyCasino
No its actually pdf.js rendered on a canvas [0]. But the text is non-
selectable it seems?

[0] see [https://github.com/papers-we-love/papers-we-
love/blob/master...](https://github.com/papers-we-love/papers-we-
love/blob/master/operating_systems/live-migration-of-virtual-machines.pdf)

~~~
volent
Wow, i don't know if it's because the pdf here is big but my computer froze
when I opened this link.

~~~
Oompa
That should definitely not happen. Does that consistently happen when you
click that link?

------
undrcvr-lagggal
I was not aware of github's new STL viewing ability. Viewing models from your
tools (such as from the source code that mentions them) is something TempleOS
has been able to do for a long time now [1].

1\. [https://youtu.be/naORDnsiht4?t=41s](https://youtu.be/naORDnsiht4?t=41s)

------
hobarrera
Any sane reason to store PDF files into git repositories? Why would you
version binary files; version LaTeX, or whatever's generating your PDFs.

~~~
NeutronBoy
The alternative is to store pdf-from-client-v1.pdf, pdf-from-client-v2.pdf,
etc

~~~
hobarrera
That doesn't address the proposed alternative: version the actual source file
(eg: lated?) rather than the PDF file.

------
pipeep
They seem to be rendering the documents at 2x, which is good for retina and 4k
displays, but means that it's slower on low-res displays, and the text's anti-
aliasing is at the mercy of the image scaling algorithm used.

Instead, they should render the documents at the actual resolution it's being
displayed with.

------
eridius
This seems potentially useful for people on some platforms, but speaking as
someone who uses Safari on OS X, I'd really much rather have the PDF be
embedded as an <object> or <iframe> and let OS X do the rendering.

------
klzns
It would be nice if I could make the README a PDF file, so it would render the
PDF on the front page of the repo. Like so:
[https://github.com/brenoc/testrepo](https://github.com/brenoc/testrepo)

Spoiler: It didn't work

~~~
nunull
Did you really just grap a HTML-file und renamed it to .pdf? Surely this
doesn't work.

------
marksands07
Unfortunately, I can't get a single paper to load on
[https://github.com/papers-we-love/papers-we-love](https://github.com/papers-
we-love/papers-we-love), at least on my laptop. I guess PDF.js is limited to
smaller PDF files or it just requires more GBs of RAM to support all file
sizes.

~~~
fiatjaf
[https://github.com/papers-we-love/papers-we-
love/blob/master...](https://github.com/papers-we-love/papers-we-
love/blob/master/digital_currency/peercoin.pdf) loaded fine here. My computer
is almost 10 years old.

------
jsnk
This is unrelated to the news, but what's the best way to create this sort of
screencast in OS X?

~~~
Oompa
I used Quicktime to do a screen recording before taking that to GifBrewery to
make the gif.

~~~
potch
I do this too- works great and GifBrewery is a nice tradeoff of quality and
usability.

------
tem5050
Glad to see that they've adopted pdf.js!

------
le_lenny_face
Congrats to the PDF.js team for the adoption.

I'm curious as to how the pdf2htmlEX project [0] compares to PDF.js. Instead
of client-side conversion this is a server-side one-time conversion from PDF
to HTML5.

[0]
[https://github.com/coolwanglu/pdf2htmlEX](https://github.com/coolwanglu/pdf2htmlEX)

~~~
liviu
I tried in past and I can tell you that pdf2htmlEX don't have acurate
rendering, even if is based on Poppler, because generates HTML code at
absolute position that looks different in every browser and have problems with
index of layers.

------
curiously
is there a way to render pdf into html that can be viewed in a browser?

~~~
hobarrera
pdf.js. It's the same thing github is using (as stated on the article), and
it's also what firefox uses to render PDFs (yes, firefox renders PDFs with
html+js).

~~~
FreeFull
Doesn't Chrome also use html+js to render PDFs? (but something different from
pdf.js)

~~~
aikah
Chrome uses a pdf plugin embedded in Chrome.

