using System;
using System.IO;
using System.Text;
using ImageGear.Core;
using ImageGear.Formats;
using ImageGear.Windows.Forms;
using ImageGear.Formats.PDF;
public String SaveCompressedPDFtoStream(String inputFileName, String outputFileName)
{
// Load PDF document.
ImGearPDFDocument pdfDocument = null;
using (Stream fileStream = new FileStream(inputFileName, FileMode.Open,
FileAccess.Read, FileShare.Read))
{
pdfDocument = (ImGearPDFDocument)ImGearFileFormats.LoadDocument(fileStream);
}
// Save compressed PDF document to stream.
pdfDocument.SaveCompressed(outputFileName);
}
Imports System
Imports System.IO
Imports System.Text
Imports ImageGear.Core
Imports ImageGear.Formats
Imports ImageGear.Formats.PDF
Public Sub SaveCompressedPDFtoStream(inputFileName As String, outputFileName as String)
' Load PDF document.
Dim pdfDocument As ImGearPDFDocument
Using fileStream As New FileStream(inputFileName, FileMode.Open, FileAccess.Read,
FileShare.Read)
pdfDocument = DirectCast(ImGearFileFormats.LoadDocument(fileStream),
ImGearPDFDocument)
End Using
' Save compressed PDF document to stream.
pdfDocument.SaveCompressed(outputFileName)
End Function