Just starting out? Need help? Post your questions and find answers here.
shire
User
Posts: 46 Joined: Mon Jul 25, 2011 5:24 am
Post
by shire » Tue Dec 13, 2011 3:09 am
Hello,
I'm using PurePDF to create a PDF file. Is there anyone know how to use this functions?
and
Thank you.
IdeasVacuum
Always Here
Posts: 6426 Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:
Post
by IdeasVacuum » Fri Dec 16, 2011 2:34 am
Hmm, seems you have to jump through a few hoops to get Javascript to work the way Adobe expects. They have published a PDF about it:
http://partners.adobe.com/public/develo ... SGuide.pdf
So, the password script would be like this (but note, could only stop access by the casual User):
Code: Select all
sPdfName.s = "C:\MyPdf.pdf"
pdf_Create("P","mm",#PDF_PAGE_FORMAT_A4)
pdf_IncludeJS("var PassOK = 'Click OK to Enter'; var Title = 'Enter Password';var defAnswer = '';var pass = app.response('Enter Password',Title, defAnswer);if(pass!='secret'){this.closeDoc(true)}")
pdf_AddPage()
pdf_Save(sPdfName)
Delay(200)
RunProgram(sPdfName)
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
shire
User
Posts: 46 Joined: Mon Jul 25, 2011 5:24 am
Post
by shire » Mon Dec 19, 2011 4:36 am
@IdeasVacuum:
Thanks for that.
But this code seems to only work when you have a pdf adobe reader; what if you have a different reader?
IdeasVacuum
Always Here
Posts: 6426 Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:
Post
by IdeasVacuum » Mon Dec 19, 2011 7:07 am
....Depends entirely on what the alternative PDF Readers support, which tends not to be everything that Adobe support.
You could of course define your own document format and distribute that as either a self-displaying exe or offer a separate viewer for download.
I think sRod's lib 'qDoc' might deliver something like that:
http://www.purebasic.fr/english/viewtop ... 14&t=48492
IdeasVacuum
If it sounds simple, you have not grasped the complexity.