SplitXY Method

This method splits an existing document into ā€™nā€™ documents. A new document is started when new content is detected at the given location on the page.

For example, the input document is the output from mailmerge application containing marketing letter to be sent to my customers. The call to SplitXY can specify the location of the customer name.

The location must be specified in Twips relative to the page coordinates. The object present at that location must be a text object.




Sub SplitXY(OutputFile As String, xPos As Integer, yPos As Integer)


void SplitXY(int OutputFile, int xPos, int yPos)


HRESULT SplitXY(BSTR OutputFile, [in ]long xPos, long yPos)




The base for the output file name.


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


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



Sub Sample()
    ' Constants for Activation codes
    Const strLicenseTo As String = "Amyuni PDF Creator Evaluation"
    Const strActivationCode As String = "07EFCDAB010001004282943FAAF19A88F332D9E781E40460727D78A42847A1BDE06DB61C71E94E2D90424BF8762385335F9D6884E9FC"
    ' Initializing PDFCreativeX Object
    ' Set license key
    pdf.SetLicenseKey(strLicenseTo, strActivationCode)
    ' Open an existent PDF file
    Dim fileName As String = "c:\temp\PDFdocument.pdf"
    Dim password As String = ""
    pdf.Open(fileName, password)    
    ' Split the PDF file
    Dim xPos As Integer = 1000
    Dim yPos As Integer = 3000
    Dim outputFile As String = "c:\temp\separatePages.pdf"
    pdf.SplitXY(outputFile, xPos, yPos)
    ' Save PDF
    pdf.Save("c:\temp\CreatePDFDocument_resulting.pdf", ACPDFCREACTIVEX.FileSaveOptionConstants.acFileSaveView)
    ' destroy objects
    pdf = Nothing
End Sub
static void Sample()
    // Constants for Activation codes
    const string strLicenseTo = "Amyuni PDF Creator Evaluation";
    const string strActivationCode = "07EFCDAB010001004282943FAAF19A88F332D9E781E40460727D78A42847A1BDE06DB61C71E94E2D90424BF8762385335F9D6884E9FC";
    // Initializing PDFCreativeX Object
    // Set license key
    pdf.SetLicenseKey(strLicenseTo, strActivationCode);
    // Open an existent PDF file
    string fileName = @"c:\temp\PDFdocument.pdf";
    string password = "";
    pdf.Open(fileName, password);
    // Split the PDF file
    int xPos = 1000;
    int yPos = 3000;
    string outputFile = @"c:\temp\separatePages.pdf";
    pdf.SplitXY(outputFile, xPos, yPos);
    // Save PDF
    pdf.Save(@"c:\temp\CreatePDFDocument_resulting.pdf", ACPDFCREACTIVEX.FileSaveOptionConstants.acFileSaveView);
    // destroy objects
    pdf = null;
#include <iostream>
#import "c:\users\amyuni\pdfcreactivex.dll" no_namespace
using namespace std;
int main()
    // Constants for Activation codes
    bstr_t strLicenseTo = "Amyuni PDF Creator Evaluation";
    bstr_t strActivationCode = "07EFCDAB010001004282943FAAF19A88F332D9E781E40460727D78A42847A1BDE06DB61C71E94E2D90424BF8762385335F9D6884E9FC";
    // Initialize the COM subsystem
    // IPDFCreactiveXPtr is a smart pointer type defined in pdfcreactivex.tlh,
    // the type library header file generated by the #import instruction above
    IPDFCreactiveXPtr pdf;
    // Create the PDFCreactiveX instance
    // set license key
    pdf->SetLicenseKey(_bstr_t(strLicenseTo), _bstr_t(strActivationCode));
    // Open an existent PDF file
    bstr_t fileName = "c:\\temp\\PDFdocument.pdf";
    bstr_t password = "";
    pdf->Open(fileName, password);
    // Split the PDF file
    int xPos = 1000;
    int yPos = 3000;
    bstr_t outputFile = "c:\\temp\\separatePages.pdf";
    pdf->SplitXY(outputFile, xPos, yPos);
    // Save PDF
    pdf->Save("c:\\temp\\CreatePDFDocument_resulting.pdf", acFileSaveView);
    // destroy objects
    pdf = NULL;
    return 0;
' FileSaveOptionConstants
Const acFileSaveAll = 0
Const acFileSaveDefault = -1
Const acFileSaveView = 1
Const acFileSaveDesign = 2
Const acFileSavePDFA_7 = 3
Const acFileSavePDFA = 4
Const acFileSavePDF14 = 5
' Constants for Activation codes
Const strLicenseTo = "Amyuni PDF Creator Evaluation"
Const strActivationCode = "07EFCDAB010001004282943FAAF19A88F332D9E781E40460727D78A42847A1BDE06DB61C71E94E2D90424BF8762385335F9D6884E9FC"
' Initializing PDFCreativeX Object
Dim pdf
Set pdf = CreateObject("PDFCreactiveX.PDFCreactiveX.6.0")
' Set license key
pdf.SetLicenseKey strLicenseTo, strActivationCode
' Open an existent PDF file
Dim fileName
fileName = "c:\temp\PDFdocument.pdf"
Dim password
password = ""
pdf.Open fileName, password
' Split the PDF file
Dim xPos
xPos  = 1000
Dim yPos
yPos = 3000
Dim outputFile
outputFile = "c:\temp\separatePages.pdf"
pdf.SplitXY outputFile, xPos, yPos
' Save PDF using StartSave, SavePage and EndSave
pdf.Save "c:\temp\CreatePDFDocument_resulting.pdf", acFileSaveView
' destroy Objects
Set pdf = Nothing