Created
October 9, 2018 19:24
-
-
Save azettl/6b4b5cace5288081b92cd3ac550028b3 to your computer and use it in GitHub Desktop.
Get the Bookmarks from a PDF
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$sPdfContent = file_get_contents("filename.pdf"); | |
$sRegexPattern = "/R\/[A-Za-z0-9\s\/\[\.\]]*\/Title\(([A-Za-z0-9\.\s\:]*)\)[\/Prev|>>]/"; | |
preg_match_all($sRegexPattern, $sPdfContent, $aBookmarkMatches); | |
$aBookmarkTitles = $aBookmarkMatches[1]; | |
foreach($aBookmarkTitles as $sBookmarkTitle) { | |
echo $sBookmarkTitle . '<br />'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment