mirror of
				https://github.com/johnwhitington/cpdf-source.git
				synced 2025-06-05 22:09:39 +02:00 
			
		
		
		
	more
This commit is contained in:
		
							
								
								
									
										20
									
								
								cpdf.ml
									
									
									
									
									
								
							
							
						
						
									
										20
									
								
								cpdf.ml
									
									
									
									
									
								
							| @@ -3399,8 +3399,6 @@ let set_pdf_info_xml_many only_when_present changes value xmldata pdf = | |||||||
|       changes; |       changes; | ||||||
|     !xmldata |     !xmldata | ||||||
|  |  | ||||||
| (* Set metadata date *) |  | ||||||
| let set_metadata_date pdf only_when_present date = pdf |  | ||||||
|  |  | ||||||
| (* \section{Set an entry in the /Info dictionary} *) | (* \section{Set an entry in the /Info dictionary} *) | ||||||
|  |  | ||||||
| @@ -3462,7 +3460,7 @@ let xmp_date date = | |||||||
|             d.year <- int_of_string (implode [y1; y2; y3; y4]); |             d.year <- int_of_string (implode [y1; y2; y3; y4]); | ||||||
|             begin match r with |             begin match r with | ||||||
|               m1::m2::r -> |               m1::m2::r -> | ||||||
|                 d.month <- int_of_string (implode [y1; y2]); |                 d.month <- int_of_string (implode [m1; m2]); | ||||||
|                 begin match r with |                 begin match r with | ||||||
|                   d1::d2::r -> |                   d1::d2::r -> | ||||||
|                   d.day <- int_of_string (implode [d1; d2]); |                   d.day <- int_of_string (implode [d1; d2]); | ||||||
| @@ -3543,16 +3541,26 @@ let set_pdf_info ?(xmp_also=false) ?(xmp_also_when_present=false) ?(xmp_just_set | |||||||
|                 | "/Trapped" -> [(adobe, "Trapped")], value |                 | "/Trapped" -> [(adobe, "Trapped")], value | ||||||
|                 | _ -> failwith "Unknown call to set_pdf_info" |                 | _ -> failwith "Unknown call to set_pdf_info" | ||||||
|               in |               in | ||||||
|               let pdf = |  | ||||||
|                 set_metadata_from_bytes |                 set_metadata_from_bytes | ||||||
|                   true |                   true | ||||||
|                   (set_pdf_info_xml_many xmp_also_when_present changes value xmldata pdf) |                   (set_pdf_info_xml_many xmp_also_when_present changes value xmldata pdf) | ||||||
|                   pdf |                   pdf | ||||||
|               in |  | ||||||
|                 pdf |  | ||||||
|           end |           end | ||||||
|        else |        else | ||||||
|          pdf |          pdf | ||||||
|  |  | ||||||
|  | (* Set metadata date *) | ||||||
|  | let set_metadata_date pdf date only_when_present = | ||||||
|  |   match get_metadata pdf with | ||||||
|  |     None -> pdf | ||||||
|  |   | Some xmldata -> | ||||||
|  |       let changes= [(xmp, "MetadataDate")] in | ||||||
|  |       let value = match date with "now" -> xmp_date (expand_date "now") | x -> x in | ||||||
|  |         set_metadata_from_bytes | ||||||
|  |           true | ||||||
|  |           (set_pdf_info_xml_many only_when_present changes (Pdf.String value) xmldata pdf) | ||||||
|  |           pdf | ||||||
|  |  | ||||||
| (* \section{Blacken text} *) | (* \section{Blacken text} *) | ||||||
|  |  | ||||||
| (* | (* | ||||||
|   | |||||||
| @@ -10,6 +10,7 @@ | |||||||
| %FIXME: Activate documentation for -extract-images (when done) | %FIXME: Activate documentation for -extract-images (when done) | ||||||
| %FIXME: Document new -artbox, -trimbox, -bleedbox and -remove-artbox, -remove-trimbox, -remove-bleedbox | %FIXME: Document new -artbox, -trimbox, -bleedbox and -remove-artbox, -remove-trimbox, -remove-bleedbox | ||||||
| %FIXME: Document -cropbox and -remove-cropbox as synonyms of -crop and -remove-crop | %FIXME: Document -cropbox and -remove-cropbox as synonyms of -crop and -remove-crop | ||||||
|  | %FIXME: Document new XMP metadata stuff including setmetadata date and its format  | ||||||
| \documentclass{book} | \documentclass{book} | ||||||
| \usepackage{palatino} | \usepackage{palatino} | ||||||
| \usepackage{microtype} | \usepackage{microtype} | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user