Opening password protected files
Posted: Wed Oct 24, 2018 6:08 pm
I just can't seem to be able to open password protected PDF files. Is there some tricks, requirements, certain formats that's supported, or what could be wrong? I've tried to download some test files from Internet, and also tried to create an encrypted file with Preview under OSX, but can't seem to get any of them open. I've tried to open files under MorphOS and OSX 10.5.8, and fails on both...
Here's one test:
Here's one test:
Code: Select all
@REQUIRE "polybios"
f$="pdfpwtest.pdf"
If Not Exists(f$)
; Download a test file from http://www.novapdf.com/kb/pdf-example-files-created-with-novapdf-138.html
; The password should be "test"
DownloadFile("http://www.novapdf.com/uploads/novapdf_en/media_items/pdf-example-password.original.pdf", {File=f$})
EndIf
If Exists(f$)
pdf.OpenDocument(1, f$, {Password = "test"}) ; <- Fails here always
PDF_DOCUMENT=pdf.GetObjectType()
pdfpages=GetAttribute(PDF_DOCUMENT, 1, #PDFATTRPAGES)
DebugPrint(pdfpages)
EndIf