Software Companions - PDF, DWF, PLT and TIFF Viewing and Conversion Software

scConverter DLL
Frequently Asked Questions


Converter from Software Companions

How can I use scConverter in C#?


How can I use the converter in Visual Studio C#?

You can easily add scConverter to your own C#.Net application by following the steps found in the online scConverter C# tutorial.


How can I use scConverter in C++


How do I use the exported functions in a C++ application (not using COM)?


Here is a code sample demonstrating how to use the exported DLL functions in C++:

#define SC_PDF 0 //Create a normal editable file using 1.7 standard.
#define SC_PDF_A 2 //Create a PDF/A-2B write protected file for archiving.
//scConverter.dll exported functions
typedef int ( *SC_SET_PDFSTANDARD)( long Format );
typedef int ( *SC_SET_PDFLARGEFORMAT)( long Enable );
typedef int ( *SC_SET_PDFLAYERS)( long Enable );
typedef int ( *SC_SET_TIFFSINGLESTRIP)( long Enable );
typedef int ( *SC_SET_IMPORTERPATH)( WCHAR *Path);
typedef int ( *SC_CONVERT_FILE)( WCHAR *pSerialNumber, WCHAR *pInputFile, WCHAR *pOutputFile,
WCHAR *pFormat, double dScale, long lBitsPerPixel, long lDPI );

int ConvertFile( WCHAR *InputFile, WCHAR *OutputFile, WCHAR Format, long BitsPerPixel, long DPI)
{
   int result = 0;
   HINSTANCE hLib = LoadLibraryExW( L"scConverter.dll", NULL, LOAD_WITH_ALTERED_SEARCH_PATH );
   if (!hLib) return -1;
   //Get function pointers
   SC_CONVERT_FILE ConvertFileFunc = (SC_CONVERT_FILE)GetProcAddress( hLib, "scConvertFile" );
   SC_SET_PDFSTANDARD SetPDFStandardFunc = (SC_SET_PDFSTANDARD)GetProcAddress( hLib, "scSetPDFWriteFormat" );
   SC_SET_PDFLARGEFORMAT SetPDFLargeFormatFunc = (SC_SET_PDFLARGEFORMAT)GetProcAddress( hLib, "scSetPDFLargeFormat" );
   SC_SET_PDFLAYERS SetPDFLayersFunc = (SC_SET_PDFLAYERS)GetProcAddress( hLib, "scSetPDFLayers" );
   SC_SET_TIFFSINGLESTRIP SetTIFFSingleStripFunc= (SC_SET_TIFFSINGLESTRIP)GetProcAddress( hLib, "scSetTIFFSingleStrip" );
   SC_SET_IMPORTERPATH SetImporterPathFunc = (SC_SET_IMPORTERPATH)GetProcAddress( hLib, "scImportersPath" );
   //Setup and do the conversion
   SetPDFStandardFunc( SC_PDF_A );
   SetPDFLayersFunc( 1 );
   SetTIFFSingleStripFunc( 1 );
   SetPDFLargeFormatFunc( 1 );
   //Replace first paremeter _T("") with your serial number
   result = ConvertFileFunc( _T(""), InputFile, OutputFile, Format, 1.0, BitsPerPixel, DPI );
   FreeLibrary( hLib );
   return result;
}
Sample usage of this function:
//create PDF
ConvertFile( L"c:\\temp\\test.plt", L"c:\\temp\test.pdf", L"PDF", 1.0, 0, 0 );
//create monochrome TIFF, 300 dots per inch
ConvertFile( L"c:\\temp\\test.plt", L"c:\\temp\test.tif", L"TIFF", 1.0, 1, 300 );
//create true color TIFF, 200 dots per inch
ConvertFile( L"c:\\temp\\test.plt", L"c:\\temp\test.tif") L"TIFF", 1.0, 24, 200 );


How do I use the COM interface without using MFC or ATL in a C++ application?


Below you will find a code sample on how to create an instance of the component and then use it (no MFC/ATL):
int ConvertFile( WCHAR *InputFile, WCHAR *OutputFile, WCHAR *pFormat, double Scale, long BitsPerPixel, long DPI )
{
int nRetCode = 0;
if (SUCCEEDED(::CoInitialize(nullptr)))
{
   IConverter *pIConverter = nullptr;
   HRESULT hr = CoCreateInstance(CLSID_Converter, NULL, CLSCTX_ALL, IID_IConverter, (void **) &pIConverter);
   if (pIConverter)
   {
      pIConverter->raw_SetSerialNumber( _T("") ); //Use your serial number here
      pIConverter->put_PDFWriteFormat(0); //Editable PDF 1.7, set to 2 for PDF/A-2B
      pIConverter->put_PDFLayers(1); //Enable PDF layers
      pIConverter->put_PDFWriteFormat(1); //Enable large format PDF - allows maximum 60x60 meter extents
      pIConverter->put_TIFFSingleStrip(1); //Create single strip TIFF files (usually gives smaller file size).
      hr = pIConverter->raw_Convert( InputFile, //input filename,
         OutputFile, //output filename,
         Format, //format e.g.: PDF, TIFF, DWF etc,
         Scale, //Scaling
         BitsPerPixel, //Bits per pixel, e.g.: 1 = monochrome, 24 = true color
         DPI ); //Dots per inch (resolution), e.g. 200, 300, 600 etc.
      if (hr != S_OK )
      {
         //Conversion failed - get error code
         long errorcode = 0;
         pIConverter->get_LastError(&errorcode);
         nRetCode = errorcode;
      }
      pIConverter->Release(); //Release pointer to interface now
      pIConverter = nullptr;
   }
   else
   {
      nRetCode = (int)hr; //scConverter.dll is not installed on this computer, or other COM problem, return hr
   }
   ::CoUninitialize();
}
return nRetCode;
}


