Gnostice 


Smart needs... Smarter solutions...
 
OEM Options

To send us your requirements, click here.

Home > Products > Software Developers > PDFtoolkit ActiveX/.NET > FAQs
 
      PDFtoolkit ActiveX/.NET - Merge, Split, Overlay, Stamp, View, Print PDF documents
 
General

What is Gnostice PDFtoolkit?
Why do I need Gnostice PDFtoolkit?
Can I edit PDF documents using PDFtoolkit?
Who can use PDFtoolkit?
What are the minimum requirements for using PDFtoolkit?
Can I try PDFtoolkit before I buy?
What are the limitations of the trial edition?
Does Gnostice PDFtoolkit require Adobe® Acrobat™ to work?
Do I need to supply any additional files with my application for PDFtoolkit to work?
How do I buy Gnostice PDFtoolkit? 
Can I create PDF documents from scratch using PDFtoolkit?
Can I manage encrypted PDF documents using PDFtoolkit?
What versions of PDF documents does PDFtoolkit support?

Technical

How do I Merge multiple PDF documents?
How do I Insert pages from one PDF document to another and specify where to insert the pages?
How do I Extract pages from an existing PDF document and create a new one?
How do I insert a Marking (Watermark/rubber Stamp) on every page of my PDF document?
Can I insert multiple or Composite Watermarks to my PDF document?
How do I insert a bitmap as Watermark?
How do I Set Values to form fields on a PDF form (Acroform) and permanently save the values?
How do I Extract Field Values from a filled PDF form?
How do I Extract Field Names from a PDF form?
How do I set my own Thumbnail for a specific page in the PDF document?
How do I Email a document after saving?
How do I insert a Bookmark or Outline item to my PDF document?
How do I load an existing bookmark into a TreeView Control?

General

What is Gnostice PDFtoolkit?
Gnostice PDFtoolkit ActiveX/.NET is a powerful PDF management component set for Microsoft Visual Studio, Microsoft Visual Studio .NET, Microsoft Visual FoxPro and other .NET platforms. PDFtoolkit supports filling and reading of PDF forms, compressing, securing, appending and merging of multiple PDF documents, stamping, building Table of Contents, setting bookmarks, and many more functions that can be performed on PDF documents.

Why do I need Gnostice PDFtoolkit?
There are several reasons for using Gnostice PDFtoolkit. One scenario is when you need to acquire information from users through a PDF form based solution. You would use PDFtoolkit to fill form fields and read the filled forms to directly extract data into a database. Another scenario is when you need to process PDF documents from your application and perform tasks such as extracting pages, merging documents, encrypting documents and so on.

Can I edit PDF documents using PDFtoolkit?
You cannot edit the content of pages as you would in a word processor but you can insert, delete and extract pages, merge multiple documents, set watermarks and stamp documents.

Who can use PDFtoolkit?
If you are a software developer and you use Microsoft Visual Studio, Microsoft Visual Studio .NET, Microsoft Visual FoxPro, Borland Delphi 8 .NET or Borland C#Builder to develop your software, you can use PDFtoolkit. PDFtoolkit enables your applications to manage and manipulate PDF documents for specific user needs.

What are the minimum requirements for using PDFtoolkit?
Please see the System Requirements for complete details.

Can I try PDFtoolkit before I buy?
YES. The FREE full-feature trial versions of PDFtoolkit are available on the Download page.

What are the limitations of the trial edition?
Trial versions have the following limitations:
• The trial version expires 30 days from date of install.
• Applications developed using the trial version will only work on the computer that has the trial version installed.
• Each page of the managed document will contain a message stating the document was created using the trial version of Gnostice PDFtoolkit and the Gnostice web site address printed across the middle.
• Text extraction functions return text with some characters replaced by asterisk (*).

Does Gnostice PDFtoolkit require Adobe® Acrobat™ to work?
NO. PDFtoolkit does not require any external software or DLLs to work.

Do I need to supply any additional files with my application for PDFtoolkit to work?
You only need to supply the library files along with the compiled executable (EXE) application to your users. (Please see the Deployment topic in Help.) However, your application's installer program (setup) should install a Windows file, gdiplus.dll, if the Windows operating system is older than Windows XP. Sometimes, gdiplus.dll may already be installed, in which case your installer program should not attempt to overwrite the existing dll, as this will run into conflict with an inherent Windows feature to protect system files from being overwritten. Further, the License restricts the distribution of certain files supplied with PDFtoolkit. Please check the License section for details.

