Print Page | Close Window

NewNamedDestination - will not add a nameddest

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=2068
Printed Date: 04 Apr 26 at 5:19PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: NewNamedDestination - will not add a nameddest
Posted By: hubbra
Subject: NewNamedDestination - will not add a nameddest
Date Posted: 09 Dec 11 at 3:16PM
Hi,

I want to set new named destinations, and failed, so I wrote this little test to read a PDF with namedDest, search one ... this works, but I am confused about the left and top parameters.
And then use the nDestID and create a NewNamedDest ... Result 1, but there is nothing inside.
Than i create a new nDestID with NewDestination, Result <> 0, so it should be ok.
And try to create with it a NewNamedDestination, Result 1 but nothing inside ...
Save the PDF to a new file and no new nameddest inside, only the old ones ...
I got left = -185 and thought it should be 0 or 1 because it shows the first position on page.
I got top = 644 on the middle Position, and 804 on the page top ...

What do I have to do different ?

The example is in PowerBasic, using your INC file.


#COMPILE EXE
#DIM ALL
#DEBUG ERROR ON

#INCLUDE "QuickPDFDLL0726.inc"
#INCLUDE "QuickPDFLizenz.inc"

FUNCTION PBMAIN () AS LONG
  LOCAL nID, nResult, nH, i, x, nDestID AS LONG
  LOCAL sPDF, sKW, sDestName AS ASCIIZ*256

  sPDF = "Test.pdf"

  nID = QuickPDFCreateLibrary()

  IF QuickPDFUnlockKey(nID, $QuickPDFLizenzKeyHB  ) THEN
     ? QuickPDFLibraryVersion(nID)
     ? QuickPDFLicenseInfo(nID)
     nResult = QuickPDFLoadFromFile(nID, sPDF)
     IF nResult <> 1 THEN
        ? "Error PDF could not be opened:", nResult
     ELSE
        ? "PDF is open, some infos:"
        ?
        ? "GetDocumentFileName()='"+QuickPDFGetDocumentFileName(nID)+"'"
        ? QuickPDFGetInformation(nID, 0 ) ' 0 = PDF Version
        ? QuickPDFGetInformation(nID, 1 ) ' 1 = Author
        ? QuickPDFGetInformation(nID, 2 ) ' 2 = Title
'        ? QuickPDFGetInformation(nID, 3 ) ' 3 = Subject
'        ? QuickPDFGetInformation(nID, 4 ) ' 4 = Keywords
        ? QuickPDFGetInformation(nID, 5 ) ' 5 = Creator
        ? QuickPDFGetInformation(nID, 6 ) ' 6 = Producer
        ? QuickPDFGetInformation(nID, 7 ) ' 7 = Creation date
        ? QuickPDFGetInformation(nID, 8 ) ' 8 = Modification date
        ?
        ? "PageCount:          " QuickPDFDAGetPageCount(nID, nH)
        sDestName = "K01Ab"
        nResult = QuickPDFGetNamedDestination(nID,sDestName)
        IF nResult=0 THEN
           ? "not found:  GetNamedDestination()",nID,sDestName
        ELSE
           nDestID = nResult
           ?
           ? "gefunden:      ",nDestID
           ? "Infos zu  " sDestName
           ? "PAGE:     " QuickPDFGetDestPage(nID,nDestID)
           ? "TYPE:     " QuickPDFGetDestType(nID,nDestID)
           ? "V-Left:   " QuickPDFGetDestValue(nID,nDestID,1) ' Left
           ? "V-Top:    " QuickPDFGetDestValue(nID,nDestID,2) ' Top
           ? "V-Right:  " QuickPDFGetDestValue(nID,nDestID,3) ' Right
           ? "V-Bottom: " QuickPDFGetDestValue(nID,nDestID,4) ' Bottom
           ? "V-Zoom:   " QuickPDFGetDestValue(nID,nDestID,5) ' Zoom
           ?
           sDestName = "K01Xx1"
           ? "Set NewNamedDest", QuickPDFNewNamedDestination(nID, sDestName, nDestID)
           ? "TEST: ", QuickPDFGetNamedDestination(nID,sDestName)

        END IF

        sDestName = "K01Xx2"
        nDestID   = QuickPDFNewDestination(nID, 2, 100, 1, 1, 500,0,0)
        IF nDestID=0 THEN
           ? "Error in NewDestination()"
        ELSE
           ? "NewDestination is OK"
           ? "Set NewNamedDest", QuickPDFNewNamedDestination(nID, sDestName, nDestID)
           ? "TEST: ", QuickPDFGetNamedDestination(nID,sDestName)
        END IF

        sPDF = "NeuTest.pdf"
        KILL sPDF
        IF QuickPDFSaveToFile(nID, sPDF ) THEN
           ? "OK, gespeichert"
        ELSE
           ? "Fehler beim speichern"
        END IF
        ? "Reset", QuickPDFReleaseLibrary(nID), " (1=OK)"
     END IF
  ELSE
     ? "ERROR"
  END IF

  ? "press key ..."

  WAITKEY$

END FUNCTION







Replies:
Posted By: AndrewC
Date Posted: 13 Dec 11 at 7:37AM

We have reproduced the bug and hopefully will have a fix sometime soon.  It is not a trivial fix as the PDF spec allows for multiple methods for storing Destinations.

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