Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

expire code

Participant ,
Jun 11, 2017 Jun 11, 2017

Can someone please help me with this question? I am using this code to expire the document on a specific day and year. What occurred to me and is the reason I'm asking this question, can this script be modified to expire on a specific day and year but also expire on any date prior and any date passed the specific date. Example, to expire on December 25, 2017. If the user tries to change their computer's calendar to, let's say, 2016 the document would still expire.

This is the script I'm using and works ok, but I'd like to modify it to make it more difficult to bypass even if the user turns off "Enable Javascript" or sets their computer back.

function Expire()

{

// Get the current date and time

var rightNow = new Date();

// Setup End Date

var rightNow = new Date();

var beginDate = new Date("March 21, 2016 06:15:00 AM");

var endDate = new Date("March 31, 2017 1:57:00 PM");

this.closeDoc(true)

}

}

// execute check expiration code

Expire();

TOPICS
Acrobat SDK and JavaScript , Windows
921
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 11, 2017 Jun 11, 2017

You can't solve this problem with JavaScript.

The user will still be able to open the document in just about any PDF viewer other than Acrobat or Reader and only in the desktop version of those, the mobile Reader doesn't have closeDoc(). You're going to need some sort of encryption that pings a server for the time before decrypting the document.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 11, 2017 Jun 11, 2017

Look for DRM solution.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 12, 2017 Jun 12, 2017

JavaScript can help you but you need to reverse the method: your document must be usable if and only if JavaScript is enabled.

Example: add a layer or a field that cover all the layout on each page, and make JavaScript hidding it at document opening, so: no JavaScript = no document.


Acrobate du PDF, InDesigner et Photoshopographe
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 12, 2017 Jun 12, 2017

But layers can easily be hidden in alternative viewers that don't support JavaScript or when JavaScript is turned off.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 12, 2017 Jun 12, 2017

Sure, it's not bulletproof but it's cheaper than DRM 😉


Acrobate du PDF, InDesigner et Photoshopographe
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 12, 2017 Jun 12, 2017

I'm with JR on this one.  True DRM is expensive and unwieldy. The OCG solution is cheap, easy, and cracking it is beyond the technical abilities of nearly all users. I have customers that uses this technique with documents they sell.  So it really works. I've got a demo file that provides detailed instructions on my site.

However, it does fall in to the category of keeping honest users honest. Rather than preventing malicious users from accessing the PDF. Toward this end the solution can be made stronger by also encrypting the PDF with a self signed certificate from the target user.

I think this is a pretty good combination, blocking OCG Layer and digital certificate encryption.

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 12, 2017 Jun 12, 2017

Thom is correct in that the solution does work to keep honest people honest... I just have a far dimmer view of humanity. It really comes down to how secure do you need the security to be.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 28, 2017 Aug 28, 2017

Link to the demo, Thom?  Or what section is it in?  Thanks!

B

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 17, 2017 Nov 17, 2017
LATEST

Brian, Sorry about the late reply on this one. I don't actually have a public version of the Licensed PDF (Lite Security with OCG) sample.  It is at www.pdfscripting.com in the member only downloads. 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines