mirror of
https://github.com/typst/typst
synced 2025-05-13 20:46:23 +08:00
Polish and document PDF crate ✈
This commit is contained in:
parent
77e5299667
commit
0511979942
@ -4,7 +4,7 @@ use std::collections::HashSet;
|
|||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::io::{self, Write, Cursor};
|
use std::io::{self, Write, Cursor};
|
||||||
use pdf::{PdfWriter, Reference, Rect, Version, Trailer};
|
use pdf::{PdfWriter, Reference, Rect, Version, Trailer};
|
||||||
use pdf::{Catalog, PageTree, Page, Resource, Text, Content};
|
use pdf::{DocumentCatalog, PageTree, Page, Resource, Text, Content};
|
||||||
use pdf::font::{Type0Font, CMapEncoding, CIDFont, CIDFontType, CIDSystemInfo, WidthRecord,
|
use pdf::font::{Type0Font, CMapEncoding, CIDFont, CIDFontType, CIDSystemInfo, WidthRecord,
|
||||||
FontDescriptor, FontFlags, EmbeddedFont, GlyphUnit};
|
FontDescriptor, FontFlags, EmbeddedFont, GlyphUnit};
|
||||||
use opentype::{OpenTypeReader, tables::{self, MacStyleFlags}};
|
use opentype::{OpenTypeReader, tables::{self, MacStyleFlags}};
|
||||||
@ -162,7 +162,8 @@ impl<'a, W: Write> PdfCreator<'a, W> {
|
|||||||
/// Write the document catalog, page tree and pages.
|
/// Write the document catalog, page tree and pages.
|
||||||
fn write_pages(&mut self) -> PdfResult<()> {
|
fn write_pages(&mut self) -> PdfResult<()> {
|
||||||
// The document catalog
|
// The document catalog
|
||||||
self.writer.write_obj(self.offsets.catalog, &Catalog::new(self.offsets.page_tree))?;
|
self.writer.write_obj(self.offsets.catalog,
|
||||||
|
&DocumentCatalog::new(self.offsets.page_tree))?;
|
||||||
|
|
||||||
// Root page tree
|
// Root page tree
|
||||||
self.writer.write_obj(self.offsets.page_tree, PageTree::new()
|
self.writer.write_obj(self.offsets.page_tree, PageTree::new()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user