[repo] Format, clippy clean, FORMATS.md, the full crate table in DEPENDENCIES.md

This commit is contained in:
2026-11-16 13:58:06 +01:00
parent 196802863a
commit a06e3f9b73
17 changed files with 2708 additions and 2125 deletions
+5 -12
View File
@@ -38,6 +38,7 @@ fn s(text: &str) -> Object {
Object::String(text.as_bytes().to_vec(), StringFormat::Literal)
}
#[derive(Default)]
pub struct Options {
pub compress: bool,
/// /Rotate on page 1.
@@ -46,12 +47,6 @@ pub struct Options {
pub inherited: bool,
}
impl Default for Options {
fn default() -> Self {
Options { compress: false, rotate: 0, inherited: false }
}
}
/// Two US-Letter pages. Page 1 holds text, an image, a vector shape, a hidden layer, a note, a form field, all in
/// the box; the document holds Info, XMP, an outline, a struct tree and an attachment with secret strings.
/// Page 2 holds "PAGE-TWO-KEEP" and must come out byte-equal.
@@ -84,7 +79,7 @@ BT /F1 12 Tf 72 300 Td (PUBLIC-LINE) Tj ET\n"
let c2 = doc.add_object(Stream::new(dictionary! {}, PAGE_TWO_CONTENT.to_vec()));
let helv = doc.add_object(dictionary! {"Type" => "Font", "Subtype" => "Type1", "BaseFont" => "Helvetica",
"Encoding" => "WinAnsiEncoding"});
"Encoding" => "WinAnsiEncoding"});
let field_ap = doc.add_object(Stream::new(
dictionary! {"Type" => "XObject", "Subtype" => "Form", "BBox" => vec![0.into(), 0.into(), 200.into(), 20.into()],
"Resources" => dictionary! {"Font" => dictionary! {"Helv" => helv}}},
@@ -160,10 +155,8 @@ BT /F1 12 Tf 72 300 Td (PUBLIC-LINE) Tj ET\n"
"Type" => "StructElem", "S" => "P", "P" => struct_root_id, "Pg" => page1_id,
"ActualText" => s("STRUCT-SECRET"), "K" => 0,
});
doc.objects.insert(
struct_root_id,
Object::Dictionary(dictionary! {"Type" => "StructTreeRoot", "K" => vec![elem.into()]}),
);
doc.objects
.insert(struct_root_id, Object::Dictionary(dictionary! {"Type" => "StructTreeRoot", "K" => vec![elem.into()]}));
let attach = doc.add_object(Stream::new(dictionary! {"Type" => "EmbeddedFile"}, b"ATTACH-SECRET inside".to_vec()));
let filespec = doc.add_object(dictionary! {
"Type" => "Filespec", "F" => s("notes.txt"), "EF" => dictionary! {"F" => attach},
@@ -211,7 +204,7 @@ pub fn numbered_pdf(n: usize, label: &str) -> Vec<u8> {
doc.objects.insert(
pages_id,
Object::Dictionary(dictionary! {"Type" => "Pages", "Kids" => kids, "Count" => n as i64,
"MediaBox" => vec![0.into(), 0.into(), 595.into(), 842.into()]}),
"MediaBox" => vec![0.into(), 0.into(), 595.into(), 842.into()]}),
);
let catalog = doc.add_object(dictionary! {"Type" => "Catalog", "Pages" => pages_id});
doc.trailer.set("Root", catalog);