forked from agalakhov/captdriver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
paper.c
35 lines (33 loc) · 1.36 KB
/
paper.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/*
* Copyright (C) 2013 Alexey Galakhov <agalakhov@gmail.com>
*
* Licensed under the GNU General Public License Version 3
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "paper.h"
#include <cups/raster.h>
void page_set_dims(struct page_dims_s *dims, const struct cups_page_header2_s *header)
{
dims->media_type = header->cupsMediaType;
dims->paper_width = header->PageSize[0] * header->HWResolution[0] / 72;
dims->paper_height = header->PageSize[1] * header->HWResolution[1] / 72;
/*
The use of cupsCompression to toggle toner save was inspired by the
use of the same attribute to control darkness in label printer drivers.
*/
dims->toner_save = header->cupsCompression;
dims->margin_height = header->Margins[0];
dims->margin_width = header->Margins[1];
}