How to Create a PDF on a Server From HTML

How to Create a PDF on a Server From HTML thumbnail
Create a PDF document on an HTML page.

PDF is a standard format created by Adobe that allows users to publish and distribute content. The content is contained on a document that is read-only, which means the content you publish is protected from being edited. You can automate the creation of PDF documents using Javascript in your HTML pages. The PDF document is created and gives users the option to download it and save a copy to their machines.

Instructions

    • 1

      Create a PDF object. The PDF object contains all the functions and properties used to create the PDF document. The following code creates your object:

      pdf = new pdf$();

    • 2

      Set the font size. The "setFontSize" function sets the font size for your page. Use the following code to set the font:

      pdf.setFontSize(12);

    • 3

      Add some text to the file. You can add one or several lines of text to your PDF. The following code adds a simple line of text to the file:

      pdf.addText('My First PDF File');

    • 4

      Write the text to a file to your web server. This file is created and your user has the option to view and save it. The following code creates your file:

      pdf.writeToFile('/pdf_files/sample_header.pdf');

Related Searches:

References

  • Photo Credit document image by AGphotographer from Fotolia.com

Comments

You May Also Like

Related Ads

Featured