Added --permit-file-read when getting number of pages#22
Added --permit-file-read when getting number of pages#22yannickl88 wants to merge 1 commit intoimalhasaranga:masterfrom yannickl88:fix/windows-permit-file
Conversation
|
Also note, I've tested this fix on my local machine. So I guess all I can provide in the way of proof that it works is "Works on my machine". |
|
I just realized the option might not be available in all versions of ghostscript that pdflib supports. I might need to do a feature check. It seems like this commit introduced them, http://git.ghostscript.com/?p=ghostpdl.git;a=log;h=7ecbfda92b4c8dbf6f6c2bf8fc82020a29219eff My guess is that this might be version 9.50. Their git repository is a bit difficult to browse. I can do two things:
|
|
Just a bump: Tried applying soulution like in this PR, but to no avail. Anyone found a solution? |
See https://www.ghostscript.com/doc/current/Use.htm#Safer
As of ghostscript 9.50 a more strict implementation is used for managing access to files. This means it now defaults to
-dSAFERwhen calling command. This will cause PDFLib to not be able to read the number of pages in a PDF and will given an error "GPL Ghostscript 9.52: Unrecoverable error, exit code 1", falling back to 0 pages.By adding
--permit-file-readto the command this solved this issues and should solve #19. This should work on both Linux and Windows. (My guess is that is also required for Linux, but I cannot verify this.)Note: All the tests were broken for me with a fresh clone and using PHP 7.5 and Ghostscript 9.52 on a Windows machine. With this patch I was able to successfully run the tests except
testImageToPdfwhich fails with the following error: