I'm uploading pdf to sharepoint 2010 docs library. And when I download the document it reads perfectly with reader. But if i'm trying to read it with PdfReader.Open() I'm getting such an error "Token {0} is not expected". I opened the file with notepad and discover some additional metadata appended with sharepoint after EOF directive. Here it is:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns:o="urn:schemas-microsoft-com:office:office" __expr-val-dir="ltr" lang="en-us" dir="ltr">
<head><meta http-equiv="X-UA-Compatible" content="IE=8" /><meta name="GENERATOR" content="Microsoft SharePoint" /><meta name="progid" content="SharePoint.WebPartPage.Document" /><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><meta http-equiv="Expires" content="0" /><title>
</title><link rel="stylesheet" type="text/css" href="/_layouts/1033/styles/Themable/layouts.css?rev=aTcoNUf8p1YiDzYCg3%2FLIw%3D%3D"/>
<link rel="stylesheet" type="text/css" href="/_layouts/1033/styles/Themable/minimalv4.css?rev=QACXwfVflZPCtqqy8xasdg%3D%3D"/>
<script type="text/javascript">
// <![CDATA[
document.write('<script type="text/javascript" src="/_layouts/1033/init.debug.js?rev=%2FOmktAG7ectPWwTJWj46Jg%3D%3D"></' + 'script>');
document.write('<script type="text/javascript" src="/ScriptResource.axd?d=jo-qr0uliogUxPfGJgzwxlqqWGBr4ZQluJCkvu8GepmnwGeFGOBx2X6f7wOlonZsuHJrCfGg7ytQi9ybHdfIl1fvn6n8Vuaq0wsG6vUtnzOGD8fu_G39skSe9cmTWAC6F-_-We2xD8lqcXK1byyw96tPn4EBhYftzRXUJNfk2rFTka_l0&t=ffffffffb868b5f4"></' + 'script>');
document.write('<script type="text/javascript" src="/_layouts/blank.debug.js?rev=jE3bS2JFTB63z3iWgauX9w%3D%3D"></' + 'script>');
document.write('<script type="text/javascript" src="/ScriptResource.axd?d=eK8NeFyqifiHIEBZsFu4DhSSm0KVdY12CSYlSDjGl2uBdrQ2ToscBqrAQ1ddvJKOdrp6VqIT5TQ9OqvDJASGOt1CljJjTdqIcylj3CjCbrU_l0ItIA5uEutZo6JDaaHbjt375r4t5aJWxuHVzPRF7kIr55lO5VXdkDUGYVkEvu5_erFl0&t=ffffffffb868b5f4"></' + 'script>');
// ]]>
</script>
There are more to show but it should be enough.
Maybe it's sufficient to modify the method ReadTrailer as described here: http://forum.pdfsharp.net/viewtopic.php?p=583#p583
If the problem persists, please provide a sample PDF file for further examination.