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.
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 Basic | Copy 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 |