## 3.3 Loading PDFs as anims

Alternatively, the plugin offers to load an entire PDF document into a Hollywood anim object. You can then access the individual pages by simply obtaining the anim's frames.

Here's how to load a PDF document as a Hollywood anim:

    LoadAnim(1, "test.pdf", {FromDisk = True})
    For Local k = 1 To GetAttribute(#ANIM, 1, #ATTRNUMFRAMES)
       DisplayAnimFrame(1, #CENTER, #CENTER, k)
       WaitLeftMouse
    Next

The code above shows all pages of a PDF document. You need to press the left mouse button to skip to the next page.

Note that we set `FromDisk` tag to `True` in our `LoadAnim()` call. This is very important because otherwise all PDF pages will be loaded and buffered in memory which can be a huge waste with larger PDF documents.

Of course, you could also load the PDF document with the @ANIM preprocessor command instead of `LoadAnim()`.

Show TOC