开发者

Issue with opening XFDF PDf's from PGP program

I have a system that prepopulates PDF fields via XFDF.

THe XFDF code seems fine, but when I try to open it with the header() in PHP, PDF fires an error. If I ignore it and refresh the page, it works fine and poplulates the form correctly.

Below is the XFDF code as well as the header I am using...

Any idea why PDF doesnt display it right away?

<`?xml version="1.0" encoding="UTF-8" ?> 
<`xfdf xmlns="http://ns.adobe.com/xfdf/" xml:space="preserve">

<'fields>

<`field name="user_name">
<`value>Some Name</value> 
<'/field>

<`field name="course_name">
<`value>Some Course</value> 
<`/field>


<`/fields>

<`f href="http://the_URL_to_the_PDF_that_needs_t开发者_JAVA百科o_be_populated_with_the_XFDF info" /> 

<`/xfdf>

I am trying to open the above with the header command below..

header("Content-type: application/vnd.adobe.xfdf");


Try:

// No space after this opening tag
$xfdf =<<<'XFDF'
<?xml version="1.0" encoding="UTF-8" ?> 
<xfdf xmlns="http://ns.adobe.com/xfdf/" xml:space="preserve">
   <fields>
      <field name="user_name"> <value>Some Name </field>
      <field name="course_name"> <value>Some Course </field>
   </fields>
   <f href="http://the_URL_to_the_PDF_that_needs_to_be_populated_with_the_XFDF info" />
</xfdf>

XFDF; // No space before this closing tag

header('Content-type: application/vnd.adobe.xfdf');
echo $xfdf;


Use the format recommended by Adobe

<?xml version="1.0" encoding="UTF-8"?> 
<xfdf xmlns="http://ns.adobe.com/xfdf/" xml:space="preserve"> 
    <f href="samples/AddressLabel.pdf"/>
    <ids original="7A0631678ED475F0898815F0A818CFA1" modified="BEF7724317B311718E8675B677EF9B4E"/> 
    <fields> 
        <field name="name"> 
            <value>Adobe Systems, Inc.</value> 
        </field> 
        <field name="address">
            <value>345 Park Ave.</value> 
        </field> 
        <field name="status"> 
            <value>us citizen</value> 
        </field>
    </fields>
</xfdf>

More information in Adobe's reference document: http://partners.adobe.com/public/developer/en/xml/xfdf_2.0.pdf

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