![]() If you’re sure about your Windows architecture, you can directly use `System.loadLibrary(“fsdk_java_win32”) ` alone. It’ll automatically detect Windows type and detect the `dll` file. ![]() Use the following method to load the `dll` files based on your Windows architecture. Loading the Foxit Libraryįirst, you’ll need to load the `dll` files of the Foxit SDK to use it. This is available in the package `` of your web application.įor the sake of this tutorial, add all the methods in the next section to `GenerateAndRedactCustPDF.java` as static methods so they can be directly accessed using the class name. Name the helper class `GenerateAndRedactCustPDF.java`. Now let’s create the helper class that will load the Foxit SDK licenses and create and redact PDF files. Paste the copied files in the `webcontent/web-inf/lib` of your Eclipse web project. You’ll find a `fsdk.jar` and the `.dll` files relevant for 32-bit and 64-bit Windows.Ĭopy the `jar` file and the `.dll` file relevant for your Windows bit-`fsdk_java_win32.dll` if you’re using 32-bit Windows, `fsdk_java_win64.dll` if you’re using 64-bit Windows. You should have already downloaded the Foxit SDK from a link. Now, let’s configure the Foxit PDF SDK in your Java web application. Configuring the Foxit SDK For PDF Creation The HTML file is created and set as the homepage for your application. Use the exact filename you used while creating the HTML file (for example, `CustomerInput.html`). Open the `web.xml` file available in the `webcontent/web-INF` folder of your application. Next, you’ll need to set the created HTML file as the homepage of your application. – The `formmethod=”post”` attribute of the button specifies that the form is submitted using the POST method. – The `action` attribute of the form tag has a URL, which you need to update based on the servlet you create. Note that the content has a `form` which contains four input fields to accept First Name, Last Name, Social Security Number, and Credit Card Number for the customer. Update the `body` tag with the following content. ![]() Update the title in the `title` tag: Customer Input Form Click Finish.Ī new file will be created and opened with the following default content: It will show the preview of the code in the preview window. In the Select HTML Template window, select the HTML5 option. This will contain the code for the form data. Enter the filename `CustomerInput.html` for your new HTML file. In the New HTML File window, the WebContent folder is selected by default. Right-click on the web project you’ve created, click New from the pop-up menu, then HTML File. Next, you’ll create an HTML form to accept the customer data. You’ll also have a file called `web.xml`, which can be used to configure the homepage of your application and the servlet configurations (demonstrated later). This selection will automatically create a `web.xml` file in your project, which can be used to configure the web project settings as explained later in this tutorial.Įclipse will create a dynamic web project for you. Select the Generate web.xml deployment descriptor checkbox. Now let’s configure the project’s web module. Leave the settings unchanged and click Next. You’ll see the project source configuration window. Select the Dynamic Web Project in the Web categories, and click Next. Go to File, then New Project, and open the New Project wizard. Let’s begin creating your web application in your Eclipse workspace. – A PDF Service class to create the PDF using the Foxit SDK Creating a Dynamic Web Project – An `HTTPSerlvet` to act as an interface between the HTML form and the PDF Service class – A workspace for the sample application in Eclipse IDEįirst, divide your web application into three parts: – The Foxit SDK, extracted in your local folder – Apache Tomcat 9 to host Java web applications – The latest Eclipse IDE for Enterprise Java and Web developers Let’s begin by setting up a sample web application using Java and Eclipse IDE to accept customer data. This sample application is available on GitHub. In this tutorial, you’ll create a web application using Java which will accept credit card information from a customer, create a PDF file out of the information, and then redact the personal information using Foxit’s PDF SDK. In this case, you may need to redact or hide some of the data available in the PDF before sharing it. Obviously, not everyone who needs that file also needs to see all of that information, nor should they, due to various legal, security, and privacy reasons. However, it’s not an uncommon scenario to need to share a PDF that happens to include some personal information. PDF files usually meet this need perfectly. And when the information is digital, it’s important to preserve its content and format. Sharing information among various stakeholders is obviously important.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |