Skip to main content
karth80472045
Inspiring
December 20, 2018
Question

self destructive pdf

  • December 20, 2018
  • 2 replies
  • 8485 views

Hello all,

I would like to write Javascript or VBA code to Make pdf self destructive after specific time (5 mins), when pdf is sent via mail to specific persons.

After 5 mins pdf page should become blank , no contents should not be displayed.

is this possible if possible could anyone please give suggestions how to proceed.

Thanks and Regards,

Yogesh

This topic has been closed for replies.

2 replies

Thom Parker
Community Expert
Community Expert
December 20, 2018

You can't make a PDF self destruct.  You can however make it difficult to view.  One of the problems is that not all viewers support scripting, especially the scripting necessary to obscure PDF content, so a script will only work on compliant viewers, i.e. desktop Acrobat/Reader. 

So there are a few techniques, but they all come down to encrypting or obscuring the PDF upfront. Then some script or tool unlocks the PDF content if some given conditions are true. For example, a watermark can be added to every page that blocks all the content from being viewed. Then a document script hides the watermark on opening if conditions are met.

There's a tutorial and example of this technique here: Lite Document Security

But this method is not foolproof.

The most effective technique for hiding content is to use a service like Lock Lizard or the Adobe Security server, which encrypt the PDF, which is a very high bar to get around.

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
karth80472045
Inspiring
December 21, 2018

hello sir,

Thanks for your suggestions,i will try from my side , do you have any idea on itextsharp pdf  c# coding is possible for this question.

Legend
January 2, 2019

hello sir ,

since i have no time to explore in it , i have written code in acrobat pro but this code works in console window but javascript editor throws security error could you please helpe me what is this error

var path1="D:/Public/Documents/jan.pdf";

var fileexists=0;

try

{

    var file1=app.openDoc(path1);

    fileexists=1;

    }

if(fileexists==1)

{

    this.closeDoc(true);

    }

else

{

    var rightNow = (new Date());

var minutes=rightNow.getMinutes();

var x=0;

while(x==0)

{

    var rightNow1 = (new Date());

var minutes1=rightNow1.getMinutes();

if(minutes1-minutes==2)

{

    var newDoc=app.newDoc();

newDoc.saveAs(path1);

newDoc.close(true);

   

    x=1;

   

this.closeDoc(true);

    }

}

}


Are you trying to embed this in a PDF? It cannot possibly work, read the full notes for the saveAs method. You would need to install a script on each machine. There are many other things wrong too (you can't save a PDF with no pages, for instance, and Acrobat will not respond while you use this hard loop).

try67
Community Expert
Community Expert
December 20, 2018

It's possible, but there are so many ways around it it's not really worth the trouble of setting it up.