How do I buy Gnostice PDFtoolkit?
You can buy PDFtoolkit online and get instant access to the registered version. There are several payment options available. Please check the Buy Now section for details.

Can I create PDF documents from scratch using PDFtoolkit?
No, PDFtoolkit can be used only for managing existing PDF documents. To create PDF files from scratch, take a look at Gnostice eDocEngine.

Can I manage encrypted PDF documents using PDFtoolkit?
Yes, PDFtoolkit can read and manage encrypted documents. An existing encrypted document's encryption setting can be altered, or even removed to have it decrypted. PDFtoolkit respects the access permissions set by the document author. If you provide the owner password, you can perform all supported operations. With the user password, you can perform the operations that the author intended you to perform.

What versions of PDF documents does PDFtoolkit support?
PDFtoolkit supports PDF version 1.2 (Acrobat 3) to version 1.6 (Acrobat 7).
 

Technical

How do I Merge multiple PDF documents?

Multiple PDF documents can be merged using the MergeDocs function, as shown below:

  [VB]
    'Create a list of documents to Merge
    Dim DocList() As String
    ReDim DocList(0 To 1)

    DocList(0) = InputFile1
    DocList(1) = InputFile2

    ' Load Documents to merge
    gtPDFDocumentX1.MergeDocs (DocList)

    ' Save the Document
    gtPDFDocumentX1.SaveToFile (OutputFile)

    ' Free the List
    ReDim DocList(0)

  [VC++]
    VARIANT DocList;

      //Create a list of documents to Merge
      char **files;
      files = new char*[2];
      files[0] = new char[100];
      files[1] = new char[100];

      strcpy(files[0], InputFile1);
      strcpy(files[1], InputFile2);

      VariantInit(&DocList);

      // G etVariantFromStrings is a utililty function provided in gtPDFkitUtils.h

      DocList = GetVariantFromStrings(files, 2);

      //Load Documents to merge
      m_PDF.MergeDocs (DocList);

      //Save the Document
      m_PDF.SaveToFile (OutputFile);


How do I Insert pages from one PDF document to another and specify where to insert the pages?

Pages can be inserted from one PDF document into another using the InsertPagesFrom function. The following example creates OutputFile.pdf by inserting pages 1 to 5 from InputFile2.pdf to InputFile1.pdf, with the pages being inserted after page 1 in OutputFile.pdf.

  [VB]
    'Load the Document to which the pages are to be inserted
    gtPDFDocumentX1.LoadFromFile (InputFile1.pdf)

  'Insert 2 Pages from 'Doc2.pdf' into 'Doc1.pdf' at the Beginning

    gtPDFDocumentX1.InsertPagesFrom InputFile2, "1-5", 0

    'Save the Document
    gtPDFDocumentX1.SaveToFile (OutputFile)

  [VC++]
    //Load the Document to which the pages are to be inserted
    m_PDF.LoadFromFile (InputFile1);

    //Insert 2 Pages from 'Doc2.pdf' into 'Doc1.pdf' at the Beginning

    m_PDF.InsertPagesFrom( InputFile2, "1,2", 0);

    //Save the Document
    m_PDF.SaveToFile (OutputFile);



How do I Extract pages from an existing PDF document and create a new one?

PDFtoolkit has the "ExtractPagesTo" function, which facilitates extracting pages from a currently loaded document into another document. The following example creates Output.pdf by extracting pages 1 to 10 from Doc1.pdf.

  [VB]
  gtPDFDocumentX1.LoadFromFile ("Doc1.pdf")
  gtPDFDocumentX1.ExtractPagesTo "Output.pdf", "1-10"

  [VC++]
  m_PDF.LoadFromFile ("Doc1.pdf");
  m_PDF.ExtractPagesTo( "Output.pdf", "1-10");


How do I insert a Marking (Watermark/rubber Stamp) on every page of my PDF document?

Markings can be a Text type, Image type or Composite type. The text marking can be inserted by calling the InsertWatermark function with an object of gtTextWatermarkTemplateX type as shown below. Similarly, an image marking can be inserted by creating an object of gtImageWatermarkTemplateX, and providing that to the InsertWatermark method.

  [VB]
    Dim Watermark As gtTextWatermarkTemplateX

      'Load the Document
      gtPDFDocumentX1.LoadFromFile (InputFile1)

      'Create and set watermark properties
      gtPDFDocumentX1.MeasurementUnit = muPoints
      Set Watermark = gtPDFDocumentX1.GetTextWatermark
      With Watermark
        .Text = "Confidential"
        .Angle = 45
        .Font.Name = "Arial"
        .Font.Size = 60
        .Font.Bold = True
        .TextColor = RGB(255, 0, 0) 'Red
        .RenderMode = rmxFill
        .StrokeColor = clMaroon
        .Overlay = True
        .HorizPos = hpCenter
        .VertPos = vpMiddle
      End With

        'Insert the watermark
        gtPDFDocumentX1.InsertTextWatermark Watermark

        'Save the Document
        gtPDFDocumentX1.SaveToFile (OutputFile)

  [VC++]
    CgtTextWatermarkTemplate Watermark;
    CY fontSize;

    fontSize.int64 = 60 * 10000;
    //Load the Document
    m_PDF.LoadFromFile (InputFile1);

    //Create and set watermark properties

    m_PDF.SetMeasurementUnit(muPoints);
    Watermark = m_PDF.GetTextWatermark();

    Watermark.SetText("Confidential");
    Watermark.SetAngle(45);
    Watermark.GetFont().SetName("Arial");
    Watermark.GetFont().SetSize(fontSize);
    Watermark.GetFont().SetBold(true);
    Watermark.SetTextColor(RGB(255, 0, 0)); //Red
    Watermark.SetRenderMode(rmxFill);
    Watermark.SetStrokeColor(RGB(255, 200, 200));
    Watermark.SetOverlay(true);
    Watermark.SetHorizPos(hpCenter);
    Watermark.SetVertPos(vpMiddle);

    //Insert the watermark
    m_PDF.InsertTextWatermark(Watermark.m_lpDispatch);

    //Save the Document
    m_PDF.SaveToFile (OutputFile);



Can I insert multiple or Composite Watermarks to my PDF document?
Yes, composite watermarks can be easily inserted using the gtCompositeWatermarkTemplateX class.

First, create any text or image watermarks and add them to an object of 
gtCompositeWatermarkTemplateX type. Then insert them all by calling the
InsertWatermark method.

  [VB]
    Dim txtWatermark As gtTextWatermarkTemplateX
    Dim img As gtImageWatermarkTemplateX
    Dim refWatermark As gtTextWatermarkTemplateX
    Dim comp As gtCompositeWatermarkTemplateX

    Set txtWatermark = gtPDFDocumentX1.GetTextWatermark
    Set img = gtPDFDocumentX1.GetImageWatermark
    Set comp = gtPDFDocumentX1.GetCompositeWatermark

    img.Name = "Image Watermark"
    img.SetImageByHandle Image1.Picture.Handle, itBitmap
    img.Overlay = True
    img.VertPos = vpTop
    img.HorizPos = hpCenter

    txtWatermark.Text = "Text watermark"
    txtWatermark.HorizPos = hpCenter
    txtWatermark.Overlay = True

    txtWatermark.TextColor = RGB(255, 0, 0)
    txtWatermark.Font.Size = 70
    txtWatermark.Font.Bold = False
    txtWatermark.Font.Italic = True
    txtWatermark.Font.Underline = True

    Call comp.AddTextWatermark(txtWatermark)
    Call comp.AddImageWatermark(img)

    Set refWatermark = comp.GetTextWatermarkAt(0)
    refWatermark.Text = "Changed watermark text"

    gtPDFDocumentX1.LoadFromFile ("Input.pdf")
    Call gtPDFDocumentX1.InsertCompositeWatermark(comp)
    gtPDFDocumentX1.SaveToFile ("Output.pdf")

  [VC++]
    CY fontSize;
    CgtTextWatermarkTemplate watermark, refWatermark;
    CgtCompositeWatermarkTemplate comp;
    CgtImageWatermarkTemplate img;

    LPCSTR fname;
    CBitmap Bmp;
    unsigned long bmpHandle;

    fname = "BitmapImage.bmp";
    HANDLE hBmp = LoadImage
    (NULL, fname,IMAGE_BITMAP,0,0,LR_LOADFROMFILE);

    Bmp.Attach(hBmp);
    bmpHandle = (long)HBITMAP(Bmp);

    img = m_PDF.GetImageWatermark();

    img.SetName("Image Watermark");
    img.SetImageByHandle( bmpHandle , itBitmap);

    img.SetHorizPos(hpCenter);
    img.SetVertPos(vpMiddle);

    watermark = m_PDF.GetTextWatermark();
    watermark.SetName("Text watermark");
    watermark.SetText("Text watermark");
    fontSize.int64 = 24 * 10000;
    watermark.GetFont().SetSize(fontSize);
    watermark.SetTextColor(RGB(255, 0, 0));
    watermark.SetHorizPos(hpCenter);

    watermark.SetOverlay(true);

    comp = m_PDF.GetCompositeWatermark();
    comp.AddTextWatermark(watermark.m_lpDispatch);
    comp.AddImageWatermark(img.m_lpDispatch);

    if (comp.GetWatermarkTypeAt(0) == wtTextWatermark)
    {
      refWatermark = comp.GetTextWatermarkAt(0);
      refWatermark.SetText("Changed watermark Text");
    }

    m_PDF.LoadFromFile("Input.pdf");
    m_PDF.InsertCompositeWatermark(comp.m_lpDispatch);
    m_PDF.SaveToFile("Output.pdf");


