• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

cfpdf import="action" comment

Explorer ,
May 11, 2021 May 11, 2021

Copy link to clipboard

Copied

Hello, in the Coldfusion user documentation under enhancements for cfpdf, there is this comment:  A sample xfdf file (cf_comment3_exported.xfdf) is attached to this pdf for your reference. You can click the attachment icon on the left pane in pdf and save the file.

 

Is there any chance of getting the cf_comment3_exported.xfdf example file?  I've been trying to work with importing comments into a pdf, but so far with no luck.

Views

199

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , May 12, 2021 May 12, 2021

If you search on the web, you will discover that the page containing cf_comment3_exported.xfdf is old. In fact, I could only find a page for ColdFusion 2016, in Japanese. Without a download link anyway.

 

Nevertheless, I may be able to help. I shall give you an example of an XFDF file. I shall also show you how to use it to import a comment into a PDF and how to extract comments from a PDF that contains them.

 

1) Example of an XFDF file

 

<?xml version="1.0" encoding="UTF-8"?>
<xfdf xmlns="http
...

Votes

Translate

Translate
Community Expert ,
May 12, 2021 May 12, 2021

Copy link to clipboard

Copied

If you search on the web, you will discover that the page containing cf_comment3_exported.xfdf is old. In fact, I could only find a page for ColdFusion 2016, in Japanese. Without a download link anyway.

 

Nevertheless, I may be able to help. I shall give you an example of an XFDF file. I shall also show you how to use it to import a comment into a PDF and how to extract comments from a PDF that contains them.

 

1) Example of an XFDF file

 

<?xml version="1.0" encoding="UTF-8"?>
<xfdf xmlns="http://ns.adobe.com/xfdf/"	xml:space="preserve">
	<annots>
		<text page="0"
    			color="#FFD100"
    			date="D:20210512134614+02'00'"
    			title="User: Yodeler ;)"
    			name="3d1e361a-bb0a-48e5-a824-3ce0c0dba645"
    			rect="365.916, 693.619, 389.916, 717.619"
    			flags="print,nozoom,norotate"
    			creationdate="D:20210512134501+02'00'"
    			subject="Sticky Note"
    			icon="Comment">
			<contents-richtext>
				<body xmlns="http://www.w3.org/1999/xhtml"
    					xfa:APIVersion="Acrobat:21.1.0"
    					xfa:spec="2.0.2"
    					xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/">
					<p dir="ltr">
						<span dir="ltr"
    							style="font-size:10.5pt;text-align:left;color:#000000;font-weight:normal;font-style:normal">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</span>
					</p>
				</body>
			</contents-richtext>
			<popup page="0"
     				rect="612.0, 433.521, 816.0, 547.521"
     				flags="print,nozoom,norotate"
     				open="no"/>
		</text>
	</annots>
	<ids original="2685F2344001F64FAA6756AFC7956567" modified="6EA0C0F1943FAE40BB7BA0483F085845"/>
</xfdf>

 

 

2) How to use the comment file to import a comment into a PDF

Create a CFM page, pdfTest1.cfm, containing the following code, and run it. 

The result is that you will create the file "Sample (without comment).pdf". It is in the same directory as the CFM page.

 

 

<cfdocument format="PDF" filename="#expandpath('Sample (without comment).pdf')#">
	Sample PDF 
</cfdocument>
Done creating sample PDF

 

Open the file in a PDF viewer. Confirm that it is indeed a PDF without comments.

 

Save, within the same directory, the XML from step 1) as the file Comment.xfdf. 

Now (in the same directory) create a new CFM page, pdfTest2.cfm, containing the following code, and run it:

 

 

<cfpdf       
    action="import"
    type="comment"
    source = "#expandPath('Sample (without comment).pdf')#"
    importFrom = "#expandPath('Comment.xfdf')#"
destination = "#expandPath('Sample (with Comment).pdf')#">
Comment successfully imported from XFDF file into PDF file

 

The result is a new file, "Sample (with comment).pdf". 

 

Open the file in a PDF viewer. Confirm that it is indeed a PDF containing the Lorem ipsum... comments.

 

3) How to extract comments from a PDF that contains comments

To do so, create (again within the current directory) a new page, pdfTest3.cfm, containing the following code, and run it:

 

<cfpdf
action = "export"
type = "comment"
source = "#expandPath('Sample (with Comment).pdf')#"
exportTo = "#expandPath('My generated comment file.xfdf')#" overwrite="yes" >
Comment successfully extracted from PDF and exported to XFDF file

 

In so doing, you will have generated your own XFDF file.

 

 

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 12, 2021 May 12, 2021

Copy link to clipboard

Copied

Thanks for the very detailed response.  I had essentially setup the same example, but I created a new page with your code to compare.  Everything works (all other files create, etc.) except for the very last step:

 

<cfpdf
action="import"
type="comment"
source = "#expandPath('Sample (without comment).pdf')#"
importFrom = "#expandPath('Comment.xfdf')#"
destination = "#expandPath('Sample (with Comment).pdf')#">


At this point, nothing happens, the file with the comment is simply not created.  No error, nothing.  One thought I have is that I am using the developer edition, is the enterprise version needed to run the command?  Thanks.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 13, 2021 May 13, 2021

Copy link to clipboard

Copied

LATEST

I, too, am using the Developer Edition. You have confused the code to insert a comment in a PDF with the code to generate a comment.

 

Please start afresh. Create a new directory under the webroot. Then follow the steps I gave, one by one.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation