Problem with watermark

  • I open a pdf with PDFViewer.
    I stamp a text on every page (for example the word 'DEMO'): the visualization is ok.
    But if I save the pdf, when I see again the pdf, the word 'DEMO' is written in a different position that I see in the previous display, why?

    Best Regards
    Ivano

  • Hi,
    This is my code:

    var StampMeta : TMetafile;

    ...
    StampMeta := TMetafile.Create;
    ...

    //
    // procedure to write a stamp on PDF
    //
    procedure TFrmMain.PrepareStamp(StampText : String);
    var StampMetaCan : TMetafileCanvas;
    aForm : TXForm;
    begin


    StampMetaCan := TMetafileCanvas.Create(StampMeta,0);

    StampMetaCan.Font.Name := 'tahoma';
    StampMetaCan.Font.Size := 12;
    StampMetaCan.Brush.Style := bsClear;

    aForm.eM11:= 1.0;
    aForm.eM12:= 0.0;
    aForm.eM21:= 0.0;
    aForm.eM22:= 1.0;

    aForm.eDx := Screen.PixelsPerInch;
    aForm.eDy := Screen.PixelsPerInch*2;
    SetWorldTransform(StampMetaCan.Handle, aForm);

    StampMetaCan.TextOut(0,0, DateToStr(now));
    StampMetaCan.TextOut(0,50, StampText);

    StampMetaCan.Free;

    WPViewPDF1.CommandStrEx(495,'1-10000', StampMeta.Handle);

    end;


    //
    // Then I use this code to Save PDF
    //
    ....
    ....
    WPViewPDF1.CommandStr(COMPDF_SaveToFile, savedialog1.FileName);


    Ivano

  • Hi, my problem isn't resolved.
    I use your delphi demo (WPViewPDFnew\Demos\Delphi2): I load my pdf,then I click on 'File', 'Option', 'Stamping' and check Activate. The text DEMO in written on my pdf. Now I click 'Plus' and 'Save PDF' with printed the word DEMO.
    Now I click on 'File' and re-Load the pdf saved with the text DEMO printed on, then I click on 'File','Option', 'Stamping' and check Activate. The text DEMO is written again on my pdf.
    The position of new text DEMO is different from text demo printed previously.
    Why?

    Ivano

  • Hi,
    I am worried, if I can not find a solution to my problem, I am forced to abandon WPViewPDF...
    There isn't solution?
    What can I do?
    I also sent an email to support (19/11/2008) but have not received a response...

    Ivano

  • I downloaded now your PDFViewDemo.exe (ver. 2.29.1) and installed it.
    In my test I used your demo application (not my project).

    Then:
    1. I run your demo application and I view the WPViewPDF manual
    2. I click on 'File', 'Option', 'Stamping' and check Activate. The text DEMO in written on your manual
    3. I click 'Plus' and click 'Save Selected Pages' (the page nr. 1) in a new pdf file that I named 'test.pdf'
    4. Now I click on 'File' and 'Load' the pdf saved prevously (test.pdf)
    5. I click on 'File','Option', 'Stamping' and check Activate. The text DEMO is written again on my pdf but
    it isn't in the same position than the text demo printed previously. It has moved down.
    You can see in this picture : http://www.softeam-tsa.com/test.gif

    by
    Ivano

    • Offizieller Beitrag

    Hi,

    the problem is the input metafile.

    Please specify a width and height. Otherwise the monitor apsect ration is used for the metafile and corrupts everything.

    StampMeta.Width := Screen.PixelsPerInch * 5;
    StampMeta.Height := Screen.PixelsPerInch * 5;


  • Thanks for your answer,
    I used your code but my problem isn't solved.
    I view correctly my text printed with procedure 'PrepareStamp' but when I save the PDF and re-open it (with ADOBE or WPViewPDF) , the text printed with procedure 'PrepareStamp' isn't in the same position where I view it previously.

    Ivano