Partners Contact US Site Map Blog
A professional PDF Converter, PDF Writer, PDF Creator, PDF Editor, HTML Converter, Postscript Converter, AutoCAD DWG Converter, as well as PCL Converter, etc.  

PDF to XML Converter SDK Examples

Download and purchase PDF to XML Converter SDK.
 
PDF to XML Converter SDK Functions:
/////////////////////////////////////
//Function:
// void VeryPDF2XMLSetLicenseCode(const char *lpCode);
//
//Description:
// Register PDF2XML SDK Library.
//
//Parameters:
// "lpCode" parameter is the license key which issued to you by VeryDOC company.
/////////////////////////////////////
__declspec(dllexport)
void VeryPDF2XMLSetLicenseCode(const char *lpCode);


/////////////////////////////////////
//Function:
// BOOL WINAPI VeryPDF2XMLConverter(LPCTSTR lpInPDF, LPCTSTR lpOutXML,
//             LPCTSTR lpOptions);
//
//Description:
// VeryPDF2XMLConverter() function can convert from PDF files to XML files.
//
//Parameters:
// "lpOptions" parameter can be used to set additional options to PDF to XML
//  Converter, you can set following options,
// -password: set password for decryption, e.g., -password "123456"
// -res : set resolution in dpi, e.g., -res 300
// -bitcount: set bitcount to output image file
// -outimg : generate output image file, e.g., -outimg "C:\\out.png", "-outimg"
//  does support following image formats,
// BMP, JPG, JPEG, GIF, PNG, MNG, JNG, ICO, TIF, TIFF, TGA, PCX, J2K, JP2,
// JPC, J2C, PNM, PGM, PPM, PBM
// -txt : output to utf-8 text file, e.g., -txt
// -xml : output to xml file, this is default format, e.g., -xml,
// -page : page range, e.g., -page "1-3,5,9-"
//
//Return value:
// 1 is successful and 0 is indicate something is wrong during conversion.
/////////////////////////////////////
__declspec(dllexport)
BOOL WINAPI VeryPDF2XMLConverter(LPCTSTR lpInPDF, LPCTSTR lpOutXML, LPCTSTR lpOptions);
 
C/C++ Example:
void GetModulePath(char *out_path,char *in_name)
{
  char *p;
  GetModuleFileName(NULL,out_path,256);
  p =strrchr(out_path,'\\');
  p[1]=0;
  strcat(out_path,in_name);
}
void main(int argc, char **argv)
{
  if(argc < 3)
  {
    printf("%s C:\\in.pdf C:\\out.xml\n", argv[0]);
    return;
  }
  char *lpInPDFFile = argv[1];
  char *lpOutXMLFile = argv[2];
  char *lpLicenseKey = "XXXXXXXXXXXXXXXXXXXXXXX";
  VeryPDF2XMLSetLicenseCode(lpLicenseKey);

  BOOL bRet = FALSE;
  char szImgFile[MAX_PATH];
  GetModulePath(szImgFile, "outimage-%04d.png");
  char szOptions[1024];
  sprintf(szOptions, "-res 150 -bitcount 24 -outimg \"%s\"", szImgFile);
  bRet = VeryPDF2XMLConverter(lpInPDFFile, lpOutXMLFile, szOptions);

  char szTxtFile[MAX_PATH];
  GetModulePath(szTxtFile, "outtxt.txt");
  bRet = VeryPDF2XMLConverter(lpInPDFFile, szTxtFile, "-txt");

  bRet = VeryPDF2XMLConverter(lpInPDFFile, lpOutXMLFile, "");
  printf("VeryPDF2XMLConverter, Return value: %d\n", bRet);
}
 
VB Example:
Private Declare Sub VeryPDF2XMLSetLicenseCode Lib "pdf2xmlsdk.dll" (ByVal lpCode As String)
Private Declare Function VeryPDF2XMLConverter Lib "pdf2xmlsdk.dll" (ByVal lpInPDF As String, ByVal lpOutXML As String, ByVal lpOptions As String) As Long

