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?
WaterMark not added to file.
Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Tracker Supp-Stefan
Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.
When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.
When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: WaterMark not added to file.
Hello vivekpatel,
Try commenting this wp.FontName = "Book Antiqua" and see whether this works.
Cheers,
Alex
Try commenting this wp.FontName = "Book Antiqua" and see whether this works.
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
-
- User
- Posts: 141
- Joined: Sat Aug 27, 2016 11:00 am
Re: WaterMark not added to file.
Hello and thanks,
i did as you suggest, but not working for me.
Here i'm attaching my sample to figure out prob.
Rgds,
i did as you suggest, but not working for me.
Here i'm attaching my sample to figure out prob.
Rgds,
- Attachments
-
- WindowsApplication14.rar
- (453.21 KiB) Downloaded 134 times
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: WaterMark not added to file.
Hello vivekpatel,
Well from what I see you are not writing the changes to the document - that's all.
Cheers,
Alex
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();
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