Drawimage method with float image in gdviewer

Discussions about document viewing.
Post Reply
hardikv
Posts: 43
Joined: Thu Jan 27, 2011 11:46 am

Drawimage method with float image in gdviewer

Post by hardikv » Mon Sep 10, 2012 10:30 am

Hi All,

When we select the area with ViewerMouseMode.MouseModeAreaSelection then draw the image within it with Drawimage() method in gdpicturepdf...

But if image size is less than the selection area then the selection area should be resized within that image..

And if we draw image then it is float through the document with drawimage method in gdpicturepdf ..

For this, anybody has idea just reply me asap.

Here is my code..

Code: Select all

private void btnDropImage2_Click(object sender, EventArgs e)
        {
                GdViewer1.MouseMode = GdPicture.ViewerMouseMode.MouseModeAreaSelection;
                
        }
  private void GdViewer1_MouseUp(object sender, MouseEventArgs e)
        {
            if (GdViewer1.IsRect())
            {
              
                GdViewer1.GetRectCoordinatesOnDocumentInches(ref t_left, ref t_top, ref t_width, ref t_height);
                
                GdPicturePDF oGdPicturePDF = new GdPicturePDF();
                GdPictureImaging oGdPictureImaging = new GdPictureImaging();
               
                oGdPicturePDF.LoadFromFile(path, true);
                //GdViewer1.DisplayFromGdPicturePDF(oGdPicturePDF);

                 openFileDialog1.Filter = "PNG|*.png|TIFF Image|*.tif|JPEG|*.jpg";
                 if (openFileDialog1.ShowDialog() == DialogResult.OK)
                 {
                     string Imagepath = openFileDialog1.FileName;

                     
                     int ImageID = oGdPictureImaging.CreateGdPictureImageFromFile(Imagepath);
                     float width = oGdPictureImaging.GetWidth(ImageID) / 72; ;
                     float height = oGdPictureImaging.GetHeight(ImageID) / 72; ;

                                       
                     if (ImageID > 0)
                     {
                         bool h = oGdPicturePDF.SelectPage(GdViewer1.CurrentPage);

                         float pageWidth = oGdPicturePDF.GetPageWidth();
                         float pageHeight = oGdPicturePDF.GetPageHeight();

                         oGdPicturePDF.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitInch);
                         oGdPicturePDF.SetOrigin(PdfOrigin.PdfOriginTopLeft);

                         string imageResName = oGdPicturePDF.AddImageFromGdPictureImage(ImageID, false, false);
                         oGdPictureImaging.ReleaseGdPictureImage(ImageID);
                         
                         oGdPicturePDF.DrawImage(imageResName, t_left, t_top + t_height, width, height);
                          
                                                
                       DialogResult message =  MessageBox.Show("Is This Correct?", "", MessageBoxButtons.YesNoCancel);
                       if (message == DialogResult.Yes)
                       {
                           GdViewer1.CloseDocument();

                          
                           oGdPicturePDF.SaveToFile(path);

                           GdViewer1.DisplayFromFile(path);
                       }
                       else if(message == DialogResult.No)
                       {

                       }
                       else if(message == DialogResult.Cancel)
                       {
                       }

                        
                     }

                 }
            }

        }

Gabriela
Posts: 422
Joined: Wed Nov 22, 2017 9:52 am

Re: Drawimage method with float image in gdviewer

Post by Gabriela » Mon May 06, 2019 11:07 am

Hello,

Are you still interested in this feature or are you still experience such issues with GdPicture14? The toolkit now contains many improved and optimized new features. If you can replicate your issues with the current release (https://www.gdpicture.com/download-gdpicture/), you can send us a working sample application so we can reproduce the issue and we can assist you further.
Thank you.
Kind regards,

Gabriela
GdPicture Team

Post Reply

Who is online

Users browsing this forum: Baidu [Spider] and 1 guest