Sublime Forum

PDF View in ST3

#1

Hi,

I mostly use ST3 to write LaTeX documents, e.g. papers or documentation and stuff like that. It is great for that job, especially when the LaTeXtools package is used, or if I use my self-written plugin which has some even more handy features. However, it would be gread if a PDF could be displayed directly inside the editor.
For instance, one could have a 2-column layout with the LaTeX code on the left and the generated PDF ond the right. This would be absolutely sublime! In fact, it is the only feature which Atom has which I am missing in ST3.
For those who would like to argue “ST3 is a text editor, not a PDF viewer!” I agree, yes it is a text editor, however, it can also display images out of the box (jpg and png, I think). Why not PDFs?
Just an idea :slightly_smiling:

4 Likes

#2

I guess it would be possible to create a plugin to render a PDF as an image :slight_smile:

0 Likes

#3

Yup, that would definitely be possible. However, it sounds like a kind of workaround, doesn’t it? it will produce thousands of temp files and would probably be damn slow. However, it would be worth a try, but I absolutely don’t have any idea where to start :slightly_smiling:
But I just wanted to add some things: in my opinion, the PDF view function would not need to have all that fancy stuff like adding comments, or let the user edit the PDF itself. Instead, just a plain, dumb display of a PDF would be needed, that’s all.

0 Likes

#4

I wonder what @Jps or @wbond think of this idea?

0 Likes

#5

This is my personal opinion, without any “official” hat on.

I’ve spent time working on PDF parsing and serialization before. Just that alone take a good amount of effort, then working with all of the presentation elements of PDFs, you would have to devote a massive amount of effort to be able to implement it. Font rendering, transformations, embedded file types (tifs are common), hyperlinks to pages, annotations, encryption, and the list goes on. The spec is 1300 pages long. :smile:

I mean, there are PDF viewers that are larger than all of Sublime Text is. And there are crazy security issues with PDFs since they can embed raw JavaScript. Heck, Apple has plenty of resources, yet their PDF functionality in Preview doesn’t handle certain type of encryption, and has trouble rendering certain files properly. It also isn’t that hard to crash Preview with a valid, but poorly constructed PDF.

In the end, would producing a very basic, limited PDF viewer that works sometime be better than devoting those resources to the existing Sublime Text functionality and use cases? My gut instinct is no.

6 Likes

Inline markdown preview
#6

Yeah I know. But I think you wouldn’t have to create the PDF view from scratch. There is a lot of existing code which I think could be reused.
On the other hand, it would be great if there was some sort of API which could then be used to make a plugin for PDF. The idea from Keith is not so bad but suffers from some issues like scrolling or zooming.

0 Likes

#7

Atom can utilize that someone wrote a pdf reader in javascript. As for sublime text, why does it matter that the two windows aren’t from the same program? The previewer can already automatically refresh the view as you compile the file, and you can easily arrange the windows in two columns as you describe. Windows and [many window managers in] Linux both already have features to easily arrange windows in a split view, and while I can’t remember whether mac have gotten around to adding similar features, I know that the program Cinch will give you split screen features without a hassle.

Thus, the problem seems pretty pre-solved to me.

5 Likes