WPCubed Product Support

Write Text on Pdf

After finishing adding my text and adding some signatures, I want to save the pdf so that it can't be altered by the person I send it to, but I can't save it or export it in a way that doesn't let me alter the texts or the signature. It reports that it is an encrypted file and it can't be flattened or converted to any other type of pdf. I am a bit concerned about sending the pdf with the text and signature that I added still able to be altered when opened. Can anyone please advice on how i might do this?

#8 ♥ 0
12.8k Views 3 users read 3 min

Thanks for the reply but If I use

WPCentimeterToPixel(28,Screen.PixelsPerInch)

the text is written out page

#7 ♥ 0
support

Hi,

You need to use Screen.PixelsPerInch instead of "72"

Julian

#6 ♥ 0

Using WPCentimeterToPixel(28,72) to calculate the position of text on some computers it works fine, but no other.
The text should be placed at 28 centimeters from the top.

Thanks

#5 ♥ 0
support

Hi,

Thanks for finding it yoursel.
I also didnt see that you had originally

aForm.eM12 := 1;
aForm.eM21 := 1;

which is not valid.

Julian

#4 ♥ 0

The last version resolve the problem

The latest version(WPViewPDF PLUS V2.61.1) , and the following lines :

aForm.eM11 := 1;
         aForm.eM12 := 0;
         aForm.eM21 := 0;
         aForm.eM22 := 1;

solved the problem.

Thanks

#3 ♥ 0

Hi, I'm trying to add text to an existing pdf file and save the result to new pdf file.

I used this source code:

function dicituraFissa(szNomeFile:pchar):boolean;
var StampMetaCan : TMetafileCanvas;
    aForm : TXForm;
    x,y,nrP: integer;
    lst :TStringlist;
    n,idx:integer;
    sz:String;
    wp :TWPViewPDF;
    StampMeta : TMetaFile;
begin
     wp:=TWPViewPDF.CreateParented(application.handle);
      wp.LoadFromFile(strpas(szNomeFile)) ;
      if true then
      begin
          StampMeta:=TmetaFile.create;
          StampMetaCan := TMetafileCanvas.Create(StampMeta,0);
          try
               StampMetaCan.Font.Height := -10;
               StampMetaCan.Font.Color := clBlack;
               StampMetaCan.Font.Name := 'Arial';
               StampMetaCan.Brush.Style := bsClear;
               aForm.eM11 := 1;
               aForm.eM12 := 1;
               aForm.eM21 := 1;
               aForm.eM22 := 1;
               aForm.eDx := Screen.PixelsPerInch;
               aForm.eDy := Screen.PixelsPerInch*2;
               SetWorldTransform(StampMetaCan.Handle, aForm);

               nrP:=wp.CommandEx(COMPDF_GetPageCount,0);
                y:=WPCentimeterToPixel(28,72);
                x:=WPCentimeterToPixel(1,72);

                lst:=TStringlist.create;
                lst.text:=strpas('Try write text on pdf');
                idx:=0;
                for n := lst.count - 1 downto 0 do
                begin
                   StampMetaCan.TextOut(x,y-(15*(n+1)), lst[idx]);
                   inc(idx);
                end;
                lst.free;

          finally
               StampMetaCan.Free;
          end;
                wp.CommandStrEx(495,inttostr(nrP)+'-'+inttostr(nrP), StampMeta.Handle)
          wp.Plus.SetSecurityMode(wpNoSecurity);
          wp.Plus.SaveToFile('C:\tmp\test.pdf');
          StampMeta.free;
      end;
      wp.free;
end;

But in the new file created there is no trace of text.

Why?

Thanks

#1 ♥ 0