AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Pdftk - the pdf toolkit [CMD]
Goto page 1, 2  Next
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Utilities & Resources
View previous topic :: View next topic  
Author Message
BoBo
Guest





PostPosted: Mon Nov 29, 2004 7:31 pm    Post subject: Pdftk - the pdf toolkit [CMD] Reply with quote

Quote:
Pdftk - the pdf toolkit

If PDF is electronic paper, then pdftk is an electronic staple-remover, hole-punch, binder, secret-decoder-ring, and X-Ray-glasses. Pdftk is a simple tool for doing everyday things with PDF documents. Keep one in the top drawer of your desktop and use it to:

Merge PDF Documents

Split PDF Pages into a New Document

Decrypt Input as Necessary (Password Required)

Encrypt Output as Desired

Fill PDF Forms with FDF Data and/or Flatten Forms

Apply a Background Watermark

Report on PDF Metrics such as Metadata, Bookmarks, and Page Labels

Update PDF Metadata

Attach Files to PDF Pages or the PDF Document

Unpack PDF Attachments

Burst a PDF Document into Single Pages

Uncompress and Re-Compress Page Streams

Repair Corrupted PDF (Where Possible)

Pdftk allows you to manipulate PDF easily and freely. It does not require Acrobat, and it runs on Windows, Linux, Mac OS X, FreeBSD and Solaris.

[More...]

Windows Program Download
Download and unzip the following file. Move the resulting pdftk.exe to a convenient location, such as C:\windows\system32. Open a command prompt and type pdftk --help. You should get the above, usage instructions.

pdftk-1.12.exe.zip (~1.5MB)

License
My pdftk code is free software made available under the GPL.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


Cool
Back to top
jonny



Joined: 13 Nov 2004
Posts: 3004
Location: Minnesota

PostPosted: Mon Nov 29, 2004 8:09 pm    Post subject: Reply with quote

Heh... everything but viewing it. Btw, what does this have to do with AHK?
Back to top
View user's profile Send private message
BoBo
Guest





PostPosted: Mon Nov 29, 2004 8:40 pm    Post subject: Reply with quote

Quote:
Btw, what does this have to do with AHK?

Share your favorite scripts, subroutines, and utility software.
That's how this forum section is labeled Wink
Back to top
jonny



Joined: 13 Nov 2004
Posts: 3004
Location: Minnesota

PostPosted: Mon Nov 29, 2004 9:22 pm    Post subject: Reply with quote

I think if you post a utility here, it should at least have something to do with AHK. Some of the utilities you're posting here are nice, and serve a purpose, but really have no relevance with regards to AHK.
Back to top
View user's profile Send private message
BoBo
Guest





PostPosted: Mon Nov 29, 2004 10:07 pm    Post subject: Reply with quote

@ jonny
Before it gets philosophically. As long as AHK provides no internal PDF features it makes sense (maybe not for you but for others, e.g. like myself).

As AHK provides a command line feature (Run, RunWait) to run whatever you like even third party tools like the recommended one (or a DOSBox, or Word, or Excel, or ...), AHK works as an interface to accomplish whatever task should be done.

If you don't like to get info about usefull tools (beside AHK) ignore it. Thx.
I don't think I won't stop to recommend usefull tools. Maybe someday that'll save someones live(time), even a bit of it Wink.
Back to top
Rajat



Joined: 28 Mar 2004
Posts: 1718

PostPosted: Tue Nov 30, 2004 12:41 am    Post subject: Reply with quote

i feel its nice to post about new/less-known tools here...
_________________
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Tue Nov 30, 2004 1:23 am    Post subject: Reply with quote

jonny wrote:
I think if you post a utility here, it should at least have something to do with AHK. Some of the utilities you're posting here are nice, and serve a purpose, but really have no relevance with regards to AHK.
The intended scope of the Utilities forum is pretty broad. I didn't want there to be any requirement for a relationship with AHK.