Converting files with scConverter


How can I convert a file to PDF and at the same time add annotations (e.g., stamp or watermark)?

You can add annotations like text, stamps, watermark and much more by using the Software Companions markup XML format.
Read more about how to add annotations during conversion here.


How can I convert, or conform, an existing PDF file into PDF/A compliance using scConverter?

You can easily convert, or conform, your existing PDF files into PDF/A by using the PDFConform method.
Below is a small C# sample that uses scConverter to convert an input file into a PDF/A-3B compliant output file:
namespace TestConform
{
   internal class Program
   {
      static void Main(string[] args)
      {
         scConverterLib.Converter myconverter = new scConverterLib.Converter();
         if (myconverter != null)
         {
            string errors = "";
            myconverter.SetSerialNumber("serial number");
            myconverter.PDFConform(args[0], tagSCPDFCONFORM.SC_PDF_PDFA3B, args[1], ref errors );
            //Check for errors
            if (errors != null)
            {
               System.Console.WriteLine("PDF conformance failed due to the following error(s):");
               System.Console.WriteLine(errors);
            }            
         }
      }
   }
}  
This sample code is from the SDK scConform example project.
The following PDF/A output formats are supported by the PDFConform method:
  • PDF/A-1b
  • PDF/A-2b
  • PDF/A-3b
  • PDF/A-2u
  • PDF/A-3u
  • PDF/A-4
  • PDF/A-4e

How can I create a searchable PDF from a scanned image using scConverter?

If you install the Tesseract OCR engine on the same computer as scConverter, you can use scConverter to create searchable PDF files from scanned images. Tesseract is completely free software and can be downloaded using the following link: Tesseract at UB Mannheim.
The scConverter method you use to create searchable PDF files is named CreateSearchablePDF.
You can also find more information about Tesseract here.


How can I create an editable CAD file from a PDF using scConverter?

The ScConverter can be used to convert a PDF file into an editable CAD file, for example a DXF file. The quality of the conversion will be much higher if the PDF file was originally created by a CAD application.
Please note that PDF files that contains only image data, for example scanned drawings, cannot be converted to a CAD file by scConverter. Read more about PDF to CAD conversion in the online documentation, look for the method named PDFToCAD.


Merging PDF files with scConverter


How can I merge or combine several PDF files into a single multipage PDF file with scConverter?

With scConverter you easily merge or combine multiple PDF files into a single file.
Merging PDFs with scConverter preserves the integrity of your documents, ensuring that the original formatting, fonts, and images remain intact.
Read more about merging PDF files with scConverter.


QR detection using scConverter

QR Detection


How can I detect QR codes and extract the decoded text?

By using the method named DetectQREx, you can search for QR codes in most file formats, including PDF.
If DetectQREx returns a number higher than zero, you can use the GetQRTextEx method to obtain the decoded text for each found QR code. Below you will find a complete C# command line application that decodes all QR codes found in the input file and outputs the text to the console.

C# Sample code:

namespace TestConverter
{
   internal class Program
   {
      static void Main(string[] args)
      {
         scConverterLib.Converter myconverter = new scConverterLib.Converter();
         if (myconverter != null)
         {
            int fileHandle = 0, qrCount = 0;
            myconverter.SetSerialNumber("serial number");
            myconverter.OpenFileEx(args[0], ref fileHandle);    //File to open
            myconverter.DetectQREx(fileHandle, -1, ref qrCount);
            if (qrCount > 0) 
            {
               //We found at least one QR code, output decoded text to console
               for (int i = 0;i < qrCount; i++)
               {
                  string qrText = "";
                  myconverter.GetQRTextEx(fileHandle, i, ref qrText);
                  Console.WriteLine(qrText);
               }
            }
            else 
            {
               System.Console.WriteLine("No QR codes found.");
            }            
         }
      }
   }
}
This sample code is from the SDK scExtractQR example project.
A VB.NET example is available here: scExtractVB.