Mojave - getting "pdftotext not found" error trying to compare PDFs

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • luckman212
    Expert
    • Jul 2010
    • 52

    Mojave - getting "pdftotext not found" error trying to compare PDFs

    BC4 - Version 4.2.6 (build 23150)
    MacOS 10.14

    Getting an External program "/Applications/Beyond Compare.app/Contents/MacOS/pdftotext" not found error when trying to compare 2 PDFs. Both files are in my "~/Downloads" folder. I have granted BC4 "Full Disk Access" as well in Security prefs. I also double checked that the "pdftotext" binary exists inside the BC app bundle (it does) and that it runs manually from Terminal (it does).



    any idea? This was working as of last week...
  • luckman212
    Expert
    • Jul 2010
    • 52

    #2
    I figured out that I was trying to compare 2 "protected" PDFs. The error message shown in BC was misleading. When I ran the commandline tool on the files directly, I saw the real problem:

    $ pdftotext foo.pdf
    Permission Error: Copying of text from this document is not allowed.


    I opened them in Preview.app, exported as unprotected PDF and voila, working again. I suggest though, maybe the error message can be made clearer so users know what's going on...

    Comment

    • Aaron
      Team Scooter
      • Oct 2007
      • 16009

      #3
      Thanks. We've got an open issue about Mac OS PDF failure messages not reporting correctly in different scenarios. I'll add this case to our tracker entry on the subject.
      Aaron P Scooter Software

      Comment

      • arvan
        New User
        • Jan 2023
        • 1

        #4
        I get the same error reported for a pdf file with parentheses in the name, can you add this case to the issue tracker if it's not already there.

        Comment

        • Aaron
          Team Scooter
          • Oct 2007
          • 16009

          #5
          Thanks. Noted. As a workaround, if you add a space in front of the first (, or remove the () from the name, you should be able to get the conversion working.
          Last edited by Aaron; 03-Jan-2023, 11:53 AM. Reason: Update: And I did add it to the tracker.
          Aaron P Scooter Software

          Comment

          • Chris
            Team Scooter
            • Oct 2007
            • 5538

            #6
            Comparison of PDFs with () in the filename on macOS is fixed in Beyond Compare 4.4.5, just released earlier today.
            Chris K Scooter Software

            Comment

            • luckman212
              Expert
              • Jul 2010
              • 52

              #7
              I just hit this again with BC 4.4.6 build 27483 and it had been so long since I posted this that I totally forgot about it...

              May I suggest updating the bundled pdftotext library? The one that ships with BC currently is very old and outdated (2017). There is a fork that runs native on M-series CPUs and is quite a lot faster, called Poppler. It's available both via Homebrew (brew install poppler) or as a standalone: https://github.com/tsdgeos/poppler_m...lows/cmake.yml

              I tried to add a custom format handler and point it to the Homebrew installed version at /opt/homebrew/bin/pdftotext but it complains "External program not found". I made sure BC has Full Disk Access. Not sure what's going on there.
              Last edited by luckman212; 09-Mar-2023, 08:18 AM.

              Comment

              • Aaron
                Team Scooter
                • Oct 2007
                • 16009

                #8
                Hi,

                Could we get a bit more info on the file that threw a conversion error? This thread is specific to file names with () that would cause a failure, which should be fixed as of 4.4.5 and 4.4.6.

                You can also create your own custom File Format using any conversion utility. We have a guide here, using RESX as an example, but any conversion utility can be used:
                https://www.scootersoftware.com/supp...rnalconversion
                Aaron P Scooter Software

                Comment

                • luckman212
                  Expert
                  • Jul 2010
                  • 52

                  #9
                  Thanks for that tip. I was a little unclear how to set up the custom external File Format. That link was very helpful, I was able to link it to /opt/homebrew/bin/pdftotext and that's working nicely. I wish I took better notes on the specific files that were failing, but if it pops up again I'll come back and post them. I just did a quick test of some files with parentheses () and they worked with both the built in viewer as well as the external, so not sure what else was going on there.

                  I still suggest BC may want to integrate the poppler version above since it does run a lot faster on Apple Silicon.

                  Comment

                  • Aaron
                    Team Scooter
                    • Oct 2007
                    • 16009

                    #10
                    Hello,

                    It's something we can research, but requires digging into not just the application and code but the license if it can be included, provided as an extra download, or a user has to implement it themselves.

                    Sometimes the BC4 PDF error message itself can be a red herring; the most common issues when a PDF fails to convert are caused by Adobe security settings that prevent export, or the file is a picture of text and does not contain any actual text data. Both are quick to test using Adobe itself to open the file then attempt a Save As Text, and note what is generated (blank file?) or a warning or error.
                    Aaron P Scooter Software

                    Comment

                    • luckman212
                      Expert
                      • Jul 2010
                      • 52

                      #11
                      Still do recommend this if/when BC5 gets near...

                      Comment

                      • Aaron
                        Team Scooter
                        • Oct 2007
                        • 16009

                        #12
                        Thanks for the follow up. Swapping the PDF library isn't something we've been able to tackle yet, but we are getting closer with BC5. Hopefully we'll have more to share soon.
                        Aaron P Scooter Software

                        Comment

                        Working...