2009-10-19 3 views
2

표준 PDF 양식이 포함 된 PDF가 있습니다. 동시에 병합하고 필드에 데이터를 채우고 싶습니다.ColdFusion에서 CFPDF를 사용하여 PDF 양식 필드의 이름을 바꿀 수 있습니까?

문제는 때로는 동일한 문서를 여러 문서보다 병합하여 최종 문서에 넣을 수 없다는 것입니다.

반복되는 문서가 충돌하지 않도록 PDF에서 필드의 이름을 바꾸는 방법이 있습니까 (Attach __ #)?

iText 코드로이 작업을 수행 할 수 있습니다. CFPDF/CFPDFFORM 코드를 테스트하여 iText를 제거합니다.

답변

1

cfpdf 또는 cfpdfform으로 필드의 이름을 바꿀 수 없습니다. 병합하기 전에 각 양식을 채우고 병합하여 문제점을 해결할 수 있습니다.

<!--- populate each form ---> 
<cfloop from="1" to="#arrayLen(files)#" index="i"> 
    <cfset destination = "#i#.pdf" /> 
    <!--- fill in form fields ---> 
    <cfpdfform 
     action  = "populate" 
     source  = "#pdf_source_file#" 
     destination = "#destination#" 
    > 
     <!--- form params here ---> 
    </cfpdfform> 

    <!--- flatten file ---> 
    <cfpdf 
     action  = "write" 
     source  = "#destination#" 
     destination = "#destination#" 
     flatten  = "yes" 
    /> 
</cfloop> 

<!--- merge flattened files ---> 
<cfpdf action="merge" name="output"> 
    <cfloop from="1" to="#arrayLen(files)#" index="i"> 
     <cfpdfparam source="#i#.pdf"> 
    </cfloop> 
</cfpdf> 

<!--- return the full pdf ---> 
<cfcontent type="application/pdf" reset="true" variable="#toBinary(output)#"> 
+0

감사 :

다음은 간단한 예입니다. 안타깝게도 사용자가 다운로드 한 후 편집 할 수 있도록 파일을 병합하지 않으려합니다. –

관련 문제