-
-
Notifications
You must be signed in to change notification settings - Fork 100
/
Copy pathno_icc.rs
24 lines (19 loc) · 893 Bytes
/
no_icc.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
//! Example to demonstrate how to remove the default ICC profile
//! Look at the file size (compared to the other tests!)
extern crate printpdf;
use printpdf::*;
use std::fs::File;
use std::io::BufWriter;
fn main() {
// This code creates the most minimal PDF file with 1.2 KB
// Currently, fonts need to use an embedded font, so if you need to write something, the file size
// will still be bloated (because of the embedded font)
// Also, OCG content is still enabled, even if you disable it here.
let (mut doc, _page1, _layer1) = PdfDocument::new("printpdf no_icc test", Mm(297.0), Mm(210.0), "Layer 1");
doc = doc.with_conformance(PdfConformance::Custom(CustomPdfConformance {
requires_icc_profile: false,
requires_xmp_metadata: false,
.. Default::default()
}));
doc.save(&mut BufWriter::new(File::create("test_no_icc.pdf").unwrap())).unwrap();
}