public class DocumentWriterRasterPage : DocumentWriterPage Public Class DocumentWriterRasterPageInherits DocumentWriterPage
@interface LTDocumentWriterRasterPage : LTDocumentPage <NSCopying> public class DocumentWriterRasterPage extends DocumentWriterPage public ref class DocumentWriterRasterPage : public DocumentWriterPage The DocumentWriterRasterPage structure contains the data for one raster image page to be added to a document file. It is used as a parameter to the DocumentWriter.AddPage or DocumentWriter.InsertPage methods used to add the page.
The DocumentWriterRasterPage.Image property must contain a valid raster image (RasterImage) object that contains the visual representation of the page. This image object can obtained through multiple sources as explained in LEADTOOLS Document Writers.
DocumentWriterRasterPage.Image is used as is when DocumentWriter.AddPage or DocumentWriter.InsertPage is called and the framework does not delete it. You must dispose the object when it is no longer used.
The LEADTOOLS Document Writer supports creating documents with zero or more empty pages inside them. Use DocumentWriter.AddPage or DocumentWriter.InsertPage with an DocumentWriterEmptyPage with the dimension of the empty page set before hand in the DocumentOptions.EmptyPageWidth and DocumentOptions.EmptyPageHeight and its resolution set to DocumentOptions.EmptyPageResolution. As many empty pages as desired can be added in any index desired. To use empty pages, make sure the DocumentOptions.PageRestriction property is set to DocumentPageRestriction.Relaxed.
For more information, refer to PdfDocumentOptions.
This example will create a PDF document with first page from SVG data, second page empty and third page from raster image.
using Leadtools;using Leadtools.Codecs;using Leadtools.Document.Writer;using Leadtools.Ocr;public void DocumentRasterPageExample(){// Input file namevar inputFileName = Path.Combine(LEAD_VARS.ImagesDir, "Leadtools.docx");// Output PDF file namevar outputFileName = Path.Combine(LEAD_VARS.ImagesDir, "Example.pdf");// Create a new instance of the LEADTOOLS Document Writervar docWriter = new DocumentWriter();// Setup a new RasterCodecs objectusing (var codecs = new RasterCodecs()){codecs.Options.RasterizeDocument.Load.Resolution = 300;// Get information on the pagedouble pageWidth;double pageHeight;using (var info = codecs.GetInformation(inputFileName, false, 1)){// Get the size in inches, we need it for the empty pagepageWidth = info.Document.PageWidth;pageHeight = info.Document.PageHeight;}// Begin the documentdocWriter.BeginDocument(outputFileName, DocumentFormat.Pdf);// Add the first page from SVGvar svgPage = new DocumentWriterSvgPage();using (svgPage.SvgDocument = codecs.LoadSvg(inputFileName, 1, null)){// Add itdocWriter.AddPage(svgPage);}// Add a second page as emptyvar emptyPage = new DocumentWriterEmptyPage();emptyPage.Width = pageWidth;emptyPage.Height = pageHeight;docWriter.AddPage(emptyPage);// Finally, add a third page as an imagevar rasterPage = new DocumentWriterRasterPage();using (rasterPage.Image = codecs.Load(inputFileName, 1)){// Add itdocWriter.AddPage(rasterPage);}}// Finally finish writing the HTML file on diskdocWriter.EndDocument();}static class LEAD_VARS{public const string ImagesDir = @"C:\LEADTOOLS21\Resources\Images";}
Imports LeadtoolsImports Leadtools.CodecsImports Leadtools.Document.WriterImports Leadtools.OcrPublic Sub DocumentRasterPageExample()' Input file nameDim inputFileName As String = Path.Combine(LEAD_VARS.ImagesDir, "Leadtools.docx")' Output PDF file nameDim outputFileName As String = Path.Combine(LEAD_VARS.ImagesDir, "Example.pdf")' Create a new instance of the LEADTOOLS Document WriterDim docWriter As New DocumentWriter()' Setup a new RasterCodecs objectUsing codecs As New RasterCodecs()codecs.Options.RasterizeDocument.Load.Resolution = 300' Get information on the pageDim pageWidth As DoubleDim pageHeight As DoubleUsing info As CodecsImageInfo = codecs.GetInformation(inputFileName, False, 1)' Get the size in inches, we need it for the empty pagepageWidth = info.Document.PageWidthpageHeight = info.Document.PageHeightEnd Using' Begin the documentdocWriter.BeginDocument(outputFileName, DocumentFormat.Pdf)' Add the first page from SVGDim svgPage As New DocumentWriterSvgPage()svgPage.SvgDocument = codecs.LoadSvg(inputFileName, 1, Nothing)' Add itdocWriter.AddPage(svgPage)svgPage.SvgDocument.Dispose()' Add a second page as emptyDim emptyPage As New DocumentWriterEmptyPage()emptyPage.Width = pageWidthemptyPage.Height = pageHeightdocWriter.AddPage(emptyPage)' Finally, add a third page as an imageDim rasterPage As New DocumentWriterRasterPage()rasterPage.Image = codecs.Load(inputFileName, 1)' Add itdocWriter.AddPage(rasterPage)rasterPage.Image.Dispose()End Using' Finally finish writing the HTML file on diskdocWriter.EndDocument()End SubPublic NotInheritable Class LEAD_VARSPublic Const ImagesDir As String = "C:\LEADTOOLS21\Resources\Images"End Class
DocumentWriterRasterPage Members
Leadtools.Document.Writer Namespace
Programming with LEADTOOLS Document Writers
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document
