001    /**
002     * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portlet.documentlibrary.util;
016    
017    import com.liferay.portal.kernel.image.ImageTool;
018    import com.liferay.portal.kernel.lar.PortletDataContext;
019    import com.liferay.portal.kernel.repository.model.FileEntry;
020    import com.liferay.portal.kernel.repository.model.FileVersion;
021    import com.liferay.portal.kernel.xml.Element;
022    
023    import java.io.InputStream;
024    
025    /**
026     * @author Sergio González
027     */
028    public interface PDFProcessor {
029    
030            public static final String PREVIEW_TYPE = ImageTool.TYPE_PNG;
031    
032            public static final String THUMBNAIL_TYPE = ImageTool.TYPE_PNG;
033    
034            public void exportGeneratedFiles(
035                            PortletDataContext portletDataContext, FileEntry fileEntry,
036                            Element fileEntryElement)
037                    throws Exception;
038    
039            public void generateImages(FileVersion fileVersion)
040                    throws Exception;
041    
042            public String getGlobalSearchPath() throws Exception;
043    
044            public InputStream getPreviewAsStream(FileVersion fileVersion, int index)
045                    throws Exception;
046    
047            public int getPreviewFileCount(FileVersion fileVersion);
048    
049            public long getPreviewFileSize(FileVersion fileVersion, int index)
050                    throws Exception;
051    
052            public InputStream getThumbnailAsStream(FileVersion fileVersion, int index)
053                    throws Exception;
054    
055            public long getThumbnailFileSize(FileVersion fileVersion, int index)
056                    throws Exception;
057    
058            public boolean hasImages(FileVersion fileVersion);
059    
060            public void importGeneratedFiles(
061                            PortletDataContext portletDataContext, FileEntry fileEntry,
062                            FileEntry importedFileEntry, Element fileEntryElement)
063                    throws Exception;
064    
065            public boolean isDocumentSupported(FileVersion fileVersion);
066    
067            public boolean isDocumentSupported(String mimeType);
068    
069            public boolean isImageMagickEnabled() throws Exception;
070    
071            public boolean isSupported(String mimeType);
072    
073            public void reset() throws Exception;
074    
075            public void trigger(FileVersion fileVersion);
076    
077    }