Skip to content

Instantly share code, notes, and snippets.

@heiglandreas
Created March 4, 2013 07:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save heiglandreas/5080536 to your computer and use it in GitHub Desktop.
Save heiglandreas/5080536 to your computer and use it in GitHub Desktop.
Create a PDF-File with Annotations showing up in Adobe Reader with a checked checkbox in the Annotation-List.
<?php
// Requires PDFlib >= 8.0.0
header('Content-Type: application/pdf');
$pdf = new PDFlib();
$pdf->begin_document('','');
$pdf->begin_page_ext(100,100,'');
$pdf->create_annotation(10,40,20,50, 'text', 'contents={testcontent} name=1 title={foo} popup=2 annotcolor={rgb 1 1 0}');
$pdf->create_annotation(10,40,20,50, 'popup', 'name=2 parentname=1');
$pdf->create_annotation(10,40,20,50,'text','contents={Marked festgelegt von foo} name=3 custom={{key=State type=string value=Marked} {key=StateModel type=string value=Marked}} title={foo} popup=4 inreplyto=1 annotcolor={rgb 1 1 0}');
$pdf->create_annotation(10,40,20,50, 'popup', 'name=4 parentname=3');
$pdf->end_page_ext('');
$pdf->end_document('');
echo $pdf->get_buffer();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment