more
This commit is contained in:
parent
d030bc7e74
commit
c08b0351ca
|
@ -3998,15 +3998,16 @@ let go () =
|
|||
write_pdf false pdf
|
||||
| Some (Typeset filename) ->
|
||||
let text = Pdfio.bytes_of_input_channel (open_in filename) in
|
||||
let pdf = Pdf.empty () in
|
||||
let font =
|
||||
match args.font with
|
||||
| StandardFont f -> Pdftext.StandardFont (f, Pdftext.WinAnsiEncoding)
|
||||
| FontToEmbed (fontfile, encoding) ->
|
||||
Cpdfembed.embed_truetype (Pdf.empty ()) ~fontfile ~fontname:args.fontname ~codepoints:[] ~encoding
|
||||
Cpdfembed.embed_truetype pdf ~fontfile ~fontname:args.fontname ~codepoints:[] ~encoding
|
||||
| _ -> error "text to PDF: not a standard or embedded font"
|
||||
in
|
||||
let pdf =
|
||||
Cpdftexttopdf.typeset ~papersize:args.createpdf_pagesize ~font ~fontsize:args.fontsize text
|
||||
Cpdftexttopdf.typeset ~pdf:pdf ~papersize:args.createpdf_pagesize ~font ~fontsize:args.fontsize text
|
||||
in
|
||||
write_pdf false pdf
|
||||
|
||||
|
|
|
@ -28,9 +28,9 @@ let rec of_utf8_with_newlines charcode_extractor t =
|
|||
if c <> [] then items := Text (charcodes_of_codepoints c)::!items;
|
||||
rev !items
|
||||
|
||||
let typeset ~papersize ~font ~fontsize text =
|
||||
let typeset ?pdf ~papersize ~font ~fontsize text =
|
||||
let charcode_extractor = Pdftext.charcode_extractor_of_font_real font in
|
||||
let pdf = Pdf.empty () in
|
||||
let pdf = match pdf with None -> Pdf.empty () | Some pdf -> pdf in
|
||||
let margin =
|
||||
Pdfunits.convert
|
||||
72. (Pdfpaper.unit papersize) (Pdfunits.PdfPoint) (Pdfpaper.width papersize) /. 15.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
(** Text to PDF *)
|
||||
|
||||
(** Typeset a text file as a PDF. *)
|
||||
val typeset : papersize:Pdfpaper.t -> font:Pdftext.font -> fontsize:float -> Pdfio.bytes -> Pdf.t
|
||||
val typeset : ?pdf:Pdf.t -> papersize:Pdfpaper.t -> font:Pdftext.font -> fontsize:float -> Pdfio.bytes -> Pdf.t
|
||||
|
|
Loading…
Reference in New Issue