How do I insert a bitmap as Watermark?

  [VB]
    Dim img As gtImageWatermarkTemplateX
    Dim bmp As Image

    Set img = gtPDFDocumentX1.GetImageWatermark

    img.Name = "Image Watermark"
    // Image1 – control To which a bitmap image is loaded
    img.SetImageByHandle Image1.Picture.Handle, itBitmap
    img.Overlay = True
    img.VertPos = vpTop
    img.HorizPos = hpCenter

    gtPDFDocumentX1.LoadFromFile ("Input.pdf")

    Call gtPDFDocumentX1.InsertImageWatermark(img)

    gtPDFDocumentX1.SaveToFile ("Output.pdf")

  [VC++]
    LPCSTR fname;
    CBitmap Bmp;
    unsigned long bmpHandle;

    fname = "BitmapFile.bmp";
    HANDLE hBmp = LoadImage
    (NULL, fname,IMAGE_BITMAP,0,0,LR_LOADFROMFILE);

    Bmp.Attach(hBmp);
    bmpHandle = (long)HBITMAP(Bmp);

    CgtImageWatermarkTemplate img;
    img = m_PDF.GetImageWatermark();

    img.SetName("Image Watermark");
    img.SetImageByHandle( bmpHandle , itBitmap);

    img.SetHorizPos(hpCenter);
    img.SetVertPos(vpMiddle);

    img.SetOverlay(true);

    m_PDF.LoadFromFile ("Input.pdf");
    m_PDF.InsertImageWatermark(img);
    m_PDF.SaveToFile ("Output.pdf");



How do I Set Values to form fields on a PDF form (Acroform) and permanently save the values?

Form field values can be set using one of the following three methods provided by PDFtoolkit:

1. Procedure SetFormFieldValue(FieldNo: Integer; Value: string);

Here, the function requires the field index and its corresponding value.

2. Procedure SetFormFieldValue(FieldName: string; Value: string);

Here, the function requires the field name and its corresponding value.

3. Procedure SetFormFields(Data: TStringList);

Here, the function requires the field names and their corresponding values as Name-Value pairs in a string list.

All the field names and their corresponding existing values can be obtained by calling the "GetFormFields" function. The values for each field can be set by setting the 'Value' property, and then passing the StringList to SetFormFields.



How do I Extract Field Values from a filled PDF form?

Form field values can be extracted from a filled PDF form using one of the following three functions:

1. Function GetFormFieldValue(FieldNo: Integer): string;

  Provides the field number whose value is to be extracted. The value is returned as string.

2.
Function GetFormFieldValue(FieldName: string): string;

  Provides the field name whose value is to be extracted. The value is returned as string.

3.
Function GetFormFields: TStringList;

  This function will return a string list of field names and values as Name-Value pairs.


How do I Extract Field Names from a PDF form?

Field names can be extracted by providing the index of the field in the PDF document.

  [VB]
    Dim FieldName As String

    'fields are indexed from 0
    FieldName = gtPDFDocumentX1.GetFormFieldName(1);

  [VC++]
    CString FieldName;

    //fields are indexed from 0
    FieldName = m_PDF.GetFormFieldName(1);


How do I set my own Thumbnail for a specific page in the PDF document?

Thumbnails can be added to a PDF document using the AddThumbnail method. An object of TGraphic type has to be provided as input to the function.

  [VB]
    gtPDFDocumentX1.LoadFromFile (InputFile1)

    'Insert metafile as thumbnail
  gtPDFDocumentX1.AddThumbnailByHandle 1, Image1.Picture.Handle, itMetafile

    'Insert BMP image as thumbnail
  gtPDFDocumentX1.AddThumbnailByHandle 3, Image2.Picture.Handle, itBMP

    gtPDFDocumentX1.SaveToFile (OutputFile)

  [VC++]
    long pImageStream;
    long nfileSize;

    m_PDF.LoadFromFile (InputFile1);

    //Insert metafile image as thumbnail
    m_PDF.AddThumbnailByHandle( 1, (long)GetEnhMetaFile
    ("logo.emf"), itMetafile);

    //Insert JPEG image as thumbnail
  // GetImageStreamAndSize is a utililty function provided in gtPDFkitUtils.h

    GetImageStreamAndSize("bulb.jpg", pImageStream, nfileSize);
    m_PDF.AddThumbnailByStream
      ( 3, pImageStream, nfileSize, itJPEG);

    m_PDF.SaveToFile (OutputFile)



How do I Email a document after saving?

Enable the EMailWithFastNet or EMailWithIndy option in "gtPTKDefines.inc" to get built-in support for FastNet or Indy Components. "gtPTKDefines.inc" is located in the directory <InstallDir>\Source.

The information required for the EMail can be provided either through the event or through the EmailInfo property.

If Event method is used, then provide a handler for gtPDFDocument1.OnEmail event to set the E-Mail information.

  [VB]
    Dim emailInfo As gtEmailInfoX

    gtPDFDocumentX1.EMailAfterSave = True

    Set emailInfo = gtPDFDocumentX1.emailInfo

    emailInfo.Host = "host"
    emailInfo.UserId = "XYZ"
    emailInfo.Password = "Password"
    emailInfo.Attachments.Add ("attach1.zip")
    emailInfo.RecepientsList.Add ("recipient1@domain.com ")
    emailInfo.FromAddress = "FromAddress.com"
    emailInfo.Subject = " Hello"

    emailInfo.CCList.Add ("cc1@domain.com")
    emailInfo.CCList.Add ("cc2@domain.com")

    emailInfo.BccList.Add ("bcc1@domain.com")
    emailInfo.BccList.Add ("bcc2@domain.com")

    gtPDFDocumentX1.LoadFromFile ("Input.pdf")

    gtPDFDocumentX1.SaveToFile ("Output.pdf")

  [VC++]
    CgtEmailInfo TmpEmail;

    BSTR name;
    VARIANT varName;

    TmpEmail.SetHost("host");
    TmpEmail.SetUserId("amith")
    TmpEmail.SetPassword("password")

    //TCHAR2BSTR is a utililty function provided in gtPDFkitUtils.h

    name = TCHAR2BSTR("recipient1@domain.com");
    varName.bstrVal = name;
    varName.vt = VT_BSTR;

    TmpEmail = m_PDF.GetEmailInfo();
    TmpEmail.GetRecepientsList().Add(varName);

    TmpEmail.SetFromAddress("FromAddress.com ");
    TmpEmail.SetSubject("Hello");

    name = TCHAR2BSTR("cc1@domain.com ");
    varName.bstrVal = name;
    TmpEmail.GetCCList().Add(varName);

    name = TCHAR2BSTR("cc1@domain.com ");
    varName.bstrVal = name;
    TmpEmail.GetCCList().Add(varName);

    name = TCHAR2BSTR("bcc1@domain.com ");
    varName.bstrVal = name;
    TmpEmail.GetBccList().Add(varName);

    name = TCHAR2BSTR("bcc1@domain.com ");
    varName.bstrVal = name;
    TmpEmail.GetBccList().Add(varName);

    m_PDF.SetEMailAfterSave(true);
    m_PDF.LoadFromFile ("Input.pdf");
    m_PDF.SaveToFile ("Output.pdf");



How do I insert a Bookmark or Outline item to my PDF document?

