React PDF viewer
v1.6.0

Example: Preview a pdf file from an array of bytes

We can create an Uint8Array from array of bytes, and pass it directly as the fileUrl option:

<Viewer
    fileUrl={new Uint8Array([
        37, 80, 68, 70, 45, 49, 46, 55, 10, 10, 49, 32, 48, 32, 111, 98, 106, 32, 32, 37, 32, 101, 110, 116, 
        114, 121, 32, 112, 111, 105, 110, 116, 10, 60, 60, 10, 32, 32, 47, 84, 121, 112, 101, 32, 47, 67, 97, 
        ...
        83, 105, 122, 101, 32, 54, 10, 32, 32, 47, 82, 111, 111, 116, 32, 49, 32, 48, 32, 82, 10, 62, 62, 
        10, 115, 116, 97, 114, 116, 120, 114, 101, 102, 10, 52, 57, 50, 10, 37, 37, 69, 79, 70
    ])}
/>

(The sample code)

/ 1
231%
Hello, world!