Hi,
I have the following problem: The mouse and viewer coordinates in TIF files work fine, but when the opened file is a PDF, the resulting coordinates differ. I have a label which shows the coordinates of the mouse pointer in the document.
For example: the viewer loads a PDF with bestFit. Here I move the pointer down to the bottom and the label says, lets say, Y=500. Now, when I zoom in to double the size, I scroll down to the bottom, move the pointer over the bottom line and the label says Y=1000. As I said, this only happens on PDF files. With TIF files the label gives me always the same coordinates, no matter what zoom mode is chosen (as I think it should be).
Why are the coordinates handled differently and how can I convert them? I think there are no methods to get the coordinates in pixel for PDF.
Thanks for any help
Different coordinates on PDF and TIF files
Re: Different coordinates on PDF and TIF files
Hi,
PDF is a vector format with user space coordinates & TIFF a raster format with Pixel coordinates.
What I can suggest you is to use Inches coordinates according to the following formula. This will works with both image & PDF formats:
Let me know if you need more information.
Loïc
PDF is a vector format with user space coordinates & TIFF a raster format with Pixel coordinates.
What I can suggest you is to use Inches coordinates according to the following formula. This will works with both image & PDF formats:
Code: Select all
Dim WidthInches As Double = GdViewer1.PageWidth / GdViewer1.HorizontalResolution
Dim HeightInches As Double = GdViewer1.PageHeight / GdViewer1.VerticalResolution
Loïc
Re: Different coordinates on PDF and TIF files
Thanks for the help, I solved the problem.
The tricky thing was that I had to create regions based on pixel coordinates and I was a bit confused about the changing resolution. But with the DPI count of the document and your suggested formula it can be converted
The tricky thing was that I had to create regions based on pixel coordinates and I was a bit confused about the changing resolution. But with the DPI count of the document and your suggested formula it can be converted
Who is online
Users browsing this forum: Ahrefs [Bot] and 1 guest