ImageGear for .NET
Save(Stream,ImGearSavingFormats,Int32,Int32,Int32,ImGearSavingModes) Method
See Also  Example Send Feedback
ImageGear21.Formats.Pdf Assembly > ImageGear.Formats.PDF Namespace > ImGearPDFDocument Class > Save Method : Save(Stream,ImGearSavingFormats,Int32,Int32,Int32,ImGearSavingModes) Method




stream
Stream object to save to. Only FileStream and MemoryStream are currently supported.
format
File format to save in.
startPageInStream
Starting page number in the stream.
startPage
Starting page number in the document.
pageCount
The number of pages to be saved.
saveMode
Saving mode.

Glossary Item Box

Native PDF saving routine, recommended for saving PDF and PS documents to System.IO.Stream object.

Syntax

 
Visual Basic
C#
Managed Extensions for C++
C++/CLI
 
 

Parameters

stream
Stream object to save to. Only FileStream and MemoryStream are currently supported.
format
File format to save in.
startPageInStream
Starting page number in the stream.
startPage
Starting page number in the document.
pageCount
The number of pages to be saved.
saveMode
Saving mode.

Example

C#Copy Code
if (igDocument is ImGearPDFDocument)
{
    ImGearPDFDocument pdfDoc = igDocument as ImGearPDFDocument;
    using (MemoryStream mem = new MemoryStream())
    {
        pdfDoc.Save(mem, ImGearSavingFormats.PDF, 0, 0, pdfDoc.Pages.Count, ImGearSavingModes.OVERWRITE);
        using (FileStream file = new FileStream(savePath, FileMode.OpenOrCreate))
        {
            byte[] bytes = mem.ToArray();
            file.Write(bytes, 0, bytes.Length);
        }
    }
}
Visual BasicCopy Code
If TypeOf igDoc Is ImGearPDFDocument Then
    Dim pdfDoc As ImGearPDFDocument
    pdfDoc = igDoc
    'Dim mem As MemoryStream
    Using mem As New MemoryStream()
        pdfDoc.Save(mem, ImGearSavingFormats.PDF, 0, 0, pdfDoc.Pages.Count, ImGearSavingModes.OVERWRITE)
        Using file As New FileStream(savePath, FileMode.OpenOrCreate)
            Dim bytes() As Byte
            bytes = mem.ToArray()
            file.Write(bytes, 0, bytes.Length)
        End Using
    End Using
End If

See Also

©2013. Accusoft Corporation. All Rights Reserved.