Page 1 of 1

GDViewer .NET10

Posted: Thu Oct 02, 2014 4:28 pm
by marcelo
Hi ,

I got some code below with the latest gdPicture.Net10 .
The code is not working as he's below, if u click button1, button2 and then button3 you will get the error "can not save file".
I then found after a while if u uncomment the code in button3 (first line) it works.

is there any explanation for this ?
as i feel a bit scary about it. I assume this is a bug ?

Code: Select all


        private void button1_Click(object sender, EventArgs e)
        {
            gdViewer1.DisplayFromFile(@"D:\temp123.tif");
        }

        private void button2_Click(object sender, EventArgs e)
        {
            gdViewer1.GetAnnotationManager().AddRubberStampAnnot(ColorTranslator.FromHtml("#FF0000"), 0.5f, 0.5f, 0.5f, 0.5f, "TEST");
        }
		
        private void button3_Click(object sender, EventArgs e)
        {
            //gdViewer1.SaveDocumentToTIFF(@"d:\anyohterfile.TIF", TiffCompression.TiffCompressionCCITT3);
            makePermanent();
            if (gdViewer1.SaveDocumentToTIFF(@"d:\TEEEMP.TIF", TiffCompression.TiffCompressionCCITT3) != GdPictureStatus.OK)
            {
                throw new Exception("can not save file");
            }
        }
		
        void makePermanent()
        {
            gdViewer1.DisplayFirstPage();
            gdViewer1.BurnAnnotationsToPage(true);
            for (int i = 1; i < gdViewer1.PageCount; i++)
            {
                gdViewer1.DisplayNextPage();
                gdViewer1.BurnAnnotationsToPage(true);
            }
        }		


Re: GDViewer .NET10

Posted: Thu Oct 16, 2014 12:10 pm
by SamiKharma
Hi,

You should check the status returned from:
gdViewer1.SaveDocumentToTIFF(@"d:\TEEEMP.TIF", TiffCompression.TiffCompressionCCITT3)

This will give you more information on why the error occurs.
Also it is really a good idea to follow the error handling mechanism of GdPicture instead of try and catch when dealing with GdPicture functions.

Best,
Sami