PDF Resume From HTML
This guide will demonstrate the process of creating a simple resume from an HTML using UniHTML.
Before you begin
You should get your API key from your UniCloud account.
If this is your first time using UniPDF SDK, follow this guide to set up a local development environment. To set up a UniHTML server follow this getting started guide.
Clone the project repository
In your terminal, clone the examples repository. It contains the Go code we will be using for this guide.
git clone [email protected]:unidoc/unihtml-examples.git
Navigate to the resume folder in the unihtml-examples directory.
cd unihtml-examples/resume
How it works
First the necessary dependencies are imported, and the code is initialized with the metered license key.
The main function which contains the code that process an input HTML file and produces the PDF document is defined in lines 25-75. First the number of command line arguments is checked to make sure that the server address is provided.
Then the code in line 33 tries to establish connection to the HTML server using the provided address. Line 39 instantiates a Creator object. Then line 42 creates a unihtml.Document that is used as a drawable later when generating the PDF. This is done in line 51 by calling the Draw method of the Creator object.
In line 66 the document is written to a file using c.WriteToFile("resume.pdf").
Run the code
Run the code using the following command to generate the PDF file. Replace the server address with the actual address. E.g. localhost:8080 for a server running locally on port 8080.
go run resume.go <server address>
Sample output
