Document Studio Delphi
Next-generation multi-format document-processing component suite for Delphi/C++Builder developers
Compatibility
VCL - FireMonkey - Delphi - C++Builder

XtremeDocumentStudio Delphi - Document Conversion

Learn to use XtremeDocumentStudio Delphi’s DocumentConverter.

The DocumentConverter component included in XtremeDocumentStudio is a powerful component to convert your documents from one file format to another. It provides easy to use APIs to convert documents in your applications. It also provides extensive options for customizing the output being generated based on input and output format specific features.

Input formats: PDF, DOCX, DOC, GIF, BMP, JPG, ICO, PNG, EMF, WMF, Single Page Tiff, Multi Page Tiff.

Output formats: PDF, RTF, TXT, BMP, JPG, PNG, EMF, WMF, Single Page Tiff, Multi Page Tiff.

Simply add a TgtDocumentConverter component to your application to include document conversion capability.

Below code snippets show how you can convert documents from one file format to another.

Scenario 1: Converting DOCX to PDF

procedure TForm1.Button1Click(Sender: TObject);
begin
  if OpenDialog1.Execute then
  begin
    gtDocumentConverter1.ConvertToFile(OpenDialog1.FileName, // input file
      '.pdf', // format
      '', // use current directory for output files
      '', // use input filename for output filename prefix
      '', // convert all pages
      nil);// Encoder parameter to nil
    ShowMessage('Conversion completed');
  end;
end;

Scenario 2: Converting images to searchable PDF document with OCR.

Copy all files from <Gnostice XtremeDocumentStudio Install Folder>\Redist\OCR-dist to your project output directory.

procedure TForm1.Button3Click(Sender: TObject);
var
  InputList: TStringList;
begin
  InputList := TStringList.Create;
  try
    InputList.Add('1.png');
    InputList.Add('2.jpeg');
    // Set digitize to True to make PDF searchable
    gtDocumentConverter1.Preferences.Digitize := True;
    gtDocumentConverter1.ConvertToFile(InputList, // input file
      '.pdf', // format
      'D:\Converted', // use D:\Converted Directory to output file
      'Converted', // Output file name is Converted
      True, //Set merge input files to generate one output file
      nil // Encoder parameter to nil
      );
    ShowMessage('Conversion completed');
  finally
    InputList.Free;
  end;
end;

Scenario 3: Converting multiple images to single PDF document.

procedure TForm1.Button2Click(Sender: TObject);
var
  InputList: TStringList;
begin
  InputList := TStringList.Create;
  try
    InputList.Add('1.bmp');
    InputList.Add('2.png');
    InputList.Add('3.jpg');
    InputList.Add('4.emf');
    InputList.Add('5.wmf');
    InputList.Add('6.tif');
    InputList.Add('7.tiff');
    gtDocumentConverter1.ConvertToFile(InputList, // input file
      '.pdf', // format
      'D:\Converted', // use D:\Converted Directory to output file
      'Converted', // Output file name is Converted
      True, // Set merge input files to generate one output file
      nil // Encoder parameter to nil
      );
    ShowMessage('Conversion completed');
  finally
    InputList.Free;
  end;
end;

Scenario 4: Converting multiple files to single multipage TIFF file.

procedure TForm1.Button4Click(Sender: TObject);
var
  TiffEncoderParams: TgtTIFFEncoderParams;
  InputList: TStringList;
begin
  InputList := TStringList.Create;
  try
    InputList.Add('new 1.bmp');
    InputList.Add('new 2.png');
    InputList.Add('new 3.jpg');
    InputList.Add('new 4.pdf');
    InputList.Add('new 5.doc');
    InputList.Add('new 6.docx');
    InputList.Add('new 7.txt');

    TiffEncoderParams := TgtTIFFEncoderParams.Create;
    TiffEncoderParams.MultiPageTIFF := True;

    gtDocumentConverter1.ConvertToFile(InputList, // input files
      '.tiff', // format
      '', // use current directory for output files
      'output', // output file name output.tiff
      True,  // Set merge input files to generate one output file
      TiffEncoderParams);
    ShowMessage('Conversion completed');
  finally
    InputList.Free;
    TiffEncoderParams.Free;
  end;
end;

Scenario 5: Converting PDF to Text file.

procedure TForm1.Button5Click(Sender: TObject);
begin
  if OpenDialog1.Execute then
  begin
    gtDocumentConverter1.ConvertToFile(OpenDialog1.FileName, // input file
      '.txt', // format
      '', // use current directory for output files
      '', // use input filename for output file prefix
      '', // convert all pages
      nil);// Encoder parameter to nil
    ShowMessage('Conversion completed');
  end;
end;

Scenario 6: Converting Docx to image.

procedure TForm1.Button6Click(Sender: TObject);
begin
  if OpenDialog1.Execute then
  begin
    gtDocumentConverter1.ConvertToFile(OpenDialog1.FileName, // input file
      '.bmp', // format
      '', // use current directory for output files
      '', // use input filename for output file prefix
      '', // convert all pages
      nil);// Encoder parameter to nil
    ShowMessage('Conversion completed');
  end;
end;

XtremeDocumentStudio Delphi contains a ready-to-use application in the form of a demo. You can find this under “<XtremeDocumentStudio Delphi install folder>\Demos\Delphi\VCL\4. Document Converter” once you install the registered/trial versions. Please download and explore XtremeDocumentStudio Delphi.

---o0O0o---

Our .NET Developer Tools
Gnostice Document Studio .NET

Multi-format document-processing component suite for .NET developers.

PDFOne .NET

A .NET PDF component suite to create, edit, view, print, reorganize, encrypt, annotate, and bookmark PDF documents in .NET applications.

Our Delphi/C++Builder developer tools
Gnostice Document Studio Delphi

Multi-format document-processing component suite for Delphi/C++Builder developers, covering both VCL and FireMonkey platforms.

eDocEngine VCL

A Delphi/C++Builder component suite for creating documents in over 20 formats and also export reports from popular Delphi reporting tools.

PDFtoolkit VCL

A Delphi/C++Builder component suite to edit, enhance, view, print, merge, split, encrypt, annotate, and bookmark PDF documents.

Our Java developer tools
Gnostice Document Studio Java

Multi-format document-processing component suite for Java developers.

PDFOne (for Java)

A Java PDF component suite to create, edit, view, print, reorganize, encrypt, annotate, bookmark PDF documents in Java applications.

Our Platform-Agnostic Cloud and On-Premises APIs
StarDocs

Cloud-hosted and On-Premises REST-based document-processing and document-viewing APIs

Privacy | Legal | Feedback | Newsletter | Blog | Resellers © 2002-2024 Gnostice Information Technologies Private Limited. All rights reserved.