GDViewer .NET10

Discussions about document viewing.
Post Reply
marcelo
Posts: 1
Joined: Fri Sep 26, 2014 10:58 pm

GDViewer .NET10

Post by marcelo » Thu Oct 02, 2014 4:28 pm

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);
            }
        }		

Last edited by marcelo on Thu Oct 02, 2014 4:58 pm, edited 2 times in total.

SamiKharma
Posts: 352
Joined: Tue Sep 27, 2011 11:47 am

Re: GDViewer .NET10

Post by SamiKharma » Thu Oct 16, 2014 12:10 pm

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

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests