SplitXY, DocSplitXY

The SplitXY and DocSplitXY method split a document at a given xy position. For example, in a document that has a title "Chapter <number>" every few pages, we wish to split the document so that every chapter is in a separate file. If the chapter titles are always at the same position, we can call SplitXY or DocSplitXY, and give them the coordinates of a point that lies in the chapter title area.

The method will go through the document, starting from page 1, until it finds a text object at the given coordinates. After that, it will split the document every time it finds a new chapter title at those coordinates.

 

Syntax

ActiveX:

System.Boolean SplitXY(System.String OutputFile, System.Int32 xPos, System.Int32 yPos)

DLL:

int DocSplitXY(EXTDOCHANDLE edhDocument, LPCSTR prefix,long X, long Y)

 

Parameters

OutputFile, prefix

This is the base file name to be used for the ouput files. For example "split.pdf" will result in the files being named "Split1", "Split2"... "Splitn".

xPos, X

This is the X-coordinate of the point where to find the text object.

yPos, Y

This is the Y-coordinate of the point where to find the text object.

edhDocument

Handle Returned by DocOpen.

 

Return Value

The return value is True if the SplitXY method succeed. Otherwise, False If the SplitXY method fails.

The return value is zero if the DocSplitXY method succeed. If the DocSplitXY method fails, a negative value will returned.

 

Remarks

Check Split Method.

 

Member of CDIntfEx.Document.

Example

Private Sub Sample()

    ' Constants for Activation codes

    Const strLicenseTo As String = "Amyuni PDF Converter Evaluation"

    Const strActivationCode As String = "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA"

 

    ' Declare a new cdintfex document if it does not exist in the form.

    Dim pdfDoc As New CDIntfEx.Document

 

    ' The SetLicenseKey method should be called after creating an object of type 

    ' CDIntfEx.Document to activate the advanced methods that require the object 

    ' activation code to work properly

    pdfDoc.SetLicenseKey(strLicenseTo, strActivationCode)

 

    ' Open the document

    pdfDoc.Open("c:\temp\test.pdf")

 

    ' Split the Document

    pdfDoc.SplitXY("c:\temp\Page.pdf", 100, 1000)

End Sub

public void Sample()

{

    // Constants for Activation codes

    const string strLicenseTo = "Amyuni PDF Converter Evaluation";

    const string strActivationCode = "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA";

 

    // Declare a new cdintfex document if it does not exist in the form.

    CDIntfEx.Document pdfDoc = new CDIntfEx.Document();

 

    // The SetLicenseKey method should be called after creating an object of type 

    // CDIntfEx.Document to activate the advanced methods that require the object 

    // activation code to work properly

    pdfDoc.SetLicenseKey(strLicenseTo, strActivationCode);

 

    // Open the document

    pdfDoc.Open(@"c:\temp\test.pdf");

 

    // Split the Document

    pdfDoc.SplitXY(@"c:\temp\Page.pdf", 100, 1000);

}

// PDF Converter Cpp.cpp : Defines the entry point for the console application.

// 

 

#include <Windows.h>

#include <string>

#include <iostream>

#include "CdIntf.h"

#pragma comment (lib, "CDIntf.lib")

 

using namespace std;

int main()

{

     // Constants for Activation codes

    #define strLicenseTo  "Amyuni PDF Converter Evaluation"

    #define strActivationCode "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA"

 

    // Declare a new cdintfex document if it does not exist in the form.

    EXTDOCHANDLE pdfDoc;

 

    // The SetLicenseKey method should be called after creating an object of type 

    // CDIntfEx.Document to activate the advanced methods that require the object 

    // activation code to work properly

    SetLicenseKeyA(strLicenseTo, strActivationCode);

 

    // Open the document

    LPBYTE passWord = nullptr;

    DocOpenA(&pdfDoc, "C:\temp\\test.pdf", passWord);

 

    // Split the Document

    DocSplitXYA(pdfDoc, "C:\temp\\Page.pdf", 100, 1000);

 

    // Destroy pdfDoc object

    DocClose(pdfDoc);

    pdfDoc = nullptr;  

 

    return 0;

}

package Example;

 

import com.jacob.activeX.ActiveXComponent;

import com.jacob.com.Dispatch;

import com.jacob.com.Variant;

 

public class Sample {

    public static void main(String[] args)

    {

        // Constants for Activation codes

        String strLicenseTo  = "Amyuni PDF Converter Evaluation";

        String strActivationCode = "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA";

 

        // Declare a new cdintfex document if it does not exist in the form.

        ActiveXComponent pdfDoc = new ActiveXComponent("CDIntfEx.Document.6.5"); 

 

        // The SetLicenseKey method should be called after creating an object of type 

        // CDIntfEx.Document to activate the advanced methods that require the object 

        // activation code to work properly

        Dispatch.call(pdfDoc, "SetLicenseKey", strLicenseTo, strActivationCode);

 

        // Open the document

        Dispatch.call(pdfDoc, "Open", "C:\temp\\test.pdf");

 

        // Set Minimum Compression

        Dispatch.call(pdfDoc, "SplitXY", "C:\temp\\Page.pdf", 100, 1000);

 

        // Destroy pdfDoc object

        pdfDoc = null;

    }

}

# Constants for Activation codes

$strLicenseTo  =  "Amyuni PDF Converter Evaluation"

$strActivationCode = "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA"

 

#Declare a new cdintfex document if it does not exist in the form.

$pdfDoc = New-Object -ComObject CDIntfEx.Document.6.5

 

#The SetLicenseKey method should be called after creating an object of type 

#CDIntfEx.Document to activate the advanced methods that require the object 

#activation code to work properly

[System.__ComObject].InvokeMember('SetLicenseKey', [System.Reflection.BindingFlags]::InvokeMethod,$null,$pdfDoc, @($strLicenseTo, $strActivationCode))

 

#Open the document

[System.__ComObject].InvokeMember('Open', [System.Reflection.BindingFlags]::InvokeMethod,$null,$pdfDoc,"c:\temp\test.pdf") 

 

#Split the Document

[System.__ComObject].InvokeMember('SplitXY', [System.Reflection.BindingFlags]::InvokeMethod,$null,$pdfDoc,@("c:\temp\Page.pdf", 100, 1000)) 

 

#Destroy pdfDoc object

$pdfDoc = $null 

' Constants for Activation codes

Const strLicenseTo = "Amyuni PDF Converter Evaluation"

Const strActivationCode = "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA"

 

' Declare a new Document object

Dim pdfDoc

Set pdfDoc = CreateObject("CDIntfEx.Document.6.5")

 

' The SetLicenseKey method should be called after creating an object of type 

' CDIntfEx.Document to activate the advanced methods that require the object 

' activation code to work properly

pdfDoc.SetLicenseKey strLicenseTo, strActivationCode

 

' Open the document

pdfDoc.Open "c:\temp\test.pdf"

 

' Split the Document

pdfDoc.SplitXY "c:\temp\Page.pdf", 100, 1000

 

' Destroy pdfDoc object

Set pdfDoc = Nothing