2016-01-13 114 views
1

對於我的應用程序,我使用生產和測試服務器(linux)上的pdfinfo軟件包。現在我已經設置了一個本地開發的環境,但我需要安裝相同的包,以使一切正常工作。我目前唯一缺少的軟件包是pdfinfo軟件包,它似乎很難找到。這個軟件包是否可用?mac os的pdfinfo軟件包x

感謝

回答

6

你有兩個選擇,這將給你在OS X

使用xpdf的

使用Xpdf最直接地解決您的問題PDF文檔的信息。它可以通過自制軟件,包含pdfinfo

$ brew search xpdf 
homebrew/x11/xpdf 
$ brew install homebrew/x11/xpdf 
... 

然後,您應該能夠使用pdfinfo正常:

$ pdfinfo Main.pdf 
Title:   Title 
Subject:  Some subject 
Keywords:  
Author:   Joe A. Bloggs 
Creator:  LaTeX with hyperref package 
Producer:  pdfTeX-1.40.16 
CreationDate: Tue Apr 12 18:59:38 2016 
ModDate:  Tue Apr 12 18:59:38 2016 
Tagged:   no 
Form:   none 
Pages:   10 
Encrypted:  no 
Page size:  595.276 x 841.89 pts (A4) (rotated 0 degrees) 
File size:  60057 bytes 
Optimized:  no 
PDF version: 1.5 

使用MDLS

更一般地,你可以使用mdls來列出與關聯的元數據任何文件:

$ mdls Main.pdf 
kMDItemAuthors     = (
    "Joe A. Bloggs" 
) 
kMDItemContentCreationDate  = 2016-04-12 17:56:08 +0000 
kMDItemContentModificationDate = 2016-04-12 17:59:39 +0000 
kMDItemContentType    = "com.adobe.pdf" 
kMDItemContentTypeTree   = (
    "com.adobe.pdf", 
    "public.data", 
    "public.item", 
    "public.composite-content", 
    "public.content" 
) 

kMDItemCreator     = "LaTeX with hyperref package" 
kMDItemDateAdded    = 2016-04-12 17:56:08 +0000 
kMDItemDescription    = "Some subject" 
kMDItemDisplayName    = "Main.pdf" 
kMDItemEncodingApplications = (
    "pdfTeX-1.40.16" 
) 
kMDItemFSContentChangeDate  = 2016-04-12 17:59:39 +0000 
kMDItemFSCreationDate   = 2016-04-12 17:56:08 +0000 
kMDItemFSCreatorCode   = "" 
kMDItemFSFinderFlags   = 0 
kMDItemFSHasCustomIcon   = (null) 
kMDItemFSInvisible    = 0 
kMDItemFSIsExtensionHidden  = 0 
kMDItemFSIsStationery   = (null) 
kMDItemFSLabel     = 0 
kMDItemFSName     = "Main.pdf" 
kMDItemFSNodeCount    = (null) 
kMDItemFSOwnerGroupID   = 20 
kMDItemFSOwnerUserID   = 501 
kMDItemFSSize     = 60057 
kMDItemFSTypeCode    = "" 
kMDItemKind     = "Portable Document Format (PDF)" 
kMDItemLastUsedDate   = 2016-04-12 18:00:54 +0000 
kMDItemLogicalSize    = 60057 
kMDItemNumberOfPages   = 10 
kMDItemPageHeight    = 841.89 
kMDItemPageWidth    = 595.276 
kMDItemPhysicalSize   = 61440 
kMDItemSecurityMethod   = "None" 
kMDItemTitle     = "Title" 
kMDItemUseCount    = 3 
kMDItemUsedDates    = (
    "2016-04-11 23:00:00 +0000" 
) 
kMDItemVersion     = "1.5" 

然後,您可以使用-name-raw標誌提取這樣一段給定信息的:

$ mdls -raw -name kMDItemNumberOfPages Main.pdf 
10 

Source