GdPicturePdf.DrawText

Discussions about PDF management.
Post Reply
10risp
Posts: 4
Joined: Wed May 08, 2013 8:03 pm

GdPicturePdf.DrawText

Post by 10risp » Thu Mar 20, 2014 8:02 pm

I am using version 9 GdPicture pluggin to PDF .
I'm trying to put page numbers in the footer of a PDF derived from a TIFF .
The following is the code that utilized in the example :

Code: Select all

GdPicturePDFArq : = TGdPicturePDF.Create ( NIL ) ;
GdPicturePDFArq.LoadFromFile ( ' C : \ trans1.pdf ' , false) ;
For i: = 1 To GdPicturePDFArq.GetPageCount the
Begin
  GdPicturePDFArq.SelectPage ( i);
  source: GdPicturePDFArq.AddTrueTypeFont = ( ' Arial ' , false , false , false ) ;
    GdPicturePDFArq.SetTextMode ( PdfTextMode_PdfTextModeOutlinePath );
    GdPicturePDFArq.SetTextSize (30);
    GdPicturePDFarq.SetFillColor_2 ( 255,0,0,0 );
    GdPicturePDFarq.SetOrigin ( PdfOrigin_PdfOriginTopLeft );
    GdPicturePDFarq.SetMeasurementUnit ( PdfMeasurementUnit_PdfMeasurementUnitCentimeter );
    GdPicturePDFarq.DrawText ( source , 1,1 , ' Page: ' + IntToStr ( i ) ) ;
end ;
" System.OutOfMemoryException " : the following message is appearing .
in various methods , returns me the message .

What can it be?

The following methods , display the same error.
SetTextMode
SetMeasurementUnit
DrawText

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

Re: GdPicturePdf.DrawText

Post by SamiKharma » Wed Apr 23, 2014 2:59 pm

Hi,

It is hard to tell with just this code, but what I am guessing is that you have a serious memory leak in your application.
In any case, your code should not repeat the following lines at every iteration of the pages, once before the iterations should be fine:

Code: Select all

 source: GdPicturePDFArq.AddTrueTypeFont = ( ' Arial ' , false , false , false ) ;
    GdPicturePDFArq.SetTextMode ( PdfTextMode_PdfTextModeOutlinePath );
    GdPicturePDFArq.SetTextSize (30);
    GdPicturePDFarq.SetFillColor_2 ( 255,0,0,0 );
    GdPicturePDFarq.SetOrigin ( PdfOrigin_PdfOriginTopLeft );
    GdPicturePDFarq.SetMeasurementUnit ( PdfMeasurementUnit_PdfMeasurementUnitCentimeter );
Best,
Sami

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests