logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
Mikhael  
#1 Posted : Friday, December 3, 2021 6:13:32 AM(UTC)
Mikhael

Rank: Newbie

Groups: Registered
Joined: 4/7/2021(UTC)
Posts: 3
Russian Federation

Hello,

Is it possible to add annotation with automatically renewed date value on PDF file page using PDFium.NET?

Here is an example PDF file I'd like to create:
Overlay_with_autodate.pdf (14kb) downloaded 4 time(s).

Mikhael
Paul Rayman  
#2 Posted : Thursday, December 9, 2021 3:09:17 AM(UTC)
Paul Rayman

Rank: Administration

Groups: Administrators
Joined: 1/5/2016(UTC)
Posts: 1,035

Thanks: 5 times
Was thanked: 122 time(s) in 119 post(s)
Hi,

I am assuming JS is being used.
https://pdfium.patagames.com/help/html/WorkingSDK_Actions.htm
Mikhael  
#3 Posted : Friday, December 10, 2021 3:37:14 AM(UTC)
Mikhael

Rank: Newbie

Groups: Registered
Joined: 4/7/2021(UTC)
Posts: 3
Russian Federation

Hello Paul,

Thank you for this info! Now I'm able to add JavaScript to PDF file (see my code snippet below).

But I need to be able to add PdfWidgetAnnotation, that shows date this Java script calculate. Do you have any idea where can I see code example for this task?

Mikhael


Using doc = PdfDocument.Load(sSrcPDF, New PdfForms())
Dim action = New Actions.PdfJavaScriptAction(doc, "var f = this.getField(""date"");"" & vbCrLf & ""f.value = util.printd(""dd/mmmm/yyyy"",new Date());")

Dim tree = New Wrappers.PdfNameTreeCollection(doc, "JavaScript")
tree.Add("Action_CreateAnnotation", action.Dictionary)
doc.Save(sDstPDF, SaveFlags.NoIncremental)
End Using
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.