Basically my task was to get content from PDF or Word Document file and store into the mysql database. Here I am going to show you how we can extract the content from PDF as well Word Document file and print or display. I am using Ubuntu 14.04 along with the PHP 5 installed, I am also.
- PHP Tutorial
- Advanced PHP
- PHP Form Examples
- PHP login Examples
- PHP AJAX Examples
- PHP XML Example
- PHP Frame Works
- PHP Design Patterns
- PHP Function Reference
- PHP Useful Resources
- Selected Reading
This chapter will give you an idea of very basic syntax of PHP and very important to make your PHP foundation strong.
Escaping to PHP
The PHP parsing engine needs a way to differentiate PHP code from other elements in the page. The mechanism for doing so is known as 'escaping to PHP'. There are four ways to do this −
Canonical PHP tags
The most universally effective PHP tag style is −
If you use this style, you can be positive that your tags will always be correctly interpreted.
Short-open (SGML-style) tags
Short or short-open tags look like this −
Short tags are, as one might expect, the shortest option You must do one of two things to enable PHP to recognize the tags −
- Choose the --enable-short-tags configuration option when you're building PHP.
- Set the short_open_tag setting in your php.ini file to on. This option must be disabled to parse XML with PHP because the same syntax is used for XML tags.
ASP-style tags
ASP-style tags mimic the tags used by Active Server Pages to delineate code blocks. ASP-style tags look like this −
To use ASP-style tags, you will need to set the configuration option in your php.ini file.
HTML script tags
HTML script tags look like this −
Commenting PHP Code
A comment is the portion of a program that exists only for the human reader and stripped out before displaying the programs result. There are two commenting formats in PHP −
Single-line comments − They are generally used for short explanations or notes relevant to the local code. Here are the examples of single line comments.
Multi-lines printing − Here are the examples to print multiple lines in a single print statement −
Multi-lines comments − They are generally used to provide pseudocode algorithms and more detailed explanations when necessary. The multiline style of commenting is the same as in C. Here are the example of multi lines comments.
PHP is whitespace insensitive
Whitespace is the stuff you type that is typically invisible on the screen, including spaces, tabs, and carriage returns (end-of-line characters).
PHP whitespace insensitive means that it almost never matters how many whitespace characters you have in a row.one whitespace character is the same as many such characters.
For example, each of the following PHP statements that assigns the sum of 2 + 2 to the variable $four is equivalent −
PHP is case sensitive
Yeah it is true that PHP is a case sensitive language. Try out following example −
This will produce the following result −
![Linux Linux](/uploads/1/2/5/2/125290820/942311146.jpg)
Statements are expressions terminated by semicolons
A statement in PHP is any expression that is followed by a semicolon (;).Any sequence of valid PHP statements that is enclosed by the PHP tags is a valid PHP program. Here is a typical statement in PHP, which in this case assigns a string of characters to a variable called $greeting −
Expressions are combinations of tokens
The smallest building blocks of PHP are the indivisible tokens, such as numbers (3.14159), strings (.two.), variables ($two), constants (TRUE), and the special words that make up the syntax of PHP itself like if, else, while, for and so forth
Braces make blocks
Although statements cannot be combined like expressions, you can always put a sequence of statements anywhere a statement can go by enclosing them in a set of curly braces.
Here both statements are equivalent −
![Example Example](https://www.nayuki.io/res/what-are-binary-and-text-files/binary-file-in-application.png)
Running PHP Script from Command Prompt
Yes you can run your PHP script on your command prompt. Assuming you have following content in test.php file
Now run this script as command prompt as follows −
It will produce the following result −
Hope now you have basic knowledge of PHP Syntax.
The PDF format is one of the most popular formats because of the ease of use. When you send a file in the PDF format, you can be sure that the formatting will be preserved. Further, there is provision to password lock a PDF or encrypt it and thus the security factor stays intact. This is why a lot of people want to convert their file into PDF. In this article I will tell you how to create PDF on Mac and Windows with the best PDF creator.
Part 1. Best PDF Creator that You Can't Miss
iSkysoft PDF Editor 6 Professional for Mac - The Best Way to Create PDF
There are plenty of PDF file creators which promise to help you convert plenty of file formats to PDF; however, the ease of use and robustness offered by iSkysoft PDF Editor 6 Professional for Mac (PDF Editor 6 Professional for Windows) makes it stand out.
- It is supported on a lot of different operating systems including Windows and Mac.
- It can create PDF files from varying formats which includes: MS Word, PowerPoint, Excel, Text, HTML, EPUB, Images and more.
- Easily edit your pdf files like you work on MS Word.
- You can add markup and annotations to your pdf files.
- It offers you the provision to batch convert your file.
- You can split, merge or even combine different pdf files.
- You can add password to your pdf files and even encrypt it.
How to Create an Editable PDF on Mac (Sierra Included)
These are some of the main features and benefits which this software has to offer. Now let us see how to create PDF files from different file formats.
Step 1. Load PDF to the Program
Launch the iSkysoft PDF Editor 6 Professional for Mac on your system after having downloaded it. In the main application window, click on the 'Create PDF' tab. A new dialog box will pop up and then you need to move to the folder where your input file is stored. Click on 'Open' for loading the file on your system. This will import the file on your software.
Step 2. Edit Your File (Optional)
In order to edit the file before you finally save it to PDF, you can move to the Edit button. Under the 'Edit' option, you can click the different toolbars like 'Add Text'. Simply double click the parts which you want to edit and make the modifications. To annotate PDF, you can find corresponding options under the 'Markup' button.
Step 3. Save to a PDF File
Move to the 'File' option and choose 'Save As' in the dropdown. In the new dialog box that opens, simply enter PDF as format and name your file. Hit 'Save'.
Part 2. How to Create a PDF Document on Windows (Windows 10 Included)
When you have a Windows PC where you need to convert your files to PDF format, the iSkysoftPDF Editor 6 Professional for Windows is available. Here are the steps which you need to follow.
Step 1. Add Your File to the Program
Launch the iSkysoft PDF Editor 6 Professional for Windows. In the application window, you will find an option called 'Create PDF'. Hit it and then a dialog box will open which will prompt you to select the file which you desire to convert. Click on 'Open' after having navigated to the desired folder.
Step 2. Modify Your Document (Optional)
When the file has been imported, the next step is to make modifications to the file, as needed. You need to hover to the 'Edit' tab and click it. This will open the editing mode. Double click any area which you need to modify and then add text, delete it or even alter attributes of images as well.
Step 3. Create a PDF Document
When you are done with the editing work and you have the final file which you need to convert, move to File and then choose 'Save As' from the list.
In the dialog box that opens, choose PDF as the output format and name your file as well. Choose a destination folder where you want to save your pdf. Then click 'Save' to confirm your choice.