Compress embedded font streams in the PDF writer

This commit is contained in:
gloamxun committed 2026-10-19 22:15:27 +08:00
1 parent 369472e7f7
commit 4735d75c1f
80 files changed
+9119 -5

No files matched your search

+20
View File
@@ -0,0 +1,20 @@
extern crate printpdf;
use printpdf::*;
use std::fs::File;
use std::io::BufWriter;
fn main() {
let (doc, page1, _) = PdfDocument::new("printpdf page test", Mm(210.0), Mm(297.0), "Layer 1");
doc.add_bookmark("This is a bookmark", page1);
let (page2, _) = doc.add_page(Mm(297.0), Mm(210.0), "Page 2, Layer 1");
let _ = doc.get_page(page2).add_layer("Layer 3");
doc.add_bookmark("This is another bookmark", page2);
// If this is successful, you should see a PDF with two blank A4 pages and 2 bookmarks
doc.save(&mut BufWriter::new(
File::create("test_bookmark.pdf").unwrap(),
))
.unwrap();
}