Ruby에서 PDF 만료 설정

Aspose.PDF - PDF 만료 설정

Aspose.PDF Java for Ruby를 사용하여 PDF 문서의 만료를 설정하려면 SetExpiration 모듈을 호출하기만 하면 됩니다.

루비 코드

# The path to the documents directory.

data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'

# Open a pdf document.

doc = Rjb::import('com.aspose.pdf.Document').new(data_dir + "input1.pdf")

javascript = Rjb::import('com.aspose.pdf.JavascriptAction').new(

В В В  "var year=2014;

В В В  var month=4;

В В В  today = new Date();

В В В  today = new Date(today.getFullYear(), today.getMonth());

В В В  expiry = new Date(year, month);

В В В  if (today.getTime() > expiry.getTime())

В В В  app.alert('The file is expired. You need a new one.');")

doc.setOpenAction(javascript)

# save update document with new information

doc.save(data_dir + "set_expiration.pdf")

puts "Update document information, please check output file."

실행 코드 다운로드

아래에 언급된 소셜 코딩 사이트 중 하나에서 **PDF 만료 설정(Aspose.PDF)**В을 다운로드하세요.