How to Convert PHP to PDF

by Michelle Carvo ; Updated September 29, 2017

PHP code files are commonly used in web development. You can convert PHP to PDF using either built-in options on your operating system or with third-party tools.

Converting PHP to PDF in Windows 10

Convert a PHP file to PDF using Microsoft’s built-in Print to PDF function in Windows 10. Open your PHP file in a code editor or browser, then click “File” and “Print.” Select “Microsoft Print to PDF” as your printer, then click “Print.” Type in a name for your PDF file and save the PDF to your desired location.

Converting PHP to PDF in Windows 7/8

Unlike Windows 10, Windows 7 and Windows 8 do not have a built-in Print to PDF function. There are several other options for converting a PHP to PDF, however.

Google Chrome

Google Chrome has a “Save as PDF” option built into the browser. Open your PHP file in Google Chrome, then right-click anywhere on the page to open a quick menu. Click “Print” and then click the “Change...” button next to the “Destination” option. Select “Save as PDF” and then click “Save.” Enter a name for your PDF file and click “Save” again to convert your PHP file to PDF.

Mozilla Firefox

Mozilla Firefox also has a “Save as PDF” option that built into its browser. Open the PHP file in Firefox, then click “File” and “Print.” Click the “PDF” drop-down in the Print options menu, then “Save as PDF.” Type in a name for your PDF file and click “Save” to save the PHP file as a PDF.

Third-Party Tools

Free PDF Converter allows you to upload any file to its site and convert it to PDF. Adobe Acrobat can also save any file to a PDF. Online2PDF and Microsoft Word can also save your PHP code as a PDF file. Online2PDF works within any web browser; just upload the PHP code file to the site to convert it to a PDF that you can then save on your computer.

Microsoft Word has a built-in Save as PDF function on all versions of Office after Office 2007. You can save files as a PDF on Office 2007 by installing the Save as PDF add-on (see Resources).

Converting PHP to PDF in Mac OS

Much like Windows 10, Mac OS makes creating PDFs easy from just about any program. Open your PHP file in most Mac applications and click “File,” then “Print” and choose “PDF” as your printer, then “Save.” If there is no Print option in the application that you are using, simply open the PHP file in Safari and use the Print to PDF option there.

Tip

  • check Instead of using an online conversion tool to convert a PHP file, it is also possible to install a PDF printer, such as Primo PDF, to print the page to a PDF file. See Resources.

Items you will need

About the Author

Catherine Hewson has been writing professionally since 2006, contributing to a variety of websites. She is also a technical writer with extensive experience in Android/iPhone development and PC repair. Hewson holds a Bachelor of Science in computer information systems from the University of Michigan-Flint and works as an IT project manager.

Photo Credits

  • photo_camera Comstock Images/Comstock/Getty Images