logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

New Topic Post Reply
Options
Go to last post Go to first unread
Akshara  
#1 Posted : Thursday, May 4, 2017 1:07:29 AM(UTC)
Quote
Akshara

Rank: Member

Groups: Registered
Joined: 2/7/2017(UTC)
Posts: 12
India
Location: Pune

Hey Paul,

I have a query regarding insertion of image in the PDF document in windows form application. I am using PDF viewer of Patagames of windows application. I am not able to insert the image on PDF. Here I am using Drag Drop functionality. I am dragging the image from the ListView and dropping it in the PDF document on the PDF viewer. I have used the ItemDrag event of the ListView to drag the image and have used DragEnter and DragDrop event of the PDF viewer. I have used the code which you have provided in the following link bellow:-
"https://forum.patagames.com/postmessage?f=4"

I am not able to drop the image on the PDF viewer.

Following is my code which i have used:-
Code:

 private void listView1_ItemDrag(object sender, ItemDragEventArgs e)
        {
            DoDragDrop(listView1.SelectedItems, DragDropEffects.Move | DragDropEffects.Copy);
         
        }
  private void pdfViewer1_DragEnter(object sender, DragEventArgs e)
        {
            if (e.Data.GetDataPresent(typeof(ListView.SelectedListViewItemCollection)))
            {
                e.Effect = DragDropEffects.Copy;
            }
            else
                e.Effect = DragDropEffects.None;
        }
 private void pdfViewer1_DragDrop(object sender, DragEventArgs e)
        {
            ListView.SelectedListViewItemCollection selectedItems = (ListView.SelectedListViewItemCollection)e.Data.GetData(typeof(ListView.SelectedListViewItemCollection));
            foreach (ListViewItem item in selectedItems)
            {
                 name = item.Text;
            }
            location = new Point(e.X, e.Y);

            InitWebApp();
            var doc = pdfViewer1.Document;
                if (doc == null)
                    return;

                using (var testBmp = Bitmap.FromFile(name) as Bitmap)
                {
                    var locationOnPage = pdfViewer1.ClientToPage(pdfViewer1.CurrentIndex, location);
                    InsertImageAt(doc.Pages.CurrentPage, testBmp, locationOnPage);
                };
            pdfViewer1.ClearRenderBuffer();
            pdfViewer1.Invalidate();
            
        }



Appreciate your response.
Eagerly waiting for your response.


Thanks in Advance.

Edited by moderator Wednesday, May 10, 2017 5:44:45 AM(UTC)  | Reason: Not specified

Paul Rayman  
#2 Posted : Wednesday, May 10, 2017 5:46:10 AM(UTC)
Quote
Paul Rayman

Rank: Administration

Groups: Administrators
Joined: 1/5/2016(UTC)
Posts: 1,138

Thanks: 10 times
Was thanked: 133 time(s) in 130 post(s)
What exactly problem you have with image insertion?
Akshara  
#3 Posted : Monday, May 15, 2017 11:41:59 PM(UTC)
Quote
Akshara

Rank: Member

Groups: Registered
Joined: 2/7/2017(UTC)
Posts: 12
India
Location: Pune

Hi,


I have resolved the problem while inserting the image.

I have an other error occurred now.After inserting the image at mouse position I want to move that inserted image from one position to other in same PDF.
Is this possible to change the position of that image after inserting it into PDF.

Waiting for your response.


Thanks in advance.

Paul Rayman  
#4 Posted : Monday, May 22, 2017 2:50:21 PM(UTC)
Quote
Paul Rayman

Rank: Administration

Groups: Administrators
Joined: 1/5/2016(UTC)
Posts: 1,138

Thanks: 10 times
Was thanked: 133 time(s) in 130 post(s)
Hi,

You can apply the transformation matrix to ImageObject to change the image position
https://pdfium.patagames...73-1e28-c5edc3586df7.htm

Please see more about transformation matices here:
https://blog.patagames.c...matrix-and-how-to-use-it
Akshara  
#5 Posted : Monday, May 22, 2017 10:24:27 PM(UTC)
Quote
Akshara

Rank: Member

Groups: Registered
Joined: 2/7/2017(UTC)
Posts: 12
India
Location: Pune

Hey,

Thanks for your response but I guess I was not able to elaborate you correctly my problem. Actually here I am dragging the image from a listView control and drop it in the PDF document loaded in PDF viewer.Again I want to drag that same image and move it to some other place and drop in the same PDF. I want that dropped image to be resized or moved or deleted, until I save the PDF the image should be editable.

Appreciate your Response.

Thanks in advance.

Paul Rayman  
#6 Posted : Monday, May 22, 2017 10:38:37 PM(UTC)
Quote
Paul Rayman

Rank: Administration

Groups: Administrators
Joined: 1/5/2016(UTC)
Posts: 1,138

Thanks: 10 times
Was thanked: 133 time(s) in 130 post(s)
You can find the image under mouse pointer
http://forum.patagames.c...mage-under-mouse-pointer

and then move it by applying the transformation matrix as mentioned above
Quick Reply Show Quick Reply
Users browsing this topic
Guest (2)
New Topic Post Reply
Forum Jump  
You can post new topics in this forum.
You can reply to topics in this forum.
You can delete your posts in this forum.
You can edit your posts in this forum.
You cannot create polls in this forum.
You can vote in polls in this forum.