Use CreateNewBookmark to create a new bookmark for the document. To manipulate an existing bookmark, call GetBookmarkRoot to obtain the root bookmark node of the document.

  [VB]
    Dim PDFDest As gtPDFDestinationX
    Dim Outline1, Outline2, Outline3 As gtPDFOutlineX

    'Load the Document
    gtPDFDocumentX1.LoadFromFile (InputFile1)

    'Set the neccessary bookmark destination settings
    Set PDFDest = gtPDFDocumentX1.GetDestination
    PDFDest.Page = 1
    PDFDest.DestinationType = dtXYZ
    PDFDest.Left = 0
    PDFDest.Top = 0
    PDFDest.Zoom = 200

    ' Create new bookmark with title 'Chapter 1'
    Set Outline1 = gtPDFDocumentX1.CreateNewBookmark
    ("Chapter 1", PDFDest)

    ' Add 'Section 1' as child of 'Chapter 1'.
    PDFDest.Page = 2
    PDFDest.DestinationType = dtFitV
    Call Outline1.AddChild("Section 1", PDFDest)

    ' Insert 'Chapter 2' as next bookmark node.
    PDFDest.Page = 3
    PDFDest.DestinationType = dtFit
    Set Outline2 = Outline1.AddNext("Chapter 2", PDFDest)

    ' Insert 'Section 1' as child of 'Chapter 2' and
    '  'Section 2' as a next node of 'Section 1'

    PDFDest.Page = 4
    PDFDest.DestinationType = dtFit
    Set Outline3 = Outline2.AddChild("Section 1", PDFDest)

    PDFDest.Page = 5
    PDFDest.DestinationType = dtFit
    Call Outline3.AddNext("Section 2", PDFDest)

    PDFDest.Page = 6
    PDFDest.DestinationType = dtFitV
    Call Outline2.AddNext("Chapter 3", PDFDest)

    ' Save the Document
    gtPDFDocumentX1.SaveToFile (OutputFile)

  [VC++]
    CgtPDFDestination PDFDest;
    CgtPDFOutline Outline1, Outline2, Outline3;

    //Load the Document
    m_PDF.LoadFromFile (InputFile1);

    //Set the neccessary bookmark destination settings
    PDFDest = m_PDF.GetDestination();
    PDFDest.SetPage(1);
    PDFDest.SetDestinationType(dtXYZ);
    PDFDest.SetLeft(0);
    PDFDest.SetTop(0);
    PDFDest.SetZoom(200);

    //Create new bookmark with title "Chapter 1"
    Outline1 = m_PDF.CreateNewBookmark("Chapter 1", PDFDest);

    //Add "Section 1" as child of 'Chapter 1'.
    PDFDest.SetPage(2);
    PDFDest.SetDestinationType(dtFitV);
    Outline1.AddChild("Section 1", PDFDest);

    // Insert 'Chapter 2' as next bookmark node.
    PDFDest.SetPage(3);
    PDFDest.SetDestinationType(dtFit);
    Outline2 = Outline1.AddNext("Chapter 2", PDFDest);

    // Insert 'Section 1' as child of 'Chapter 2' and
    // 'Section 2' as a next node of 'Section 1'

    PDFDest.SetPage(4);
    PDFDest.SetDestinationType(dtFit);
    Outline3 = Outline2.AddChild("Section 1", PDFDest);

    PDFDest.SetPage(5);
    PDFDest.SetDestinationType(dtFit);
    Outline3.AddNext("Section 2", PDFDest);

    PDFDest.SetPage(6);
    PDFDest.SetDestinationType(dtFitV);
    Outline2.AddNext("Chapter 3", PDFDest);

    // Save the Document
    m_PDF.SaveToFile (OutputFile);


How do I load an existing bookmark into a TreeView Control?

