Multi page Tiff changes not made until a forced page change

Discussions about image processing and document imaging.
Post Reply
lagwadam
Posts: 7
Joined: Mon Dec 27, 2010 1:14 am

Multi page Tiff changes not made until a forced page change

Post by lagwadam » Sun Jan 09, 2011 2:03 pm

I'm trying to edit a multi page Tiff doc. I opened it with the TiffCreateMultiPageFromFile command. I also saved it with the TiffSaveMultiPageToFile method.

Most of the time this works perfectly (all saved pages are saved perfectly). I do have one problem. When I use the a GdViewer that I drag to my vb.net form, and I use the GdViewer to edit like rotating the page 90 degrees, the last page of the Tiff file that edited doesn't keep those changes when I view the saved file.

I did notice that if I change the current page of the GdViewer before I save, I will notice that the changes are realized in the saved file, this is good. If I edit a page and try to save the GdPicture image to a file before I change the viewer to a different page, that last page I edited will not save the changes I made, but all the other pages are perfect, so just the last page edited is a problem, if I do not change the page in the viewer first.

I hope you can correct my error or give me a better practice using your SDK. I tried everything I could think of. The only way I could make sure the document would be saved the way the user would want was by using this code before the save:

Code: Select all

Dim int As Integer = oGdPictureImaging.TiffGetCurrentPage(m_ImageID)
'
' Force Page Change
'
If int = oGdPictureImaging.TiffGetPageCount(m_ImageID) Then
	oGdPictureImaging.TiffSelectPage(m_ImageID, 1)
Else	
	oGdPictureImaging.TiffSelectPage(m_ImageID, oGdPictureImaging.TiffGetPageCount(m_ImageID))
End If
oGdPictureImaging.TiffSaveMultiPageToFile(m_ImageID, strFileName, TiffCompressionAUTO)
If I exclude the if-then statement before the save, the last page will not save with the changes that the user makes. If the user changes the page (Via the viewer) before they force a save, the changes will save. If the Tiff file has only one page, then the changes will never save, unless you use a command like SaveAsTIFF.

I can also reproduce the error without the GdViewer, but I think I'm making the same mistake either way. Thanks in advance for your response.

Thanks,
Lagwadam

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

Re: Multi page Tiff changes not made until a forced page cha

Post by Loïc » Mon Jan 10, 2011 12:36 pm

Hi Lagwadam,

I tried to reproduce your problem without success.
So, check first you are using our latest available version. if the problem persists, please could you provide a code snippet to reproduce the problem (without GdViewer usage)
I can also reproduce the error without the GdViewer
Kind regards,

Loïc

lagwadam
Posts: 7
Joined: Mon Dec 27, 2010 1:14 am

Re: Multi page Tiff changes not made until a forced page cha

Post by lagwadam » Fri Jan 14, 2011 11:05 am

Hi Loïc,

I updated my GdPicture SDK to version 7.3.0.3.

Using the 32-bit\Framework 4.0 dll I created a form in VS 2010 with (4.0 framework) with a single button that contains this code:

Code: Select all

Public Class Form1
    Dim oGdPictureImaging As New GdPicture.GdPictureImaging
    Dim m_ImageID As Integer
    Dim fileName As String

    Private Sub Form1_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load
        oGdPictureImaging.SetLicenseNumber("XXX")
        fileName = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) & "\ImgTest.tif"
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        ' I open a 4 page TIFF image
        m_ImageID = oGdPictureImaging.TiffCreateMultiPageFromFile("")
        ' Rotate 1st page
        oGdPictureImaging.TiffSelectPage(m_ImageID, 1)
        oGdPictureImaging.RotateAngle(m_ImageID, 90)
        ' Rotate 2nd page 
        oGdPictureImaging.TiffSelectPage(m_ImageID, 2)
        oGdPictureImaging.RotateAngle(m_ImageID, 90)
        ' Rotate 3rd Page
        oGdPictureImaging.TiffSelectPage(m_ImageID, 3)
        oGdPictureImaging.RotateAngle(m_ImageID, 90)
        ' Save 
        oGdPictureImaging.TiffSaveMultiPageToFile(m_ImageID, fileName, GdPicture.TiffCompression.TiffCompressionAUTO)
    End Sub
End Class
When I view the saved file, the first two pages are rotated, but the third page is not rotated.

If I add this line of code:

Code: Select all

oGdPictureImaging.TiffSelectPage(m_ImageID, 4)
before I save, then the file is saved correctly with the first three pages rotated.

Oh, and just in case you were going to ask, I also tried using the TiffOpenMultiPageForWrite(True) before opening the image, without success.

Thanks again for all your help,
Lagwadam

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

Re: Multi page Tiff changes not made until a forced page cha

Post by Loïc » Mon Jan 17, 2011 7:22 pm

Hi,

OK we have a problem in GdPicture.NET. I will solve that tomorrow and upload a fixed edition within few days.

Kind regards,

Loïc

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest