add pic document type

This commit is contained in:
Qingping Hou
2013-10-17 17:34:55 -04:00
parent 10bf048d77
commit a59723c053
2 changed files with 27 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
PicDocument = Document:new{
_document = false,
dc_null = DrawContext.new(),
}
function PicDocument:init()
ok, self._document = pcall(pic.openDocument, self.file)
if not ok then
self.error_message = "failed to open jpeg image"
return
end
self.info.has_pages = true
self.info.configurable = false
self:readMetadata()
end
function PicDocument:readMetadata()
self.info.number_of_pages = 1
end
DocumentRegistry:addProvider("jpeg", "application/jpeg", PicDocument)
DocumentRegistry:addProvider("jpg", "application/jpeg", PicDocument)