The bookmark items can be added to a TreeView Control effectly using recursion. First, obtain the Outline root's child node, and then traverse through its child nodes. Then, traverse each nodes to 'next' (sibling) node.

  [VB]
    Private Sub cmdLoadOutlines_Click()
    
      Dim LOutline As gtPDFOutlineX
      Dim LChild As gtPDFOutlineX

      Dim LNode As Node

      gtPDFDocumentX1.LoadFromFile ("D:\\PDFs\\outline1.pdf")
      Set LOutline = gtPDFDocumentX1.GetBookmarkRoot

      If Not LOutline Is Nothing Then
        'Obtain the first child of the root.
        Set LChild = LOutline.GetFirstChild

          If Not LChild Is Nothing Then

          Set LNode = TreeView1.Nodes.Add
        (, , LChild.Title, LChild.Title)

          If Not LChild.Child Is Nothing Then
            Call BuildOutlineChild(LNode, LChild.Child)
          End If

          If Not LChild.Next Is Nothing Then
            Call BuildOutlineNext(LNode, LChild.Next)
          End If

        End If
      End If

      TreeView1.Style = tvwTreelinesPlusMinusText ' Style 6.
      TreeView1.LineStyle = tvwRootLines

    End Sub.
    Private Sub BuildOutlineChild
    (aNode As Node, ByRef aOutline As gtPDFOutlineX)
      Dim LNode As Node
      Dim Outline As gtPDFOutlineX

      'Add aOutline as Child to aNode in the TreeView.
      If Not aOutline Is Nothing Then
        Set LNode = TreeView1.Nodes.Add
    (aNode.Text, tvwChild, aOutline.Title, aOutline.Title)
        LNode.EnsureVisible
      End If

      If Not aOutline.Child Is Nothing Then
        Call BuildOutlineChild(LNode, aOutline.Child)
      End If
    End Sub

    Private Sub BuildOutlineNext
    (aNode As Node, aOutline As gtPDFOutlineX)
      Dim LNode As Node

      'Add aOutline as Child to aNode in the TreeView.
      Set LNode = TreeView1.Nodes.Add
    (aNode.Text, tvwNext, aOutline.Title, aOutline.Title)
      LNode.EnsureVisible

    If Not aOutline.Child Is Nothing Then
      Call BuildOutlineChild(LNode, aOutline.Child)
    End If

    If Not aOutline.Next Is Nothing Then
      Call BuildOutlineNext(LNode, aOutline.Next)
    End If
    End Sub

  [VC++]
    void OnLoadOutlines()
    {
      CgtPDFOutline LOutline, LChild;

      m_PDFDOC1.LoadFromFile ("D:\\PDFs\\outline1.pdf");

      LOutline = m_PDFDOC1.GetBookmarkRoot();

      if (LOutline != NULL)
      {

        //Obtain the first child of the root.
    LChild = LOutline.GetFirstChild();

    if (LChild != NULL)
     {
        HTREEITEM LNode = m_TreeCtrl.InsertItem
    (LChild.GetTitle(), 0, 0, TVI_ROOT,TVI_LAST);

        if (LChild.GetChild() != NULL)
          BuildOutlineChild(LNode, LChild.GetChild
    ());

        if (LChild.GetNext() != NULL)
          BuildOutlineNext(LNode, LChild.GetNext());
        }
      }
    }

      void BuildOutlineChild
      (HTREEITEM Node, CgtPDFOutline aOutline)
      {
          HTREEITEM LNode;
          CgtPDFOutline Outline;

          //Add aOutline as Child to aNode in the TreeView.
          if (aOutline != NULL)
            LNode = m_TreeCtrl.InsertItem(aOutline.GetTitle
        (), 0, 0, Node, TVI_LAST);

          if (aOutline.GetChild() != NULL)
            BuildOutlineChild(LNode, aOutline.GetChild());
          if (aOutline.GetNext() != NULL)
            BuildOutlineNext(LNode, aOutline.GetNext());

      }
      void BuildOutlineNext(HTREEITEM Node, CgtPDFOutline aOutline)
      {
        HTREEITEM LNode;

      //Add aOutline as Child to aNode in the TreeView. 
      LNode = m_TreeCtrl.InsertItem(aOutline.GetTitle
    (), 0, 0, Node, TVI_LAST);

      if (aOutline.GetChild() != NULL)
        BuildOutlineChild(LNode, aOutline.GetChild());

      if (aOutline.GetNext() != NULL)
      BuildOutlineNext(LNode, aOutline.GetNext());
      }
 

 

 
    Privacy | Legal | Feedback Copyright © 2002-2008 Gnostice Information Technologies Private Limited. All rights reserved.    


Quick Links
Corporate: Profile | Mission | Technology Partners | Reseller Partners | Latest News | News Archives | Careers | Route Map | Customers | Testimonials | Newsletters Product Categories: Software Developers | Business Analysts | Business Users | Enterprises ♥ Developer Tools: PDFOne .NET | PDFOne Java | eDocEngine VCL | PDFtoolkit VCL | Print2eDoc SDK | eDocEngine ActiveX/.NET | PDFtoolkit ActiveX/.NET | PDF2Many ActiveX/.NET | Many2PDF ActiveX/.NET ♥ Project Requirements Management Applications: Caliber Reporter | Office Productivity Applications: Print2eDoc | PDFWiz | ONEView ♥ Enterprise Applications: PathQuest ♥ Other Links: Support | Download | Buy Now | Contact Us | Home