ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Add a header/footer to TIF pages
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

Fábio Nascimento

Brazil
72 Posts

Posted - Aug 16 2023 :  20:23:41  Show Profile  Reply
Hi

I'm loading a multipage tif in a ImageEnView, add'ing a diagonal text and saving all the pages to PDF successfully with this code:

if FileExists(arquivo) then begin

            ImageENView.IO.Params.PDF_PaperSize := IEStrToPaperSize('A4', iepA4);
            ImageENView.IO.Params.PDF_Compression := ioPDF_G4FAX;
            ImageENView.IO.Params.PDF_PageMargin := Round(1 * Inches_Per_CM * 72);

            ImageENView.IO.CreatePDFFile(
              'c:\testes\' +
              ChangeFileExt(System.SysUtils.ExtractFileName(arquivo),'.pdf'));

            ImageENView.Blank;

            ImageENView.IO.Params.TIFF_ImageIndex := 0;
            ImageENView.IO.LoadFromFile(arquivo);

            for t := 0 to ImageENView.IO.Params.TIFF_ImageCount - 1  do begin

              ImageENView.IO.Params.TIFF_ImageIndex := t;

              if t > 0 then ImageENView.IO.LoadFromFile(arquivo);

              with ImageEnView do begin

                LayersAdd('CERTIDÃO DA MATRÍCULA nº ' + pqry_certidoesNUMERO_DOCUMENTO.AsString,
                  80, clBlack, 'Arial', [fsBold] );
                CurrentLayer.Transparency := 48;
                CurrentLayer.Rotate := 45;
                TIETextLayer(CurrentLayer).SizeToText();
                CurrentLayer.PosX := IELayer_Pos_HCenter;
                CurrentLayer.PosY := IELayer_Pos_VCenter;

                LayersMergeAll();

              end;

              ImageENView.IO.SaveToPDF;

            end;

            ImageENView.IO.ClosePDFFile;
            ImageEnView.ClearAll;

          end


But I need to add a header and a footer into the space created with PDF_PageMargin := Round(1 * Inches_Per_CM * 72);.

I tought about using TextOutEx to add a bordered header/footer at the top/bottom of each page of the TIFF file, but it seens like I can't place that on the space that PDF_PageMargin created, since it is created before I manipulate the tif file.

The problem is that I need to create a blank space on the top/bottom for the header/footer, so they don't overlay with existing text that may or may not exists in that area of the tif files.

Is there a way to achieve that?

Thanks!

xequte

38613 Posts

Posted - Aug 17 2023 :  20:35:25  Show Profile  Reply
Hi

You should set the PDF page margin to 0 and then add the image where it is needed. If you look at the code for TIEPDFBuilder.AddPageWithImage() in iepdf.pas you will see how the margin is used to calculate the image position and size.

You can then add text using TIEPDFBuilder.AddText().

You should take a look at this demo:

Demos\InputOutput\PDFBuilder2\PDFBuilder2.dpr

For more info on TIEPDFBuilder:

https://www.imageen.com/help/TIEPDFBuilder.html



Nigel
Xequte Software
www.imageen.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: