RubyPDF Blog My Software,PDF,Softwares PDFCrypt Addition-Drag and Decrypt

PDFCrypt Addition-Drag and Decrypt

I got a email from George yesterday. he said,

Hi,
I found your pdfcrypt program and wrote a CMD file that, if you place it in the same folder as pdfcrypt.exe, will let you drag an encrypted (but non-password protected) PDF onto the .cmd file to make a decrypted copy of the PDF in the same folder as the original. I put it under the GPL, so you can redistribute it with pdfcrypt, or post it on your site, or ignore it completely.
The script is attached with a .txt extension so that it is not flagged as a potential threat. You can look through it to ensure it does nothing but facilitate decrypting.

Thanks for your work pdfcrypt, it is much appreciated!

George

And here is the code he contributed, thanks for George’s kindness.

REM Written by George Tenney 11-29-09

REM Usage: Drop an encrypted, but non-password protected, PDF onto
REM this .cmd file to create a decrypted version in the same folder
REM as the original PDF.

REM This program is free software: you can redistribute it and/or modify
REM it under the terms of the GNU General Public License as published by
REM the Free Software Foundation, either version 3 of the License, or
REM (at your option) any later version.
REM
REM This program is distributed in the hope that it will be useful,
REM but WITHOUT ANY WARRANTY; without even the implied warranty of
REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
REM GNU General Public License for more details.
REM
REM To receive a copy of the GNU General Public License
REM see .

@ECHO OFF
REM Set pdfcrypt location
SET PROG=%0
SET PROG=%PROG:~0,-14%pdfcrypt.exe"

REM Check for quotes in filename (i.e., space in path)
SET INFILE=%1
IF ^%INFILE:~0,1% NEQ ^" GOTO :ADDQ
REM ELSE
GOTO :NOADDQ

:ADDQ
REM Add quotes around filenames
SET INFILE="%INFILE%"
SET OUTFILE=%INFILE:~0,-5%_DECRYPT.pdf"
GOTO :RUNNOW

:NOADDQ
REM Don't add quotes around filenames
SET OUTFILE=%INFILE:~0,-5%_DECRYPT.pdf"

:RUNNOW
REM Display Messages
CLS
ECHO.
ECHO.
ECHO Decrypting...
ECHO.
ECHO Input File:
ECHO %INFILE%
ECHO.
ECHO Output File: (WILL BE OVERWRITTEN)
ECHO %OUTFILE%
ECHO.
PAUSE

ECHO.
ECHO.
ECHO This may take a minute, please wait.
ECHO.
ECHO.
ECHO.

REM Run the decryption
%PROG% %INFILE% %OUTFILE% decrypt ""
ECHO.
ECHO.
ECHO Press any key to exit.
PAUSE > NUL

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.