We need to pass `disableFontFace` and `nativeImageDecoderSupport` because Node.js has no native support for `@font-face` and `Image`. Doing so makes it possible to render e.g., the Tracemonkey paper, which failed before. I made this PDF file the default because it's also the default in other examples/demos and because it showcases the possibilities better than the very simple hello world PDF file. Building the library with `gulp dist-install` is easier and is already recommended in the other examples.
		
			
				
	
	
		
			18 lines
		
	
	
		
			406 B
		
	
	
	
		
			Markdown
		
	
	
	
	
	
			
		
		
	
	
			18 lines
		
	
	
		
			406 B
		
	
	
	
		
			Markdown
		
	
	
	
	
	
## Overview
 | 
						|
 | 
						|
Example to demonstrate converting a PDF file to a PNG image using the PDF.js library.
 | 
						|
 | 
						|
## Getting started
 | 
						|
 | 
						|
Install the dependencies and build the PDF.js library:
 | 
						|
 | 
						|
    $ npm install
 | 
						|
    $ gulp dist-install
 | 
						|
 | 
						|
Install the Node canvas library and run the example to convert the first page of a
 | 
						|
PDF file to a PNG image:
 | 
						|
 | 
						|
    $ npm install canvas
 | 
						|
    $ cd examples/node/pdf2png
 | 
						|
    $ node pdf2png.js
 |