Private Sub pdf2xml_Click()
  Dim nRet As Long
  Dim strCmd As String
  Dim strPDFFile As String
  Dim strXMLFile As String
  Dim strTXTFile As String
  Dim strOptions As String

  VeryPDF2XMLSetLicenseCode ("XXXXXXXXXXXXXXXXX")
  strPDFFile = App.Path & "\sample.pdf"
  strXMLFile = App.Path & "\sample.xml"
  strTXTFile = App.Path & "\sample.txt"
  strOptions = "-res 150 -bitcount 24 -outimg """ & App.Path & "\outimage-%04d.png" & """"

  'Convert PDF file to image file
  nRet = VeryPDF2XMLConverter(strPDFFile, strXMLFile, strOptions)
  'Convert PDF file to text file
  nRet = VeryPDF2XMLConverter(strPDFFile, strTXTFile, "-txt")
  'Convert PDF file to XML file
  nRet = VeryPDF2XMLConverter(strPDFFile, strXMLFile, "")

  MsgBox (str(nRet))
End Sub
 
C# Example:
namespace WindowsFormsApplication1
{
  public partial class Form1 : Form
  {
    public Form1()
    {
      InitializeComponent();
    }

    [DllImport(@"pdf2xmlsdk.dll", CharSet = CharSet.Ansi)]
    static extern long VeryPDF2XMLSetLicenseCode(string lpRegcode);

    [DllImport(@"pdf2xmlsdk.dll", CharSet = CharSet.Ansi)]
    static extern uint VeryPDF2XMLConverter(
    [MarshalAs(UnmanagedType.LPStr)]string lpInPDF,
    [MarshalAs(UnmanagedType.LPStr)]string lpOutXML, string lpOptions);

    private void button1_Click(object sender, EventArgs e)
    {
      string appPath = Path.GetDirectoryName(Application.ExecutablePath);
      string strInPDFFile;
      string strOutFile;
      long nRet;
      strInPDFFile = (appPath + "\\sample.pdf");
      strOutFile = (appPath + "\\sample.xml");

      VeryPDF2XMLSetLicenseCode("XXXXXXXXXXXXXXXXXXX");

      //Create image file
      string szOptions = "-res 150 -bitcount 24 -outimg \"";
      szOptions += appPath + "\\outimage-%04d.png";
      szOptions += "\"";
      nRet = VeryPDF2XMLConverter(strInPDFFile, strOutFile, szOptions);

      //Create text file
      nRet = VeryPDF2XMLConverter(strInPDFFile, appPath + "\\outtxt.txt", "-txt");

      //Create XML file
      nRet = VeryPDF2XMLConverter(strInPDFFile, strOutFile, "");
    }
  }
}
 
VB.NET Example:
Public Class Form1

  <DllImport("pdf2xmlsdk.dll", CharSet:=CharSet.Ansi)> _
  Private Shared Function VeryPDF2XMLSetLicenseCode(ByVal lpRegcode As String) As Long
  End Function

  <DllImport("pdf2xmlsdk.dll", CharSet:=CharSet.Ansi)> _
  Private Shared Function VeryPDF2XMLConverter(<MarshalAs(UnmanagedType.LPStr)>
  ByVal lpInPDF As String, <MarshalAs(UnmanagedType.LPStr)> ByVal lpOutXML As String,
  ByVal lpOptions As String) As UInteger
  End Function

  Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim appPath As String = Path.GetDirectoryName(Application.ExecutablePath)
    Dim strInPDFFile As String
    Dim strXMLFile As String
    Dim strTXTFile As String
    Dim nRet As Long
    strInPDFFile = (appPath & "\sample.pdf")
    strXMLFile = (appPath & "\sample.xml")
    strTXTFile = (appPath & "\sample.txt")

    VeryPDF2XMLSetLicenseCode("XXXXXXXXXXXXXXXXXXX")

    'Convert PDF file to image file
    Dim szOptions As String = "-res 150 -bitcount 24 -outimg """
    szOptions += appPath + "\outimage-%04d.png"
    szOptions += """"
    nRet = VeryPDF2XMLConverter(strInPDFFile, strXMLFile, szOptions)

    'Convert PDF file to text file
    nRet = VeryPDF2XMLConverter(strInPDFFile, strTXTFile, "-txt")

    'Convert PDF file to XML file
    nRet = VeryPDF2XMLConverter(strInPDFFile, strXMLFile, "")
  End Sub
End Class
 
Download and purchase PDF to XML Converter SDK.
 
Correlative Links:
PDF Parser SDK: PDF Parser SDK is a PDF analyzer, it can convert PDF to HTML and Image files.
PDF to Image Converter SDK: Render PDF pages to image files.
PDFEditor OCX: View and Edit PDF files.
PDFPrint: Print PDF files to Windows Printer without depend on Adobe Reader.
PDF to HTML Converter: Convert PDF files to HTML documents.
PDF to Text Converter: Convert PDF files to plain text files.
PDF to Vector Converter: Convert PDF files to PS, EPS, WMF, EMF, XPS, PCL, HPGL, SWF, SVG, etc. vector files.
PDF to Image Converter: Convert PDF files to TIF, TIFF, JPG, GIF, PNG, BMP, EMF, PCX, TGA formats.
DocConverter COM Component (+HTML2PDF.exe): Convert HTML, DOC, RTF, XLS, PPT, TXT etc. files to PDF files, it is depend on PDFcamp Printer product.
Image to PDF Converter: Convert 40+ image formats to PDF files.
HTML Converter: Convert HTML files to TIF, TIFF, JPG, JPEG, GIF, PNG, BMP, PCX, TGA, JP2 (JPEG2000), PNM, etc. formats.
PDF to Word Converter: Convert PDF files to MS Word documents.
More PDF Products
 
See Also:
PDF to Image Converter :: PDF Extract TIFF :: HTML Converter :: PDFcamp Printer :: DocConverter COM :: PDF to Word Converter :: PDF to Text Converter :: Image to PDF Converter :: Image to PDF OCR :: PDF to HTML Converter :: AutoCAD DWG and DXF to PDF Converter :: PCL to PDF Converter :: Document Printer (docPrint) :: VeryPDF PDF Editor :: PDF Password Remover :: Encrypt PDF :: PDF Split-Merge :: PDF Stamper :: VeryPDF PDFPrint :: Advanced PDF Tools :: PDF Editor Toolkit :: Text to PDF Converter :: PowerPoint to Flash :: PowerPoint Converter


Home | Site Map | VeryPDF.com | VeryPCL.com | Contact | Blog

Copyright © 2002- VeryDOC.com Company. All Rights Reserved.