Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
It's possible, but there are so many ways around it it's not really worth the trouble of setting it up.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
If depends on your strategy for protecting the document. iText is a really good PDF library, so it can be used to add the water mark OCG layer, and it can be used to encrypt PDF content with a digital certificate.
So it can certainly be used to modify the PDF for the protection strategy, but the actual action of blocking the user from seeing content is up to the viewer and it's capabilities.
Copy link to clipboard
Copied
Thanks you so much !! i will come back once i finish
Copy link to clipboard
Copied
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);
}
}
}
Copy link to clipboard
Copied
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).