upgrade GdPicture 9.2 to 9.4 - Error ReleaseGdPictureImage

Discussions about PDF management.
Post Reply
Diego
Posts: 29
Joined: Thu Jan 19, 2012 9:09 pm

upgrade GdPicture 9.2 to 9.4 - Error ReleaseGdPictureImage

Post by Diego » Fri Dec 06, 2013 8:00 pm

Hello,

I have a program in Delphi 7 where I use the component GdPicture 9.2,however I did upgrade to the 9.4.0.14.

I use annotation in pdf or tif(image), however is showing error that I'm don't understand.

Can help me ?

the code:

Code: Select all

            If oAnnotationManager.InitFromGdPicturePDF(oGdPicturePDF) = GdPictureStatus_OK Then
            Begin

               //Seleciono a primeira página
               oGdPicturePDF.SelectPage(0);

               //Crio o Texto
               WTextoCarimbo := 'SCANNER ';
               WTextoCarimbo := WTextoCarimbo + Completa_Zeros(IntToStr(DayOf(Date)),2)+'/'+Completa_Zeros(IntToStr(MonthOf(Date)),2)+'/'+IntToStr(YearOf(Date));
               WTextoCarimbo := WTextoCarimbo + '-' + Completa_Zeros(IntToStr(HourOf(Now)),2) + ':' + Completa_Zeros(IntToStr(MinuteOf(Now)),2) + ':' + Completa_Zeros(IntToStr(SecondOf(Now)),2);

               GdViewerCarimboAux.GetDisplayedAreaInches(LeftInches, TopInches, WidthInches, HeightInches);

               annot := oAnnotationManager.AddStickyNoteAnnot(3,0.1,2,0.5,WTextoCarimbo);
               oAnnotationManager.SetAnnotationPropertyValue(0, 'FillColor', oGdPicturePDF.SetFillColor_3(TransparentColorValue));
               annot := oAnnotationManager.AddStickyNoteAnnot(WidthInches-2.7,HeightInches-0.55,2,0.5,WTextoCarimbo);
               oAnnotationManager.SetAnnotationPropertyValue(1, 'FillColor', oGdPicturePDF.SetFillColor_3(TransparentColorValue));

               oAnnotationManager.BurnAnnotationsToPage(True);

               imageCount := oGdPicturePDF.GetPageImageCount;

               If imageCount > 0 Then
               Begin
                  For j := 0 To imageCount - 1 do
                  Begin
                     imageID := oGdPicturePDF.ExtractPageImage(j + 1);
                     If imageID <> 0 Then
                     Begin
                        oGdPictureImaging.ConvertTo1Bpp(imageID);
                        oGdPicturePDF.SetJpegQuality(30);
                        oGdPictureImaging.Scale(ImageID, 88, InterpolationMode_HighQualityBicubic);
                        imageResName := oGdPicturePDF.GetPageImageResName(j);
                        oGdPicturePDF.ReplaceImage_2(imageResName, imageID, False, True);
                        oGdPicturePDF.AddImageFromGdPictureImage(ImageID, False, False);
                        oGdPictureImaging.ReleaseGdPictureImage(ImageID);//ERROR HERE!!!!
                     End;
                  End;
               End;
            End;
            GdViewerCarimboAux.CloseDocument;
            WNovoNomeArquivo := Copy(ListaImagem.Items[i],1,Length(ListaImagem.Items[i])-4);
            oGdPicturePDF.EnableCompression(true);
            If oGdPicturePDF.SaveToFile_2(WDirImagemCaminho+WNovoNomeArquivo+'_Carimbada.pdf', True) = 0 Then
            Begin
               oGdPicturePDF.CloseDocument;
               DeleteFile(WDirImagemCaminho+ListaImagem.Items[i]);
            End;
         End;



attachment error
Attachments
Erro_GdPicture9.4.0.14.jpg

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

Re: upgrade GdPicture 9.2 to 9.4 - Error ReleaseGdPictureIma

Post by SamiKharma » Sun Dec 08, 2013 11:58 am

Hi,

We would need more information than that. Which function does the error occur at for example.
Also, you are selecting Page (0), the SelectPage method of the GdPicturePDF class is 1 based, meaning that the first page is always 1.
It is also a good practice to always check the return status of every method you call, in case of success you can continue, in case of failure you can handle the error message.

Best regards,
Sami Kharma
GdPicture Support

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest