1

I tried to use PDF_add_nameddest to add nameddest but I don't know exactly how to use it or is it possible. My codes are:

$pdf = pdf_new();

pdf_open_pdi_document($pdf, 'test.pdf', "");

pdf_add_nameddest( $pdf , 'testdestination', 'bottom' );

My reference on the third parameter 'bottom' is from here. But did I used it the right way? I don't understand clearly.

The error on that is:

PDFlib exception occurred in starter_basic sample: [2100] PDF_add_nameddest: Function must not be called in 'object' scope

Is my code missing something or is it completely wrong?

Or even better, do you know something I should use to do this adding nameddest??

rmondesilva
  • 1,732
  • 3
  • 17
  • 29

1 Answers1

0

you get this scope error, because you haven't yet open an new output document (so you are still in object scope). As you might have seen in the PDFlib API reference, for the function "add_nameddest()", the scope for this API call is:

Scope: any except object

So, when you move the call after begin_document() the destination will be added to the new output document.

Please check also PDFlib 9.1 API Reference, chapter 12.5 "Named Destinations" (or related to your used version) for more details on this function.

Rainer
  • 2,013
  • 1
  • 10
  • 7