Beiträge von Lena Vladykina

    Dear Support,


    I would want to add a text with transporan backgraund to a PDF file, to be able to place this text wih respect to the page rotation and to save it to a PDF file.

    I have found this pritty example here in the forum, Could you please, also, help me and say if this can this be modified so that the text can be rotated in line with the page rotation ?

    Many thank for advance!


    Lena


    1. function dicituraFissa(szNomeFile:pchar):boolean;
    2. var StampMetaCan : TMetafileCanvas;
    3. aForm : TXForm;
    4. x,y,nrP: integer;
    5. lst :TStringlist;
    6. n,idx:integer;
    7. sz:String;
    8. wp :TWPViewPDF;
    9. StampMeta : TMetaFile;
    10. begin
    11. wp:=TWPViewPDF.CreateParented(application.handle);
    12. wp.LoadFromFile(strpas(szNomeFile)) ;
    13. if true then
    14. begin
    15. StampMeta:=TmetaFile.create;
    16. StampMetaCan := TMetafileCanvas.Create(StampMeta,0);
    17. try
    18. StampMetaCan.Font.Height := -10;
    19. StampMetaCan.Font.Color := clBlack;
    20. StampMetaCan.Font.Name := 'Arial';
    21. StampMetaCan.Brush.Style := bsClear;
    22. aForm.eM11 := 1;
    23. aForm.eM12 := 0;
    24. aForm.eM21 := 0;
    25. aForm.eM22 := 1;
    26. aForm.eDx := Screen.PixelsPerInch;
    27. aForm.eDy := Screen.PixelsPerInch*2;
    28. SetWorldTransform(StampMetaCan.Handle, aForm);
    29. nrP:=wp.CommandEx(COMPDF_GetPageCount,0);
    30. y:=WPCentimeterToPixel(28,72);
    31. x:=WPCentimeterToPixel(1,72);
    32. lst:=TStringlist.create;
    33. lst.text:=strpas('Try write text on pdf');
    34. idx:=0;
    35. for n := lst.count - 1 downto 0 do
    36. begin
    37. StampMetaCan.TextOut(x,y-(15*(n+1)), lst[idx]);
    38. inc(idx);
    39. end;
    40. lst.free;
    41. finally
    42. StampMetaCan.Free;
    43. end;
    44. wp.CommandStrEx(495,inttostr(nrP)+'-'+inttostr(nrP), StampMeta.Handle)
    45. wp.Plus.SetSecurityMode(wpNoSecurity);
    46. wp.Plus.SaveToFile('C:\tmp\test.pdf');
    47. StampMeta.free;
    48. end;
    49. wp.free;
    50. end;



    DLL Version 401940.