You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							24 lines
						
					
					
						
							737 B
						
					
					
				
			
		
		
		
			
			
			
		
		
	
	
							24 lines
						
					
					
						
							737 B
						
					
					
				| var mammoth = require("mammoth"); | |
| var pdf = require('html-pdf'); | |
| 
 | |
| function convertToPdf(inputDocFilePathWithFileName, outputDocFilePathWithFileName, callback) { | |
|   mammoth.convertToHtml({ | |
|       path: inputDocFilePathWithFileName | |
|     }) | |
|     .then(function (result) { | |
|       var html = result.value; // The generated HTML  | |
|       pdf.create(html).toFile(outputDocFilePathWithFileName, function (err, res) { | |
|         if (err) { | |
|           callback(err); | |
|           console.log(err); | |
|           return; | |
|         } | |
|         callback(null, res); | |
|       }); | |
|       var messages = result.messages; // Any messages, such as warnings during conversion  | |
|       console.log(messages); | |
|     }) | |
|     .done(); | |
| } | |
| 
 | |
| module.exports = convertToPdf; |