Jump to content

Archived

This topic is now archived and is closed to further replies.

bruckerrlb

FPDF Finding the abscissa and ordinate

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)

 

Share this post


Link to post
Share on other sites

origin is top left corner of given pdf page.

Share this post


Link to post
Share on other sites

Thanks, do you know a program or method that could be used for finding the points from the origin? I know this belongs in a math forum but if you had to find the coordinates for this, how would you go about doing that?

Share this post


Link to post
Share on other sites

I just set up my unit to mm and position everything using dimensions in mm. Perhaps if you could be a bit more specific in describing your problem?

Share this post


Link to post
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

Share this post


Link to post
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.

 

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Turns out I could find the coordinates in photoshop, I just needed to find the first one, and then could move my image to be based off that one point and it works great!

Share this post


Link to post
Share on other sites

×
×
  • 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.