开发者

Display PDF in browser with some words highlighted?

I want to display a pdf in a browser in which I want some words highlighted. Is that possible in php? I'm currently using this code to display my pdf file

$fn=fopen($filename, "rb");
header( "Content-type: application/pdf");
while(!feof($fn)) {
 $buffe开发者_如何转开发r = fread($fn, 4096);
 print $buffer;
}

...but I don't know how to display it with highlighted words. I need a code that can do that, not necessarily in php....


This may help you. Or if you don't want to read, try this =)


This first one is not exactly what you asked for, but may probably still be useful...

If you open the file with Acrobat, you can use commandline parameters to highlight a certain rectangle on the page. Example:

 acrobat.exe ^
   /a "page=14,highlight=100,100,200,110" ^
   "d:\path\to\example.pdf"

Here is something which matches more closely what you asked for, even if not by 100%. It opens the PDF alongside the search dialog, which is prefilled with the hits of the searched keywords, highlighting the first one:

 acrord32.exe ^
   /a #search="stackexchange football girls" ^
   "d:\path\to\example.pdf"

On Linux you would use:

 acroread \
   /a #search="stackexchange football girls" \
   "/path/to/example.pdf"

Now it's your own job finding out how to translate these Acrobat commandline calls into your PHP environment... :-)

You'll find more info about this when you search the Adobe website for "PDF Open Parameters".

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