Microsoft Windows Phone 8.1 support ends (13 Jul 2017)

Microsoft has ended support for Windows Phone 8.1

Questions about iOS development and PDF

Add an Image on PDF

More
IP: 192.168.0.71 8 years 10 months ago #12403 by emanuele
Replied by emanuele on topic Add an Image on PDF
Hi,

you can convert your point to pdf coordinates with vGetPos method:
Code:
struct PDFV_POS annotPos; [m_view vGetPos:&annotPos :point.x * m_scale :point.y * m_scale];

Then create your rect:
Code:
PDF_RECT annotRect; annotRect.left = annotPos.x; annotRect.top = annotPos.y; annotRect.right = annotPos.x + yourWidth; annotRect.bottom = annotPos.y + yourHeight;

You can also adjust the position as your prefer (in this sample annotRect.left, annotRect.top point is the bottom-left corner of your image)
More
IP: 192.168.0.71 8 years 10 months ago #12404 by Pja
Replied by Pja on topic Add an Image on PDF
Can you please help me converting screen coordinates to PDFRECT left,right,top and bottom?
Right now i am unable to plot my image at the point where i have long pressed on the document.
More
IP: 192.168.0.71 8 years 10 months ago #12406 by emanuele
Replied by emanuele on topic Add an Image on PDF
Hi,

the previous post shows how you could do that.
The first block of code convert the point of the screen (CGPoint point) to pdf coordinates (PDFV_POS annotPos).
The second block creates the PDF_RECT using the pdf coordinates (annotPos) and your image size.
The PDF_RECT's left and top are the image origin (x and y of your point).
PDF_RECT origin is the bottom-left corner (not the top-left), in this case, if you want to use the point as center, you should set the PDF_RECT properly.

For example, you can do something like:
annotRect.left -= (yourWidth / 2);
annotRect.top -= (yourHeight / 2);
annotRect.right -= (yourWidth / 2);
annotRect.bottom -= (yourHeight / 2);
Time to create page: 0.345 seconds
Powered by Kunena Forum