PDF Mosaic: How to open an existing PDF document


Home       Features       Download       Tutorial       Version History       License       Source Code

 

This sample shows how to open an existing PDF and re-save it using PDF Mosaic library.

C# :

using PDFMosaic;
using System;
 
namespace OpenAndReSave
{
    class OpenAndReSave
    {
        static void Main(string[] args)
        {
            // Open existing pdf document
            PDFDocument document = new PDFDocument(“any_document.pdf); // Open existing PDF document
 
            // Gets the number of pages in the collection
            System.Windows.Forms.MessageBox.Show(“The document contains “ + document.Pages.Count + ” pages”);
 
            // Change the compression of document
            document.Compression = PDFCompression.Flate;
 
            document.Save(“OpenAndReSave.pdf”, true);
        }
    }
}

 

Visial Basic.NET :

Imports PDFMosaic
Imports System
 
Module OpenAndReSave
  Sub Main()
    ' Open existing PDF document
    Dim document As New PDFDocument(“any_document.pdf")
 
    ' Gets the number of pages in the collection
    System.Windows.Forms.MessageBox.Show("The document contains " & document.Pages.Count & " pages")
 
    ' Change the compression of document
    document.Compression = PDFCompression.Flate
 
    document.Save("OpenAndReSave.pdf", True)
  End Sub
End Module

 


Home       Features       Download       Tutorial       Version History       License       Source Code