WriteMarker(string,int,RasterMarkerMetadata) Method (original) (raw)

Summary

Writes a marker to an existing file.

Syntax

C#

Objective-C

C++/CLI

Python

- (BOOL)writeMarker:(nullable LTRasterMarkerMetadata *)_marker_ toFile:(NSString *)file pageNumber:(NSInteger)_pageNumber_ error:(NSError **)error

Parameters

fileName
A String that contains the file name.

pageNumber
1-based index of the page at which to write the marker.

Example

This example read the markers from a source file and saving them to a destination file

using Leadtools; using Leadtools.Codecs; using Leadtools.ImageProcessing; using Leadtools.ImageProcessing.Color; using Leadtools.Svg; void MarkersExample(string srcFileName, string destFileName) { RasterCodecs codecs = new RasterCodecs(); // Load the source image with markers Debug.WriteLine("Loading the source image with all markers"); codecs.Options.Load.Markers = true; RasterImage srcImage = codecs.Load(srcFileName); // Show the markers loaded Debug.WriteLine("These markers were loaded:"); foreach (RasterMarkerMetadata marker in srcImage.Markers) { byte[] data = marker.GetData(); codecs.WriteMarker(srcFileName, 1, marker); // codecs.WriteMarker(stream, 1, marker); codecs.WriteTransformMarker(marker.Id, data, 0, 1); Debug.WriteLine(" {0}, DataSize:{1}", marker.Id, data.Length); } // Create the destination image RasterImage destImage = new RasterImage( RasterMemoryFlags.Conventional, 320, 20, 24, RasterByteOrder.Bgr, RasterViewPerspective.TopLeft, null, IntPtr.Zero, 0); // Save this as JPEG codecs.Save(destImage, destFileName, RasterImageFormat.Jpeg, 24); // Write the markers from the source image to this destination image Debug.WriteLine("Writing the markers to the destination file"); codecs.WriteMarkers(destFileName, 1, srcImage.Markers); srcImage.Dispose(); destImage.Dispose(); // Re-load the destination image with markers Debug.WriteLine("Loading the destination image with all markers"); codecs.Options.Load.Markers = true; destImage = codecs.Load(destFileName); // Show the markers loaded Debug.WriteLine("These markers were loaded:"); foreach (RasterMarkerMetadata marker in destImage.Markers) { byte[] data = marker.GetData(); Debug.WriteLine(" {0}, DataSize:{1}", marker.Id, data.Length); } destImage.Dispose(); // Clean up codecs.Dispose(); }

Leadtools.Codecs Assembly

CompactFile(Stream,Stream,int,int,bool,int,int,bool,int,CodecsSavePageMode,bool,bool) Method

CompactFile(Stream,Stream,int,int,bool,long,int,bool,long,CodecsSavePageMode,bool,bool,bool) Method

CompactFile(string,string,int,int,bool,int,int,bool,int,CodecsSavePageMode,bool,bool) Method

CompactFile(string,string,int,int,bool,long,int,bool,long,CodecsSavePageMode,bool,bool,bool) Method

StartCompress(int,int,int,RasterByteOrder,RasterViewPerspective,int,byte[],int,int,CodecsCompression,CodecsCompressDataCallback) Method