Ruby의 PDF에서 메타데이터 제거

Aspose.PDF - 메타데이터 제거

Aspose.PDF Java for Ruby를 사용하여 PDF 문서에서 메타데이터를 제거하려면 RemoveMetadata 모듈을 호출하기만 하면 됩니다.

루비 코드

# 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")

if doc.getMetadata().contains("pdfaid:part")

В В В  doc.getMetadata().removeItem("pdfaid:part")

endВ В  В

if doc.getMetadata().contains("dc:format")

В В В  doc.getMetadata().removeItem("dc:format")

end

# save update document with new information

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

puts "Removed metadata successfully, please check output file."

실행 코드 다운로드

아래 언급된 소셜 코딩 사이트에서 В **메타데이터 제거(Aspose.PDF)**В를 다운로드하세요.