com.aspose.pdf.facades

Class PdfProducer

  • Direct Known Subclasses:
    CgmPdfProducer


    public abstract class PdfProducer
    extends Object

    Represents a class to produce PDF from other formats.


    This sample shows how to produce Pdf file from CGM file.
     
     String inputFile = "myImage.cgm";
     String outputFile = "myPdf.pdf";
     try
     {
         PdfProducer.produce(inputFile, ImportFormat.Cgm, outputFile);
         // Success produced pdf file.
     }
     catch (Exception e)
     {
         //  Do something...
     }
     
    • Method Detail

      • produce

        public static void produce(InputStream inputStream,
                   int format,
                   OutputStream outputStream)

        Produce the PDF stream using specified import format.

        Parameters:
        inputStream - Input stream.
        format - Import format.
        outputStream - Output PDF stream.
        See Also:
        ImportFormat
      • produce

        public static void produce(String inputFileName,
                   int format,
                   OutputStream outputStream)
      • produce

        public static void produce(InputStream inputStream,
                   int format,
                   String outputFileName)

        Produce the PDF file using specified import format.


        This sample shows how to produce Pdf file from CGM stream.
         
         String inputFile = "myImage.cgm";
         String outputFile = "myPdf.pdf";
         using (FileInputStream inputStream = File.OpenRead(inputFile))
         using (FileOutputStream outputStream = File.Create(outputFile))
         {
             PdfProducer.produce(inputStream, ImportFormat.Cgm, outputStream);
         }
         
        Parameters:
        inputStream - Input stream.
        format - Import format.
        outputFileName - Output PDF file
        Throws:
        InvalidFileFormatException - The exception is thrown when a file is invalid.
        com.aspose.ms.System.ArgumentNullException - Input stream is null
        com.aspose.ms.System.ArgumentException - Output file name is an empty string
        See Also:
        ImportFormat
      • produce

        public static void produce(String inputFileName,
                   int format,
                   String outputFileName)

        Produce the PDF file using specified import format.


        This sample shows how to produce Pdf file from CGM file.
         
         String inputFile = "myImage.cgm";
         String outputFile = "myPdf.pdf";
         PdfProducer.produce(inputFile, ImportFormat.Cgm, outputFile);
         
        Parameters:
        inputFileName - Input file name.
        format - Import format.
        outputFileName - Output PDF file
        Throws:
        InvalidFileFormatException - The exception is thrown when a file is invalid.
        com.aspose.ms.System.ArgumentException - Input or output file name is an empty string
      • produce

        public static void produce(String inputFileName,
                   ImportOptions options,
                   String outputFileName)

        Produce the PDF file using specified import option.


        This sample shows how to produce Pdf file from CGM file.
         
         String inputFile = "myImage.cgm";
         String outputFile = "myPdf.pdf";
         ImportOptions importOptions = new CgmImportOptions();
         PdfProducer.produce(inputStream, importOptions, outputStream);
         
        Parameters:
        inputFileName - Input file name.
        options - Import option.
        outputFileName - Output PDF stream.
        Throws:
        InvalidFileFormatException - The exception is thrown when a file is invalid.
        com.aspose.ms.System.ArgumentException - Input or output file name is an empty string
      • produce

        public static void produce(InputStream inputStream,
                   ImportOptions options,
                   OutputStream outputStream)

        Produce the PDF file using specified import option.


        This sample shows how to produce Pdf stream from CGM stream.
         
         String inputFile = "myImage.cgm";
         String outputFile = "myPdf.pdf";
         ImportOptions importOptions = new CgmImportOptions();
         using (FileInputStream inputStream = File.OpenRead(inputFile))
         using (FileOutputStream outputStream = File.Create(outputFile))
         {
             PdfProducer.produce(inputStream, importOptions, outputStream);
         }
         
        Parameters:
        inputStream - Input stream.
        options - Import option.
        outputStream - Output PDF stream.
        Throws:
        InvalidFileFormatException - The exception is thrown when a file is invalid.
        com.aspose.ms.System.ArgumentNullException - Input or output stream is null.
      • produceInternal

        public static void produceInternal(com.aspose.ms.System.IO.Stream inputStream,
                           ImportOptions options,
                           com.aspose.ms.System.IO.Stream outputStream)
      • getProducer

        public static PdfProducer getProducer(ImportOptions options)

        Get the producer for specified import option.

        Parameters:
        options - Import option
        Returns:
        PDF producer.
      • getProducer

        public static PdfProducer getProducer(int format)

        Get the producer for specified import format.

        Parameters:
        format - Import option
        Returns:
        PDF producer.
      • getImportOptions

        public static ImportOptions getImportOptions(int format)

        Get the ImportOptions for specified import format.

        Parameters:
        format - Import format.
        Returns:
        Import option.