You will need to pass to this method the x/y position of your text, as well as the actual text. Note how for simplicity we allow the user to specify the y position measured from the top edge of the paper (whereas in fact PDF measures from the bottom). To achieve this we subtract the y value from the page height in the actual code ($this->_h - $y). Also note how actual text needs to be escaped to ensure that it is safely inserted into the file. Since text in the PDF file is denoted using parentheses around it, any parentheses in the text itself should be escaped. The best solution is to create a separate function to handle any cases when text needs to be inserted safely. This will be used a couple of times in this tutorial, but it will also be useful if you add more functionality to this class later.
blog comments powered by Disqus |