Process PDF protected by password fails.
-
- Posts: 3
- Joined: 2017-03-08T03:07:00-07:00
- Authentication code: 1151
Process PDF protected by password fails.
I have a problem managing pdf with password.
The command convert with -authenticate <password> seems doesn't work.
I am using a computer with the following configuration:
SO:Windows 10 home edition 64 bit
Imagemagick Version:
ImageMagick 7.0.5-1 Q16 x64 2017-03-04 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Visual C++: 180040629
Features: Cipher DPC Modules OpenMP
Delegates (built-in): bzlib cairo flif freetype jng jp2 jpeg lcms lqr openexr pangocairo png ps rsvg tiff webp xml zlib
I tried to create jpeg and gif from a protected pdf.
I tried to use the following comand:
convert -authenticate 5f9bd2f2f465b3535b48c664e6c68d7b 1_8d0b4fd2f4.pdf test.jpg
and I received the following error message
convert: PDFDelegateFailed `[ghostscript library 9.20] -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pamcmyk32" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r72x72" -dUseCIEColor "-sOutputFile=C:/Users/SQUATT~1/AppData/Local/Temp/magick-4928zJv9DtYHVMAg%d" "-fC:/Users/SQUATT~1/AppData/Local/Temp/magick-4928DDtDU4qsbyzU" "-fC:/Users/SQUATT~1/AppData/Local/Temp/magick-4928gE2ciUCx7dDo"': **** This file requires a password for access.
Error: /invalidfileaccess in pdf_process_Encrypt
Operand stack:
Execution stack:
%interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push 1983 1 3 %oparray_pop 1982 1 3 %oparray_pop 1966 1 3 %oparray_pop --nostringval-- --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push
Dictionary stack:
--dict:1205/1684(ro)(G)-- --dict:1/20(G)-- --dict:83/200(L)-- --dict:83/200(L)-- --dict:135/256(ro)(G)-- --dict:291/300(ro)(G)-- --dict:28/32(L)--
Current allocation mode is local
GPL Ghostscript 9.20: Unrecoverable error, exit code 1
@ error/pdf.c/InvokePDFDelegate/274.
convert: no images defined `test.jpg' @ error/convert.c/ConvertImageCommand/3254.
To verify it it is a Ghostscript problem I tried to create a jpeg file using the following command:
gs -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -sOutputFile=test.jpg -sPDFPassword=5f9bd2f2f465b3535b48c664e6c68d7b 1_8d0b4fd2f4.pdf
Ghostscript created the image without any error.
Investigating more, it seems that imagemagick doesn't set the password parameter when invoking the delegate during the conversion.
I verified it, I tried to change temporarily the file delegate.xml inside my imagemagick folder installation D:\Program Files\ImageMagick-7.0.5-Q16 adding the password parameter with the password of pdf I need to create the jpeg:
<delegate decode="ps:cmyk" stealth="True" command=""@PSDelegate@" -q -dQUIET -sPDFPassword=5f9bd2f2f465b3535b48c664e6c68d7b -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pamcmyk32" -dTextAlphaBits=%u -dGraphicsAlphaBits=%u "-r%s" %s "-sOutputFile=%s" "-f%s" "-f%s""/>
and than to execute the command
convert -authenticate 5f9bd2f2f465b3535b48c664e6c68d7b 1_8d0b4fd2f4.pdf test.jpg
again and it works.
I already used the -authenticate option with many versions of linux (Debian, Centos) and windows (Windows 7, 8, 8.1) but this is the first time I have this kind of problem.
Thanks in advance.
The command convert with -authenticate <password> seems doesn't work.
I am using a computer with the following configuration:
SO:Windows 10 home edition 64 bit
Imagemagick Version:
ImageMagick 7.0.5-1 Q16 x64 2017-03-04 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Visual C++: 180040629
Features: Cipher DPC Modules OpenMP
Delegates (built-in): bzlib cairo flif freetype jng jp2 jpeg lcms lqr openexr pangocairo png ps rsvg tiff webp xml zlib
I tried to create jpeg and gif from a protected pdf.
I tried to use the following comand:
convert -authenticate 5f9bd2f2f465b3535b48c664e6c68d7b 1_8d0b4fd2f4.pdf test.jpg
and I received the following error message
convert: PDFDelegateFailed `[ghostscript library 9.20] -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pamcmyk32" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r72x72" -dUseCIEColor "-sOutputFile=C:/Users/SQUATT~1/AppData/Local/Temp/magick-4928zJv9DtYHVMAg%d" "-fC:/Users/SQUATT~1/AppData/Local/Temp/magick-4928DDtDU4qsbyzU" "-fC:/Users/SQUATT~1/AppData/Local/Temp/magick-4928gE2ciUCx7dDo"': **** This file requires a password for access.
Error: /invalidfileaccess in pdf_process_Encrypt
Operand stack:
Execution stack:
%interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push 1983 1 3 %oparray_pop 1982 1 3 %oparray_pop 1966 1 3 %oparray_pop --nostringval-- --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push
Dictionary stack:
--dict:1205/1684(ro)(G)-- --dict:1/20(G)-- --dict:83/200(L)-- --dict:83/200(L)-- --dict:135/256(ro)(G)-- --dict:291/300(ro)(G)-- --dict:28/32(L)--
Current allocation mode is local
GPL Ghostscript 9.20: Unrecoverable error, exit code 1
@ error/pdf.c/InvokePDFDelegate/274.
convert: no images defined `test.jpg' @ error/convert.c/ConvertImageCommand/3254.
To verify it it is a Ghostscript problem I tried to create a jpeg file using the following command:
gs -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -sOutputFile=test.jpg -sPDFPassword=5f9bd2f2f465b3535b48c664e6c68d7b 1_8d0b4fd2f4.pdf
Ghostscript created the image without any error.
Investigating more, it seems that imagemagick doesn't set the password parameter when invoking the delegate during the conversion.
I verified it, I tried to change temporarily the file delegate.xml inside my imagemagick folder installation D:\Program Files\ImageMagick-7.0.5-Q16 adding the password parameter with the password of pdf I need to create the jpeg:
<delegate decode="ps:cmyk" stealth="True" command=""@PSDelegate@" -q -dQUIET -sPDFPassword=5f9bd2f2f465b3535b48c664e6c68d7b -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pamcmyk32" -dTextAlphaBits=%u -dGraphicsAlphaBits=%u "-r%s" %s "-sOutputFile=%s" "-f%s" "-f%s""/>
and than to execute the command
convert -authenticate 5f9bd2f2f465b3535b48c664e6c68d7b 1_8d0b4fd2f4.pdf test.jpg
again and it works.
I already used the -authenticate option with many versions of linux (Debian, Centos) and windows (Windows 7, 8, 8.1) but this is the first time I have this kind of problem.
Thanks in advance.
Re: Process PDF protected by password fails.
Easy fix. Can you post a URL to a password protected PDF and its associated password. We will dowload the PDF and use it to verify our patch. Thanks.
-
- Posts: 3
- Joined: 2017-03-08T03:07:00-07:00
- Authentication code: 1151
Re: Process PDF protected by password fails.
Here the url to test it with pdf and its password.
https://www.dropbox.com/sh/whtc1pggxbfy ... UDl2a?dl=0
Thanks in advance.
https://www.dropbox.com/sh/whtc1pggxbfy ... UDl2a?dl=0
Thanks in advance.
Re: Process PDF protected by password fails.
Thanks for the problem report. We can reproduce it and will have a patch to fix it in GIT master branch @ https://github.com/ImageMagick/ImageMagick later today. The patch will be available in the beta releases of ImageMagick @ http://www.imagemagick.org/download/beta/ by sometime tomorrow.
-
- Posts: 3
- Joined: 2017-03-08T03:07:00-07:00
- Authentication code: 1151
Re: Process PDF protected by password fails.
I have dowloaded the last version of imagemagick for Windows 10 (7.0.5-2) where is reported fixed the problem. I tried to use convert with the test file you sent me, but the conversion still fails.
This is the new version of Imagemagick I used:
Version: ImageMagick 7.0.5-2 Q16 x64 2017-03-11 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Visual C++: 180040629
Features: Cipher DPC Modules OpenMP
Delegates (built-in): bzlib cairo flif freetype jng jp2 jpeg lcms lqr openexr pangocairo png ps rsvg tiff webp xml zlib
I tried the following command: convert -authenticate 5f9bd2f2f465b3535b48c664e6c68d7b 1_8d0b4fd2f4.pdf test.jpg
and I got the following message:
Thanks in advance.
This is the new version of Imagemagick I used:
Version: ImageMagick 7.0.5-2 Q16 x64 2017-03-11 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Visual C++: 180040629
Features: Cipher DPC Modules OpenMP
Delegates (built-in): bzlib cairo flif freetype jng jp2 jpeg lcms lqr openexr pangocairo png ps rsvg tiff webp xml zlib
I tried the following command: convert -authenticate 5f9bd2f2f465b3535b48c664e6c68d7b 1_8d0b4fd2f4.pdf test.jpg
and I got the following message:
Code: Select all
convert: PDFDelegateFailed `[ghostscript library 9.20] -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pamcmyk32" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r72x72" -dUseCIEColor "-sOutputFile=C:/Users/SQUATT~1/AppData/Local/Temp/magick-162848oEXo7JW8h7Y%d" "-fC:/Users/SQUATT~1/AppData/Local/Temp/magick-16284TTVCajluufxs" "-fC:/Users/SQUATT~1/AppData/Local/Temp/magick-162840mOKa1FHpIVp"': **** This file requires a password for access.
Error: /invalidfileaccess in pdf_process_Encrypt
Operand stack:
Execution stack:
%interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push 1983 1 3 %oparray_pop 1982 1 3 %oparray_pop 1966 1 3 %oparray_pop --nostringval-- --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push
Dictionary stack:
--dict:1205/1684(ro)(G)-- --dict:1/20(G)-- --dict:83/200(L)-- --dict:83/200(L)-- --dict:135/256(ro)(G)-- --dict:291/300(ro)(G)-- --dict:28/32(L)--
Current allocation mode is local
GPL Ghostscript 9.20: Unrecoverable error, exit code 1
@ error/pdf.c/InvokePDFDelegate/274.
convert: no images defined `test.jpg' @ error/convert.c/ConvertImageCommand/3254.
Re: Process PDF protected by password fails.
Apparently the patch did not make it from our development area to the git repository. We'll have a fix in the next point release within the next few days.
-
- Posts: 1
- Joined: 2017-11-20T03:27:09-07:00
- Authentication code: 1152
Re: Process PDF protected by password fails.
Is this issue resolved?
I get the same error posted by @ShadowStar
I get the same error posted by @ShadowStar
Code: Select all
**** This file requires a password for access.
Error: /invalidfileaccess in pdf_process_Encrypt
Operand stack:
Execution stack:
%interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push 1999 1 3 %oparray_pop 1998 1 3 %oparray_pop 1982 1 3 %oparray_pop --nostringval-- --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push
Dictionary stack:
--dict:986/1684(ro)(G)-- --dict:1/20(G)-- --dict:83/200(L)-- --dict:83/200(L)-- --dict:133/256(ro)(G)-- --dict:301/450(ro)(G)-- --dict:28/32(L)--
Current allocation mode is local
GPL Ghostscript 9.22: Unrecoverable error, exit code 1
convert: FailedToExecuteCommand `'gs' -sstdout=%stderr -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 '-sDEVICE=pngalpha' -dTextAlphaBits=4 -dGraphicsAlphaBits=4 '-r72x72' '-sOutputFile=/var/folders/5d/4qtzhf852rz1kd42t1fzz0040000gn/T/magick-803-ih_uOWIhuoL%d' '-f/var/folders/5d/4qtzhf852rz1kd42t1fzz0040000gn/T/magick-803nvZHDw4jMBYa' '-f/var/folders/5d/4qtzhf852rz1kd42t1fzz0040000gn/T/magick-803_c0dBPfkgosA'' (1) @ error/pdf.c/InvokePDFDelegate/291.
convert: no images defined `withoutpass.tiff' @ error/convert.c/ConvertImageCommand/3275.
Re: Process PDF protected by password fails.
Did you add `-authenticate` with the password and are you using the latest version?
Re: Process PDF protected by password fails.
Would you point me to that patch?
Which version of ImageMagick has solved this bug?
(I have just filed https://bugzilla.redhat.com/show_bug.cgi?id=1520117 to track this issue in Fedora's ImageMagick-6.9.9.22-1.fc27.x86_64 )
Re: Process PDF protected by password fails.
You can find the patch here: https://github.com/ImageMagick/ImageMag ... ce3a2971f9
Re: Process PDF protected by password fails.
I'm using ImageMagick 7.0.8-12 Q16 2018-09-23 on Windows 10. I can confirm you that this issue is resolved.
You need to pass the "authenticate" option BEFORE the source image name (not AFTER).
The command :
produces an error, while the command
works properly (pay attention to the location of the "-authenticate myPassword" parameter).
You need to pass the "authenticate" option BEFORE the source image name (not AFTER).
The command :
Code: Select all
convert myPasswordProtectedFile.pdf -authenticate myPassword extractedPage.png
Code: Select all
convert -authenticate myPassword myPasswordProtectedFile.pdf extractedPage.png