Loading...

Insert pages from file to an opened document in gdviewer

Support for GdPicture Light Imaging Toolkit and GdPicture Pro Imaging ActiveX/SDK.

Insert pages from file to an opened document in gdviewer

Postby mabdullah » Tue Jan 18, 2011 11:45 am

i want the user to browse file system then choose a file then append this file to the opened images in gdviewer then save all images to tif file
i am new to your product is that can be done through the below code , plz help
Code: Select all
Call Imaging1.TiffAppendPageFromFile(Imaging1.GetNativeImage, cmddlg.FileName)
mabdullah
 
Posts: 18
Joined: Sun Jan 16, 2011 11:44 am

Re: Insert pages from file to an opened document in gdviewer

Postby Loïc » Tue Jan 18, 2011 5:40 pm

Hi,

This line is good. Just ensure yourself to handle an editable multipage tiff image.

Kind regards,

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

Re: Insert pages from file to an opened document in gdviewer

Postby mabdullah » Tue Jan 18, 2011 9:53 pm

so getNativeImage is getting the current multiple image on gdviewer and it should append the coming file from file system to the viewed multiple image on gdviewer to be viewed directly on gdviewer, the point is to append multiple image (TIF) from file system to the displayed multiple image (TIF) on gdviewer and refresh gdviewer and this line of code doesn't do anything can u help me plz
mabdullah
 
Posts: 18
Joined: Sun Jan 16, 2011 11:44 am

Re: Insert pages from file to an opened document in gdviewer

Postby Loïc » Wed Jan 19, 2011 1:59 pm

Hi,

I am sorry but I don't understand at all what you wrote. Please try to be more clear.

Kind regards,

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

Re: Insert pages from file to an opened document in gdviewer

Postby mabdullah » Wed Jan 19, 2011 3:12 pm

OK simply, i want to append Multiple TIFF file from desk to the current gdviewer displayed image on the gdviewer.



thanks
mabdullah
 
Posts: 18
Joined: Sun Jan 16, 2011 11:44 am

Re: Insert pages from file to an opened document in gdviewer

Postby Tom Moran » Wed Jan 19, 2011 6:31 pm

Mabdullah:

You might consider looking at the GdPicture documentation:

How to create multipage tif image from several existing image files:

Code: Select all
Dim nImageID As Long

nImageID = object.CreateImageFromFile( "image1.jpg")
object.TiffSaveAsNativeMultiPage ("multipage.tif")

nImageID = object.CreateImageFromFile("image2.jpg")
object.TiffAddToNativeMultipage (nImageID)
object.CloseImage (nImageID)

nImageID = object.CreateImageFromFile("image3.jpg")
object.TiffAddToNativeMultipage (nImageID)
object.CloseImage (nImageID)

object.TiffCloseNativeMultiPage


You would just need to add your code to browse and select which images to add.
Tom Moran
 
Posts: 102
Joined: Thu May 24, 2007 9:41 am
Location: Phoenix, Arizona

Re: Insert pages from file to an opened document in gdviewer

Postby mabdullah » Mon Jan 24, 2011 8:33 am

thanks for your help, i did it.
for sharing knowledge here is the code which is responsible of appending Multiple TIFF file from desk to the current gdviewer displayed image on the gdviewer or replace the current displayed image on gdviewer with another one.

just copy the below code and put it in the event mnOpen_Click in the vb sample application under path
"C:\Program Files\GdPicture ToolKit Pro Edition\samples\vb\_Global sample" and give it a try ;)

Code: Select all
Private Sub mnOpen_Click()
    Dim Warnmsg As String
    Dim imageID As Long
    'this means there is an open image on gdviewer
    If GdViewer1.GetNativeImage <> 0 Then
        Warnmsg = "If you clicked on Yes you will append to the current image." & vbCr & "If you clicked on No the current image will be replaced with the new opened one."
        If MsgBox(Warnmsg, vbQuestion + vbYesNo + vbMsgBoxRight + vbMsgBoxRtlReading, Me.Caption) = vbNo Then
            CloseImage
            cmddlg.FileName = ""
            cmddlg.Filter = "*.*"
            cmddlg.ShowOpen
            If cmddlg.FileName <> "" Then
                imageID = Imaging1.CreateImageFromFile(cmddlg.FileName)
                If Imaging1.GetStat = 0 Then
                    Call ShowBitmap
                    'Call Imaging1.TiffSaveMultiPageToFile(imageID, App.Path & "\temp.tif", CompressionCCITT4)
                End If
            End If
        Else
            Dim i As Integer
            Dim tifCount As Integer
            cmddlg.FileName = ""
            cmddlg.Filter = "*.*"
            cmddlg.ShowOpen
            If cmddlg.FileName <> "" Then
                imageID = Imaging2.TiffCreateMultiPageFromFile(cmddlg.FileName)
                tifCount = Imaging2.TiffGetPageCount(imageID)
                For i = 1 To tifCount
                    Call Imaging2.TiffSelectPage(imageID, i)
                    Call Imaging1.TiffAppendPageFromGdPictureImage(GdViewer1.GetNativeImage(), imageID)
                Next
                Call Imaging2.CloseNativeImage
                Imaging2.CloseImage (imageID)
                ShowBitmap
                ShowBitmapProperties
            End If
        End If
    Else
        'there is no displayed image on the gdviewer
        CloseImage
        cmddlg.FileName = ""
        cmddlg.Filter = "*.*"
        cmddlg.ShowOpen
        If cmddlg.FileName <> "" Then
            imageID = Imaging1.CreateImageFromFile(cmddlg.FileName)
            If Imaging1.GetStat = 0 Then
                Call ShowBitmap
                'Call Imaging1.TiffSaveMultiPageToFile(imageID, App.Path & "\temp.tif", CompressionCCITT4)
            End If
        End If
    End If
End Sub


Another question Loïc how can i scan a lot of documents and only displaying these documents on the gdviewer without saving it to a multiple TIFF file
mabdullah
 
Posts: 18
Joined: Sun Jan 16, 2011 11:44 am


Return to GdPicture [Pro] ActiveX

Who is online

Users browsing this forum: No registered users and 1 guest