PDF Generation with Apryse PDFNet Node.js SDK

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
oh hi i'm andre the solution engineer at pdftron in this video i'm going to demonstrate how to get started with pdftron's node.js sdk let's jump in so first things first what i want to do is go ahead and create new folder where we're going to create our project so let's go ahead i'm going to call it node place it anywhere and let's open it up inside of the s code i'm just going to open up a new window we're going to go open a folder that we just created okay awesome so inside of it i'm going to open up my terminal and inside of the terminal i'm just going to type in npm init and what this command will do is create a new project okay perfect so i don't really care about any of those settings at the moment so we're just gonna go ahead code node version one description is fine entry point is gonna be index.js test command kid repository keywords author license everything looks good okay great let's create so now we created a brand new node project so inside of it let's go ahead and create a new file we're to call it index.js that's what we said the entry point is going to be uh and now we're actually going to go ahead and install the pdf that node so i'm going to type in npmi add pdftron pdf net node hit enter and it will download all the necessary dependencies you can see it downloaded all the necessary node module and dependencies we can take a look under add pdf trunk pdf node you can actually find tons of really helpful samples right here for example how to convert html to pdf how to convert office documents to your pdf and perform number of other functionality with the pdfs uh on node.js for example splitting merging uh and converting so for this example what i want to do is just simply generate a brand new pdf with nothing inside of it so to do that i'm going to go ahead and require pdfnet i'm going to destructure it from the export that we get require and inside of here perfect add pdf on pdf that note let's create a function that we're gonna run i'm just gonna call it main uh it's gonna be an async function and with no parameters inside of it and what it will do is first create a new document so let's call it doc and we will call our pdfnet pdf doc library and call create and then the next thing we want to create a brand new page so we'll say await pdf net oh uh away doc that create and let's push it onto our dock so we're just going to say page push back and then pass in the page we just created and then we're going to save it as a blank pdf and we're also going to save it with an option it's fdf and i really like linearize so what save option linearized is that it provides us with the ability to later stream the document to our client side so instead of for the whole document to download this save option allows us to stream it very similar to your video so right now you're watching this video and instead of waiting for the whole video to download first you actually start streaming it or buffering as the chunks coming in so we can do same thing with pdf pages very similar uh with the linearized option again if you want to learn more about literarization i'm going to post a link in the description of the video so now i actually want to run this command and we're going to call pdfnet run with cleanup we're going to pass in the main function and then we're going to catch any of the errors and we're just going to pass in an error callback and then we can console log that error if anything goes wrong otherwise we can just await uh that promise and then pass in a call back for success okay and then here we can so after we kind of completed using pdfnet we can successfully shut it down just so we don't use up any of the resources okay great this looks good to me so let's type in node index index.js and let's see what happens ah perfect and it's completed and as you can see here it created a blank pdf we can take a look and open it up with our reader and as you can see it created a blank pdf inside of it now this is just a video to help you get started with the pdf9 library what i'm going to do next is going to actually show you some of the useful examples for example how to generate pdf templates like invoices with data inside of them how to convert html to pdf how to generate thumbnails for a pdf and convert from mms office to pdf as well now to ensure that you stay tuned to all the videos coming out on our youtube channel hit that subscribe thanks so much for watching
Info
Channel: Apryse
Views: 10,803
Rating: undefined out of 5
Keywords: node js generate pdf, generate pdf node, node pdf, node pdf sdk, generate pdf, node pdftron, node pdfnet, pdf sdk node, pdftron node sdk
Id: gp2Es2xPxfc
Channel Id: undefined
Length: 6min 3sec (363 seconds)
Published: Tue Oct 20 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.