combit List & Label 29 - .NET Help
combit.Reporting Namespace / PreviewFile Class / ConvertTo Method / ConvertTo(String,String) Method
Name of the target file. It is also possible to use the placeholder "%d" (e.g. "page %d"). This is important e.g. for converting JPEGs, because without the placeholder only one page will result.

Target format. Valid values are:

This parameter allows you to declare a semicolon-separated list with further export options. You will find the accepted values in the chapter for the export modules in the Programmer's Manual. Please note that not all options can be supported with this API. An example is the parameter "PDF;PDF.EncryptionFile=1".


Additional to the mentioned parameters above the following parameters can be used:

Value Meaning
PageIndexRange Analog to the print options dialog a range for pages can be set.
JobIndexRange Analog to the print options dialog a range for the job can be set.
IssueIndexRange Analog to the print options dialog a range for the issues can be set.

 



In This Topic
    ConvertTo(String,String) Method
    In This Topic
    Converts the preview file into the given filename.  Allows to specify the format and additional options.
    Syntax
    'Declaration
     
    
    Public Overloads Sub ConvertTo( _
       ByVal filename As String, _
       ByVal targetFormat As String _
    ) 
    public void ConvertTo( 
       string filename,
       string targetFormat
    )
    public:
    void ConvertTo( 
       String^ filename,
       String^ targetFormat
    ) 

    Parameters

    filename
    Name of the target file. It is also possible to use the placeholder "%d" (e.g. "page %d"). This is important e.g. for converting JPEGs, because without the placeholder only one page will result.
    targetFormat

    Target format. Valid values are:

    • "TIFF" (also "PICTURE_MULTITIFF")
    • "JPEG" (also "PICTURE_JPEG")
    • "PNG" (also "PICTURE_PNG")
    • "EMF"
    • "TTY"
    • "PDF"
    • "PRN"
    • "XPS"
    • "TXT"  

    This parameter allows you to declare a semicolon-separated list with further export options. You will find the accepted values in the chapter for the export modules in the Programmer's Manual. Please note that not all options can be supported with this API. An example is the parameter "PDF;PDF.EncryptionFile=1".


    Additional to the mentioned parameters above the following parameters can be used:

    Value Meaning
    PageIndexRange Analog to the print options dialog a range for pages can be set.
    JobIndexRange Analog to the print options dialog a range for the job can be set.
    IssueIndexRange Analog to the print options dialog a range for the issues can be set.

     

    Example

    An example of this is the use of "PDF;Export.PageIndexRange=2-3" and"PDF.FontMode=1". With this, only pages 2 and 3 are converted to PDF. Furthermore all TrueType-Fonts are embedded into the PDF.

    // Open existing preview file
    PreviewFile previewFile = new PreviewFile(@"C:\preview.ll");
    
    // Convert the preview file into PDF with the following options:
    // - only pages 2-3
    // - embed TrueType-Fonts
    previewFile.ConvertTo(@"C:\preview.pdf","PDF;Export.PageIndexRange=2-3;PDF.FontMode=1");
    
    // Close and free preview file
    previewFile.Close();
    previewFile.Dispose();
    
    ' Open existing preview file
    Dim previewFile As New PreviewFile("C:\preview.ll")
    
    ' Convert the preview file into PDF with the following options:
    ' - only pages 2-3
    ' - embed TrueType-Fonts
    previewFile.ConvertTo("C:\preview.pdf", "PDF;Export.PageIndexRange=2-3;PDF.FontMode=1")
    
    ' Close and free preview file
    previewFile.Close()
    previewFile.Dispose()
    

     

    Requirements

    Platforms: Windows 10 (Version 21H2 - 23H2), Windows 11 (21H2 - 22H2), Windows Server 2016 - 2022
    .NET: .NET Framework 4.8, .NET 6, .NET 7, .NET 8

    See Also