However, it would be preferable that anyone posting a utility have personal experience with it, so that they can vouch for it (unless it's something unusual or obviously useful, such as the PDF toolkit).
Back to top
View user's profile Send private message Send e-mail
pbd
Guest





PostPosted: Wed Dec 29, 2004 7:01 am    Post subject: ahk script available for pdftk? Reply with quote

Has somebody already made an ahk script for pdftk? If not, perhaps I could try.
Back to top
pbd
Guest





PostPosted: Mon Feb 14, 2005 6:40 am    Post subject: Gui for pdftk Reply with quote

Here is a GUI for pdftk, made using autohotkey, covering the basic functions. Keep it in the same directory as pdftk.exe and run it.
Code:
IfNotExist, pdftk.exe
  {
  MsgBox, pdftk.exe not found in same directory
  ExitApp
  }
Gui, Add, Radio, vOpt, Decrypt PDF file (password should be known)
Gui, Add, Radio, , Encrypt PDF file 128 bit, withhold all permissions
Gui, Add, Radio, , Encrypt PDF file 128 bit, allow printing, `nwithhold other permissions
Gui, Add, Radio, , Encrypt PDF file 128 bit, user needs password to open, `nwithhold all permissions
Gui, Add, Radio, , Encrypt PDF file 128 bit, user needs password to open, `nallow printing, withhold other permissions
Gui, Add, Radio, , Join 2 unencrypted PDF files
Gui, Add, Radio, , Join all unencrypted PDF files in a folder
Gui, Add, Radio, , Remove a page from an unencrypted file
Gui, Add, Radio, , Burst an unencrypted pdf file into single pages
Gui, Add, Radio, , None of the above
Gui, Add, Radio, , About this Gui
Gui, Add, Button, ,OK
Gui, Show, x250 y150, PDF Tool Kit Graphical User Interface
Return

ButtonOK:
Gui, Submit

if Opt=1
  {
  FileSelectFile, arg1,,,"Choose file to decrypt",*.pdf
  InputBox, foopass,,Enter Password, HIDE,
  FileSelectFile, arg2,,,"Choose output file",*.pdf
  RunWait, pdftk.exe %arg1%  input_pw %foopass% output %arg2%.pdf
  }
else if Opt=2
  {
  FileSelectFile, arg1,,,"Choose file to encrypt",*.pdf
  InputBox, foopass,,Enter Password, HIDE,
  FileSelectFile, arg2,,,"Choose output file",*.pdf
  RunWait, pdftk.exe %arg1%  output %arg2%.pdf owner_pw %foopass%
  }
else if Opt=3
  {
  FileSelectFile, arg1,,,"Choose file to encrypt",*.pdf
  InputBox, foopass,,Enter Password, HIDE,
  FileSelectFile, arg2,,,"Choose output file",*.pdf
  RunWait, pdftk.exe %arg1%  output %arg2%.pdf owner_pw %foopass% allow printing
  }
else if Opt=4
  {
  FileSelectFile, arg1,,,"Choose file to encrypt",*.pdf
  InputBox, foopass,,Enter Owner Password, HIDE,
  loop
    {
    InputBox, baz,,Enter User Password, HIDE,
    If baz=%foopass%
      {
      MsgBox, User password should not be owner password
      }
    else
      {
      break
      }
    }
  FileSelectFile, arg2,,,"Choose output file",*.pdf
  RunWait, pdftk.exe %arg1%  output %arg2%.pdf owner_pw %foopass% user_pw %baz%
  }
else if Opt=5
  {
  FileSelectFile, arg1,,,"Choose file to encrypt",*.pdf
  InputBox, foopass,,Enter Owner Password, HIDE,
  loop
    {
    InputBox, baz,,Enter User Password, HIDE,
    If baz=%foopass%
      {
      MsgBox, User password should not be owner password
      }
    else
      {
      break
      }
    }
  FileSelectFile, arg2,,,"Choose output file",*.pdf
  RunWait, pdftk.exe %arg1%  output %arg2%.pdf owner_pw %foopass% user_pw %baz% allow printing
  }
else if Opt=6
  {
  FileSelectFile, in1,,,"Choose first file to join",*.pdf
  FileSelectFile, in2,,,"Choose second file to join",*.pdf
  FileSelectFile, out1,,,"Choose output file",*.pdf
  RunWait, pdftk.exe %in1% %in2% cat output %out1%.pdf
  }
else if Opt=7
  {
  FileSelectFolder, inf,,,"Select folder containing the pdf files"
  FileSelectFile, out1,,,"Choose output file",*.pdf
  RunWait, pdftk.exe %inf%\*.pdf cat output %out1%.pdf
  }
else if Opt=8
  {
  FileSelectFile, arg1,,,"Choose file from which page to be removed",*.pdf
  InputBox, pr,,Give page number to be removed
  FileSelectFile, out1,,,"Choose output file",*.pdf
  pb=%pr%
  pb-=1
  pn=%pr%
  pn+=1
  RunWait, pdftk.exe %arg1% cat 1-%pb% %pn%-end output %out1%.pdf
  }
else if Opt=9
  {
  FileSelectFile, in1,,,"Choose file to burst",*.pdf
  RunWait, pdftk.exe %in1% burst
  }
else if Opt=10
  {
  MsgBox, "Sorry, your requirement is not yet included"
  }
else
  {
  MsgBox, This script developed by Dhanish`nwww.dhanish.150m.com/software.html`nFor PDF tool kit, visit http://www.accesspdf.com/pdftk/
  }
GuiClose:
GuiEscape:
ExitApp
A compiled version can be downloaded from www.dhanish.150m.com/software.html
Back to top
BoBo
Guest





PostPosted: Mon Feb 14, 2005 8:39 am    Post subject: Reply with quote

Quote:
A compiled version can be downloaded from www.dhanish.150m.com/software.html
and directly from here (without being bothered by an "wanna install an AddWare?"-Popup) request) [PDFTKgui]

@ pbd
Thx for sharing it. Much appreciated.
Back to top
BoBo
Guest





PostPosted: Mon Feb 14, 2005 8:44 am    Post subject: Reply with quote

Shocked My above advise/link won't work as pbd's web account isn't enabled for "Hotlinking". Sorry folks. Embarassed

Quote:
A Hotlinking Error Has Occured!

We have detected a hotlinking error. Hotlinking is when you link to images or NON html files on 150m.com from another host. Hotlinking is not allowed for our FREE Accounts. Hotlinking is allowed for our paid accounts. Your account can be upgraded in the user section when you have logged in.
Back to top
pbd
Guest





PostPosted: Tue Feb 22, 2005 6:41 am    Post subject: A correction Reply with quote

Oops, the above script will not work if the path / filename contains blank spaces. This can be overcome by adding inverted commas for the variable names.

But this will not work for option 7 while selecting a directory with *.pdf. Can AutoHotkey capture shortnames of directory paths?

The compiled version has been corrected.
Back to top
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Tue Feb 22, 2005 10:21 am    Post subject: Re: A correction Reply with quote

pbd wrote:
Can AutoHotkey capture shortnames of directory paths?
A way was recently added:
Code:
Loop %MyFileName%
    ShortPath = %A_LoopFileShortPath%
Back to top
View user's profile Send private message Send e-mail
olaf
Guest





PostPosted: Fri Feb 25, 2005 4:51 am    Post subject: Reply with quote

I have not tried pdftk, but use xpdf a lot. it probably doesn't do all
what pdftk says it does, but it does what i need, like pdftotext.

http://www.foolabs.com/xpdf
Back to top
new
Guest





PostPosted: Mon Aug 13, 2007 9:11 pm    Post subject: repair multiple pdfs ??? Reply with quote

Hi all,

I want to repair pdfs in my file structure, we have very big files structure.
I'm trying to use pdftk.exe tool, which is very cool, but I want to use it for multiple pfds, and typing:

pdftlk.exe file1.pdf output file1good.pdf | pdftlk.exe file2.pdf output file2good.pdf | pdftlk.exe file3.pdf output file3good.pdf ...

is not something that I want to do every time. Can someone help me with developing some script for using pdftk.exe to repair all *.pdf in current "dir" ??

pdftk.exe *.pdf output *.pdf
doesn't work

thanks.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Utilities & Resources All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group