Jump to content

FPDF Finding the abscissa and ordinate


bruckerrlb

Recommended Posts

I'm using fpdf to generate pdf's on the fly here, basically how it works is I have my variables print out directly on an image using the text() function. The text function has a few paramaters, directly from the fpdf website

Parameters

x
Abscissa of the origin.
y
Ordinate of the origin.
txt
String to print.

 

I'm having a problem finding the "origin". I'm using graphclick to find these two parameters, but I'm wondering if anyone can recommend an application or another method for finding this (app can be mac or windows)

 

Link to comment
Share on other sites

Sure, my problem is I'm trying to identify the points where I want my variables to print. Basically there's an unfinished project and I'm trying to finish it, in order to finish it, I have to make more pdf's on the fly. I'm using his example to turn an image into a PDF, and printing variables on the image, which will then be turned into the pdf. The main problem here is I can't figure out how he got his coordinates. Like when you say you used dimensions in mm, what program did you use to find out how far away in mm what your looking for was.

$pdf->Text(16,32,"$City, $Zip");

Here's an example of something getting printed out, the parameters 16 and 32 are the x and y, and the two variables are what it's going to print out, I'm using mm also, but just don't see how he came to the conclusion that it was 16mm horizontal and 32mm vertically, I"m looking for a way I can figure out what the x and y value will be. I've been trying to get the values with graphclick, but it's giving me plots in some unit of measurement that isn't mm, or I"m using it completely wrong.

 

I don't want to just "guess" because this will take years lol, but am running out of other options since I just can't seem to find a way to plot two points

Link to comment
Share on other sites

Assuming I know what format I'm generating (A4 usually) I know (by heart actually) it's dimensions in are 210mmx297mm. So whenever I create a new PDF script, I know roughly where I want to put my objects, and I use these rough dimensions. Then I generate PDF and do fine tuning until I (or my boss) are satisfied.

graphclick is probably giving you domensions in pixels. Knowing pictures resolution in dpi (you can check it with IrfanView for example) you can calculate how many pixels are there per one mm of your picture.

For example, 72dpi picture has 72 pixels per inch (way too little to look good when printed out). 1inch = 25,4mm so you have  72/25.4 = (approx) 2.83pixels per mm.

For 300dpi picture it's more like 11.8 pixels per mm.

 

Link to comment
Share on other sites

This is a great tutorial here, I appreciate it! Graphclick was giving me dimensions in pixels. I'm trying to take the example you gave me and use the formula to convert pixels to mm (working with an A4 and 300 DPI), but it's just adding up for me, so I'm going to do some fine tuning like you said you do, at least to get the first point to figure out wtf is going on here.  I appreciate your explanation, and I"m sure I'll be using it as a reference here for while I'm doing the fine tuning. Thanks again

Link to comment
Share on other sites

  • 2 weeks later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.