In this case, since we have set the error policy to “return” we are checking for a -1 (the error code) to see if we need to get the error. The call to get_errmsg gets the most recent error the PDFlib object has. The above code shows a way of trapping for these errors so we can catch and rectify them while building our solution. A second call to begin_document here would throw an error. When we call begin_document we move into the “document” scope. When we initialize the PDFlib object we are within the “object” scope. In PDFlib functions can only be called within the proper scope. Now we need to introduce the idea of scope. Now add the following lines to your solution: Replace “my_license” with the license you obtained in order to use the PDFlib class. The second policy sets your license key which allows you to use the class. The first call to set_parameter sets the error policy to “return” which means we want methods that encounter an error to return an error code as opposed to throwing an exception. This class is what allows us to create new pdf documents. Using the PDFlib_dotnet library now lets us create an instance of the PDFlib class. Do this as well as copy the following code in the Main method into your solution: You should see the reference now in your Solution Explorer.Īfter this you can add a Using reference to PDFlib_dotnet. Navigate to where you have saved the pdflib_dotnet.dll file and add that reference to the solution. Once you have done this go to your Solution Explorer and right click on References and click Add Reference. Since PDFlib 7 is somewhat old, the useLegacyRuntimeActivationPolicy parameter allows us to load it in. Open it and copy what you see below there. You should now have a solution that looks like this:īefore we get started go to your Solution Explorer and find App.Config. In the dialog that appears select Visual C# from the templates menu and then select Console Application. Open Visual Studio and select File->New->Project. We will begin by creating a new Console Application in Visual Studio. This post will attempt to introduce users to the initial setup of a PDF creation program as well as the basic features and concepts behind the PDFlib toolkit. VDS uses this toolkit in some of our solutions to produce PDFs for forms, invoices, and photo albums. The PDF Lib toolkit is software designed to simplify the programmatic creation of PDF files. Net Framework can be obtained from Microsoft here. This post also assumes you have installed Visual Studio and the. This post assumes you have purchased the PDFLib toolkit and have obtained a license key.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |