1. Changed license year
[apps/home/mobileprint.git] / mobileprint / previewgen / include / previewgen.h
1 /*
2 *  Mobileprint
3 *
4 * Copyright 2012  Samsung Electronics Co., Ltd
5
6 * Licensed under the Flora License, Version 1.1 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9
10 * http://floralicense.org/license/
11
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 *
18 */
19
20 #ifndef _PREVIEWGEN_H_INCLUDED_
21 #define _PREVIEWGEN_H_INCLUDED_
22
23
24 #include <stdio.h>
25
26 #include "paper_size.h"
27
28
29 #define PDF_PAGE_MAX_VAL       999999
30 #define PDF_PAGE_MAX_STR_LEN   (sizeof("999999") - 1)
31
32
33 struct pdf_preview_settings {
34         int w;
35         int h;
36         int page; /* page from 1 */
37 };
38
39 enum file_type {
40         FILE_TYPE_IMAGE,
41         FILE_TYPE_PDF,
42         FILE_TYPE_INCORRECT
43 };
44
45 /* TODO: check for additional types */
46 #define IMG_FILE_EXTS   {"png", "ppm", "jpg", "jpeg", "tif", "tiff", "gif", \
47                 "bmp", "pcx", NULL}
48 #define PDF_FILE_EXT    "pdf"
49
50 #define PREVIEW_TEMP_DIR        "/tmp/mobileprint"
51 #define IMG_TEMP_FILE_NAME      PREVIEW_TEMP_DIR "/out.ppm"
52 #define PREVIEW_IMG_TEMP_FILE_NAME IMG_TEMP_FILE_NAME
53
54
55 int is_page_landscape(struct size_pts *s);
56 int get_pdf_page_size(const char *path, struct size_pts *s);
57 int get_pdf_pages_count(const char *path);
58 int get_pdf_preview(const char *path,
59                                         const struct pdf_preview_settings *settings,
60                                         void **out_img, int *size);
61 enum file_type get_file_type(const char *fname);
62
63 #endif /* _PREVIEWGEN_H_INCLUDED_ */
64