ImageGear .NET v25.2 - Updated
Save(Stream,ImGearSavingFormats,Int32,Int32,Int32,ImGearSavingModes) Method
Example 




ImageGear.Formats.Pdf Assembly > ImageGear.Formats.PDF Namespace > ImGearPDFDocument Class > Save Method : Save(Stream,ImGearSavingFormats,Int32,Int32,Int32,ImGearSavingModes) Method
Stream object to save to. Only FileStream and MemoryStream are currently supported.
File format to save in.
Starting page number in the stream.
Starting page number in the document.
The number of pages to be saved.
Saving mode.
Native PDF saving routine, recommended for saving PDF and PS documents to System.IO.Stream object.
Syntax
'Declaration
 
Public Overloads Sub Save( _
   ByVal stream As Stream, _
   ByVal format As ImGearSavingFormats, _
   ByVal startPageInStream As Integer, _
   ByVal startPage As Integer, _
   ByVal pageCount As Integer, _
   ByVal saveMode As ImGearSavingModes _
) 
'Usage
 
Dim instance As ImGearPDFDocument
Dim stream As Stream
Dim format As ImGearSavingFormats
Dim startPageInStream As Integer
Dim startPage As Integer
Dim pageCount As Integer
Dim saveMode As ImGearSavingModes
 
instance.Save(stream, format, startPageInStream, startPage, pageCount, saveMode)
public void Save( 
   Stream stream,
   ImGearSavingFormats format,
   int startPageInStream,
   int startPage,
   int pageCount,
   ImGearSavingModes saveMode
)
public: void Save( 
   Stream* stream,
   ImGearSavingFormats format,
   int startPageInStream,
   int startPage,
   int pageCount,
   ImGearSavingModes saveMode
) 
public:
void Save( 
   Stream^ stream,
   ImGearSavingFormats format,
   int startPageInStream,
   int startPage,
   int pageCount,
   ImGearSavingModes saveMode
) 

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
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);
        }
    }
}
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

Reference

ImGearPDFDocument Class
ImGearPDFDocument Members
Overload List
ImGearPDFDictionary Class
ImGearSavingFormats Enumeration
ImGearSavingModes Enumeration

Is this page helpful?
Yes No
Thanks for your feedback.