Home | About us | Overview | Software - Download | Evaluate | Order | Support | Contact | F.A.Q. | Documentations | Blog | Newsletter
Loading...

CopyToClipboard location off while processing PDF

Discussions about image processing in GdPicture.NET using GdPictureImaging.

CopyToClipboard location off while processing PDF

Postby mjnaleva » Thu Aug 19, 2010 11:43 pm

Hello,

I am trying to use the CopyToClipboard() function on the GdPictureImaging object as follows but noticed when dealing with PDFs the image copied is from somewhere else in the PDF as if the coordinates aren't matching up somewhere. Things seem to work just fine with image files though. Am I doing something wrong?

Code for opening file:
If OpenFileDialog1.ShowDialog() = Windows.Forms.DialogResult.OK Then
m_Filename = OpenFileDialog1.FileName
If m_Filename.EndsWith("pdf") Then
status = GdViewer1.DisplayFromFile(m_Filename)
m_ImageID = GdViewer1.PdfRenderPageToGdPictureImage(72, 1)
Else
m_ImageID = oGdPictureImaging.CreateGdPictureImageFromFile(m_Filename)
GdViewer1.DisplayFromGdPictureImage(m_ImageID)
End If

End If

Code for copying to clipboard using the selected area on the GdViewer object:
Dim left, top, width, height As Integer
GdViewer1.GetRectCoordinatesOnDocument(left, top, width, height)
oGdPictureImaging.CopyRegionToClipboard(m_ImageID, left, top, width, height)
mjnaleva
 
Posts: 14
Joined: Fri Jul 03, 2009 8:44 pm

Re: CopyToClipboard location off while processing PDF

Postby Loïc » Fri Aug 20, 2010 2:56 pm

Hi,

I can't reproduce your issue with only this code. Could you upload a standalone application reproducing your problem ?

Kind regards,

Loïc
Loïc Carrère, support team.
www.orpalis.com
User avatar
Loïc
Site Admin
 
Posts: 4230
Joined: Tue Oct 17, 2006 10:48 pm
Location: France

Re: CopyToClipboard location off while processing PDF

Postby mjnaleva » Fri Aug 20, 2010 4:00 pm

Hi Loic,

I attached my sample project. I just took the OCR sample project shipped with GdPicture.NET and added a Tools menu with 'Copy to Clipboard' menu item plus support to open PDF files. Please check and let me know if I am misunderstanding something with the behavior of copying a selected area on the PDF or if there is indeed an issue. Thanks!

It appears the 'Copy to Clipboard' function in the context menu for the GdViewer works so I must be missing something. Although, I noticed with PDFs the copy zoom is not at 100% like it is for images by default.

Mark
Attachments
OCR.zip
(15.01 KiB) Downloaded 23 times
mjnaleva
 
Posts: 14
Joined: Fri Jul 03, 2009 8:44 pm

Re: CopyToClipboard location off while processing PDF

Postby Loïc » Fri Aug 20, 2010 5:02 pm

Hi again,

Here some modification to you document loading procedure:


Code: Select all
    Private Sub OpenToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenToolStripMenuItem.Click
        Dim status As GdPictureStatus
        CloseCurrentImage()
        GdViewer1.ZoomMode = ViewerZoomMode.ZoomModeFitToViewer
        If OpenFileDialog1.ShowDialog() = Windows.Forms.DialogResult.OK Then
            m_Filename = OpenFileDialog1.FileName
            If m_Filename.EndsWith("pdf", StringComparison.CurrentCultureIgnoreCase) Then
                status = GdViewer1.DisplayFromFile(m_Filename)
                m_ImageID = GdViewer1.PdfRenderPageToGdPictureImage(200, 1)
                GdViewer1.CloseDocument()
            Else
                m_ImageID = oGdPictureImaging.CreateGdPictureImageFromFile(m_Filename)
            End If
            If m_ImageID <> 0 Then GdViewer1.DisplayFromGdPictureImage(m_ImageID)
            ShowImageInfo()
        End If
    End Sub


Note: With this implementation you are limited to the first page of a PDF document.

Hope this helps,

Loïc
Loïc Carrère, support team.
www.orpalis.com
User avatar
Loïc
Site Admin
 
Posts: 4230
Joined: Tue Oct 17, 2006 10:48 pm
Location: France

Re: CopyToClipboard location off while processing PDF

Postby mjnaleva » Fri Aug 20, 2010 5:57 pm

Thanks Loic. Works good.
mjnaleva
 
Posts: 14
Joined: Fri Jul 03, 2009 8:44 pm


Return to Image Processing

Who is online

Users browsing this forum: No registered users and 0 guests