cpdf-source/cpdfcreate.ml

20 lines
698 B
OCaml
Raw Permalink Normal View History

2021-12-21 12:12:52 +01:00
open Pdfutil
2021-12-20 10:02:39 +01:00
let blank_document width height pages =
let pdf_pages =
map (fun () -> Pdfpage.blankpage (Pdfpaper.make Pdfunits.PdfPoint width height)) (many () pages)
in
let pdf, pageroot = Pdfpage.add_pagetree pdf_pages (Pdf.empty ()) in
2023-05-09 16:02:59 +02:00
let pdf = Pdfpage.add_root pageroot [] pdf in
Pdf.change_id pdf (string_of_float (Random.float 1.));
pdf
2021-12-20 10:02:39 +01:00
let blank_document_paper papersize pages =
let pdf_pages =
map (fun () -> Pdfpage.blankpage papersize) (many () pages)
in
let pdf, pageroot = Pdfpage.add_pagetree pdf_pages (Pdf.empty ()) in
2023-05-09 16:02:59 +02:00
let pdf = Pdfpage.add_root pageroot [] pdf in
Pdf.change_id pdf (string_of_float (Random.float 1.));
pdf