Accusoft.PdfXpress5.Net
Convert Image to PDF
See Also Send Feedback
PDF Xpress 5 for .NET - User Guide > How To > Convert Image to PDF

Glossary Item Box

To create an image-only PDF, first create a new document object, using the Document Constructor.

PDF Xpress™ does not offer native compression or decompression of image streams used to create PDF pages. ImagXpress® can be used in conjunction with PDF Xpress to provide file compression, decompression and format conversion.
C# Example Copy Code
// This code demonstrates converting an image file to a single page PDF file 
PdfXpress pdfXpress = null ;
Document outputDocument = null ;
try
{
          PdfXpress pdfXpress = new PdfXpress();           
          pdfXpress.Initialize();
          Document outputDocument = new Document(pdfXpress);
          PageOptions pageOptions = new PageOptions( );
          pageOptions.MediaWidth = 8.5 * 72.0;
          pageOptions.MediaHeight = 11.0 * 72.0;
          outputDocument.CreatePage( -1 , pageOptions );
          String  inputFilename = "C:\\pdftest.bmp";
          int pageNumber =0;
          int SourcepageNumber =0;
          double destinationX = 0.25 * 72.0; 
          double destinationY = 0.25 * 72.0;
          double destinationWidth = pageOptions.MediaWidth - 0.5 * 72.0;
          double destinationHeight = pageOptions.MediaHeight - 0.5 * 72.0;
          ImageFitSettings destinationFit = ImageFitSettings.Shrink;
          outputDocument.AddImage(pageNumber, destinationX, destinationY, destinationWidth, destinationHeight,destinationFit, inputFilename,   SourcepageNumber);
}
catch (System.Exception ex)
{               
}
finally
{
         if ( null != outputDocument ) outputDocument.Dispose( );
         if ( null != pdfXpress1 ) pdfXpress.Dispose( );
}

See Also

©2012. Accusoft Corporation. All Rights Reserved.