How to build qpdf on Windows?

后端 未结 3 1837
一向
一向 2021-02-04 08:49

When running the checks for my R-package (via devtools::check()) I face the warning \'\'qpdf\' is needed for checks on size reduction of PDFs. I found

相关标签:
3条回答
  • 2021-02-04 09:29

    You basically do not need to build the file on windows. Please follow three steps below:

    1. Download qpdf for windows from https://sourceforge.net/projects/qpdf/?source=typ_redirect
    2. Extract files in a temp folder
    3. Copy the contents of the bin folder to %SystemRoot%\System32

    job done!

    Sys.which(Sys.getenv("R_QPDF", "qpdf"))
                                 qpdf 
    "C:\\WINDOWS\\SYSTEM32\\qpdf.exe" 
    
    0 讨论(0)
  • 2021-02-04 09:32

    Setup MSVC environment, then configure and build as follows:

    ./config-msvc
    make
    

    Here is a more detailed steps: https://github.com/qpdf/qpdf/blob/master/README-windows.md

    Hope it helps.

    0 讨论(0)
  • 2021-02-04 09:46

    To flesh out an answer provided elsewhere:

    If you are running the 32-bit version of R, it is important that you download the 32-bit version of qpdf, which is the version linked from the SourceForge homepage. If you are running a 64-bit installation of R, you will need to do a bit of digging to locate the 64-bit version of qpdf, which is buried a little more deeply (version 10.0.1 is listed here).

    Rather than copying files to C:/Windows/System32, a potentially safer option is to extracted the zipped qpdf directory to C:\Program Files. If you do this, you'll need to add C:\Program Files\qpdf-version_number\bin to your system PATH under the environment variables.

    • To do this within R, run Sys.setenv('PATH' = paste0('C:\Program Files\qpdf-version_numer\bin;', Sys.getenv('PATH')))
    • To do this in Windows, open the start menu, type "edit the system environment variables" to open the System Properties, and at the bottom of the "Advanced" tab click "Environment variables". Find the "Path" entry under "System variables" and click "Edit". Then, re-start R so it picks up the modified PATH.

    One further step may be required to convince Windows that pqdf is safe to run. Navigate to C:\Program Files\qpdf-version_numer\bin and execute qpdf.exe (by double-clicking). Windows 10 throws up a security warning, as it's an unrecognized executable file. You'll need to use the more options link to find the button to run the program. This done, Windows will recognize the file as safe to run and allow other software, including R, to use it.

    0 讨论(0)
提交回复
热议问题