Page 1 of 1

WaterMark not added to file.

Posted: Sat Aug 12, 2017 11:45 am
by vivekpatel
Hello,
I'm using pdfcontrol to do watermark document without open document in control.

Here is my code:

Public rc As PDFXEdit.PXC_Rect


Public m_Inst As PDFXEdit.PXV_Inst = Nothing
Public m_pxcInst As PDFXEdit.IPXC_Inst = Nothing
Public ixcInst As PDFXEdit.IIXC_Inst = Nothing
Public IAUX_Inst As PDFXEdit.IAUX_Inst = Nothing

Public Sub InitPDFControl()
Try

Dim licKey As String = "xyz"
m_Inst = New PDFXEdit.PXV_Inst()
m_Inst.Init(Nothing, licKey, Nothing, Nothing, Nothing, 0, Nothing)
m_pxcInst = CType(m_Inst.GetExtension("PXC"), PDFXEdit.IPXC_Inst)
IAUX_Inst = m_Inst.GetExtension("AUX")

Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub Btnwtrmrk_Click(sender As Object, e As EventArgs) Handles Btnwtrmrk.Click
Try
Dim doc As PDFXEdit.IPXC_Document
InitPDFControl()

doc = m_pxcInst.OpenDocumentFromFile("C:\Users\Vivek\Desktop\Pages from Untitled.pdf", Nothing) 'open doc
'PlaceWatermark(doc, m_pxcInst)

Dim bs As PDFXEdit.IBitSet = IAUX_Inst.CreateBitSet(doc.Pages.Count)
Dim wp As PDFXEdit.IPXC_WatermarkParams = m_pxcInst.CreateWatermarkParams()

bs.Set(0, doc.Pages.Count)
wp.Text = "dddddddddddddfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
wp.Scale = 200
wp.FontSize = Convert.ToSingle(50)
wp.FontName = "Book Antiqua"
wp.WatermarkType = PDFXEdit.PXC_WatermarkType.Watermark_Text
doc.PlaceWatermark(bs, wp)

Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Code works fine, but document not watermarked.
so what to do?

Re: WaterMark not added to file.

Posted: Sun Aug 13, 2017 7:07 am
by Sasha - Tracker Dev Team
Hello vivekpatel,

Try commenting this wp.FontName = "Book Antiqua" and see whether this works.

Cheers,
Alex

Re: WaterMark not added to file.

Posted: Mon Aug 14, 2017 5:50 am
by vivekpatel
Hello and thanks,

i did as you suggest, but not working for me.
Here i'm attaching my sample to figure out prob.
Rgds,

Re: WaterMark not added to file.

Posted: Mon Aug 14, 2017 8:04 am
by Sasha - Tracker Dev Team
Hello vivekpatel,

Well from what I see you are not writing the changes to the document - that's all.

Code: Select all

doc.WriteTo(null);
doc.Close();
Cheers,
Alex