Print Page | Close Window

Newbie, need help with PHP

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=2206
Printed Date: 26 Jun 25 at 12:48PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Newbie, need help with PHP
Posted By: hawkmaster
Subject: Newbie, need help with PHP
Date Posted: 01 Apr 12 at 6:55PM
Hello,
I have downloaded QuickPDFLibrary QuickPDFAX0814 and tried to split a pdf like in the Developers guide.
Problem is. Total Pages shows only 1 instead of 31 pages of the PDF file.
Next is a crash with DocumentRemove:
com->RemoveDocument(1476395008)
Description:</b> List index out of bounds (1)'

    $qp1 = new COM("QuickPDFAX0814.PDFLibrary");
   
    $pdfsource = $file_name;
    $qp1->LoadFromFile($pdfsource,"");
    
    // Use the SelectedDocument function to get the
    // document ID of the file that we just loaded.
    $DocID = $qp1->SelectedDocument();
    // Count the total number of pages in the
    // selected document. We need the total
    // number of pages before we can use the
    // ExtractFilePages function.
    $TotalPages = $qp1->PageCount();
   
    echo "total pages ist $TotalPages <br>";
   
    // Remove the selected document from memory.
   
    $qp1->RemoveDocument($DocID);
   
    //QP.RemoveDocument(DocID);
    // Loop through each page in the document
    // and use the ExtractFilePages function
    // to copy and save each page in the
    // document to a new document.
    for ( $n = 1; $n < $TotalPages; $n++)
    {
        echo "schleife $n <br>";
        $qp1->ExtractFilePages($pdfsource, "sample_split_" + Convert.ToString(n) + ".pdf", Convert.ToString(n));
    }

Can anybody helpme or give me some exampes?

kind regards
Hans



Replies:
Posted By: Ingo
Date Posted: 02 Apr 12 at 1:40PM
Hi Hans!

This (in Delphi) should be enough to get the pagecount:
  try
    QP := TQuickPDF0814.Create;
    try
       Result1 := QP.UnlockKey(LicenseKey);
       Result2 := QP.LoadFromFile(FileName);
       paco := QP.PageCount;
//     . . .
    finally
       QP.Free;
    end;

I think that it's senseless to remove a document if
there's only one (mostly that's it) document inside a
pdf.

The other thing: The function calls "SelectDocument" ;-)

You should have a look inside the online tutorials on
the official supportpages starting at www.QuickPDF.org...

Cheers and welcome here,
Ingo



Posted By: AndrewC
Date Posted: 04 Apr 12 at 4:13AM

You need to check the return value from LoadFromFile - if it returns 0 then it will point to a different problem.

Andrew.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk