Insert pages from file to an opened document in gdviewer

Discussions about image processing and document imaging.
Post Reply
mabdullah
Posts: 18
Joined: Sun Jan 16, 2011 11:44 am

Insert pages from file to an opened document in gdviewer

Post by 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)

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

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

Post by 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

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

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

Post by 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

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

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

Post by 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

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

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

Post by 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

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

Post by 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.

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

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

Post by 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

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest