Print Page | Close Window

DrawText and FontSize

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=736
Printed Date: 15 May 24 at 4:18AM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: DrawText and FontSize
Posted By: carlos.albert
Subject: DrawText and FontSize
Date Posted: 31 May 07 at 1:51PM
Hello, we have an existing PDF document merged from various pdfs of diferent origins (PDF Printer, FastReport Renderized, etc) we want to write some text in the bottom of each page, the problem is the size of the text is not the same in all pages, the font size changes depend on the merged pdf. For example two pdf files with one page every one, we merge them and then apply the text with drawtext on each page, in the first page the font has a size and in the other the font has a diferent size. The code we use is:

     QP:= TiSEDQuickPDF.Create; 
     try
          QP.UnlockKey('XXXXXXXXXXXXXXXXX');
          QP.LoadFromFile(FilePDF);
          //I have seen this in the forum
          QP.UseUnsafeLayers(1);

          // Stablish the font, the same if we stablish the font in each page
          QP.SetTextSize(20);

          for x := 1 to QP.PageCount do
          begin
               QP.SelectPage(x);
                // I have seen this in the forum
               QP.SetPageContent('q'#13#10 + Trim(QP.GetPageContent) + #13#10'Q'#13#10);

               QP.DrawText(10, 10, SuReferencia);
               QP.CompressPage;
          end;

          QP.CompressContent;
          QP.SaveToFile(FilePDF);


     finally
          QP.Free;
     end;

Please, some idea???




Replies:
Posted By: Ingo
Date Posted: 31 May 07 at 2:09PM
Hi Carlos!

I don't know if it helps ... but i have few ideas ;-)
Put "QP.SetTextSize(20);" directly after "QP.SelectPage(x);".
I don't know if "UseUnsafeLayers" and "SetPageContent" is necessary ... but if you use it i will place both after "SelectPage" to make sure that it works for the actual page.

Best regards,
Ingo



Posted By: carlos.albert
Date Posted: 01 Jun 07 at 2:29AM
Hi Ingo,

>Put "QP.SetTextSize(20);" directly after "QP.SelectPage(x);".

I had tried it before but same results.

>I don't know if "UseUnsafeLayers" and "SetPageContent" is necessary ... but if you use it i will place both after "SelectPage" to make sure that it works for the actual page.

I use it because of a post of Marian (I saw in the forum) regarding about draw text and position, I try to put it after selectPage too but no results.

Thanks for your help.


Posted By: carlos.albert
Date Posted: 01 Jun 07 at 3:09AM
Hi Ingo and Hi all,
I have resolved it calculating the size of the font in function of the size of the page, I have noticed than the size of the page is diferent so it is normal that the same size of text appears larger or smaller in pages of diferent size because the size goes in pixels and when you print it reescales to the size of the A4.


Posted By: carlos.albert
Date Posted: 01 Jun 07 at 3:09AM
Thans for all



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk