Plumbing for subformat, title to images and typesetting
This commit is contained in:
parent
1cf0c58f14
commit
c9dfa1c95b
|
@ -1025,7 +1025,7 @@ let fixdashes s =
|
|||
let set_input_image f s =
|
||||
try
|
||||
let fh = open_in_bin s in
|
||||
let pdf = Cpdfimage.image_of_input f (Pdfio.input_of_channel fh) in
|
||||
let pdf = Cpdfimage.image_of_input ~subformat:args.subformat ~title:args.title f (Pdfio.input_of_channel fh) in
|
||||
begin try close_in fh with _ -> () end;
|
||||
args.original_filename <- s;
|
||||
args.create_objstm <- true;
|
||||
|
@ -4560,7 +4560,7 @@ let go () =
|
|||
| Some (Typeset filename) ->
|
||||
let text = Pdfio.bytes_of_input_channel (open_in_bin filename) in
|
||||
let cpdffont = embed_font () in
|
||||
let pdf = Cpdftexttopdf.typeset ~font:cpdffont ~papersize:args.createpdf_pagesize ~fontsize:args.fontsize text in
|
||||
let pdf = Cpdftexttopdf.typeset ~subformat:args.subformat ~title:args.title ~font:cpdffont ~papersize:args.createpdf_pagesize ~fontsize:args.fontsize text in
|
||||
write_pdf false pdf
|
||||
| Some (TextWidth s) ->
|
||||
let rawwidth =
|
||||
|
|
|
@ -493,7 +493,7 @@ let obj_of_jbig2_data ?global data =
|
|||
in
|
||||
Pdf.Stream {contents = (Pdf.Dictionary d, Pdf.Got data)}, extra
|
||||
|
||||
let image_of_input fobj i =
|
||||
let image_of_input ?subformat ?title fobj i =
|
||||
let pdf = Pdf.empty () in
|
||||
let data = Pdfio.bytes_of_input i 0 i.Pdfio.in_channel_length in
|
||||
let obj, extras = fobj () data in
|
||||
|
|
|
@ -25,7 +25,7 @@ val process :
|
|||
path_to_jbig2enc:string -> path_to_convert:string -> int list -> Pdf.t -> unit
|
||||
|
||||
(**/**)
|
||||
val image_of_input : (unit -> Pdfio.bytes -> Pdf.pdfobject * (int * Pdf.pdfobject) list) -> Pdfio.input -> Pdf.t
|
||||
val image_of_input : ?subformat:Cpdfua.subformat option -> ?title:string option -> (unit -> Pdfio.bytes -> Pdf.pdfobject * (int * Pdf.pdfobject) list) -> Pdfio.input -> Pdf.t
|
||||
val obj_of_jpeg_data : Pdfio.bytes -> Pdf.pdfobject * (int * Pdf.pdfobject) list
|
||||
val obj_of_png_data : Pdfio.bytes -> Pdf.pdfobject * (int * Pdf.pdfobject) list
|
||||
val obj_of_jbig2_data : ?global:Pdfio.bytes -> Pdfio.bytes -> Pdf.pdfobject * (int * Pdf.pdfobject) list
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
%Document -subformat for -jpg, -png etc.
|
||||
%Document -subformat for -typeset
|
||||
%Document -subformat and -title for -jpg, -png etc.
|
||||
%Document -subformat and -title for -typeset
|
||||
\documentclass{book}
|
||||
% Edit here to produce cpdfmanual.pdf, cpdflibmanual.pdf, pycpdfmanual.pdf,
|
||||
% dotnetcpdflibmanual.pdf, jcpdflibmanual.pdf jscpdflibmanual.pdf etc.
|
||||
|
|
|
@ -43,7 +43,7 @@ let of_utf8_with_newlines fontpack fontsize t =
|
|||
if c <> [] then process_codepoints c;
|
||||
rev !items
|
||||
|
||||
let typeset ~papersize ~font ~fontsize text =
|
||||
let typeset ?subformat ?title ~papersize ~font ~fontsize text =
|
||||
let pdf = Pdf.empty () in
|
||||
let codepoints = setify (Pdftext.codepoints_of_utf8 (Pdfio.string_of_bytes text)) in
|
||||
let fontpack =
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
(** Text to PDF *)
|
||||
|
||||
(** Typeset a text file as a PDF. *)
|
||||
val typeset : papersize:Pdfpaper.t -> font:Cpdfembed.cpdffont -> fontsize:float -> Pdfio.bytes -> Pdf.t
|
||||
val typeset : ?subformat:Cpdfua.subformat option -> ?title:string option -> papersize:Pdfpaper.t -> font:Cpdfembed.cpdffont -> fontsize:float -> Pdfio.bytes -> Pdf.t
|
||||
|
|
Loading…
Reference in New Issue