Skip to main content
January 15, 2012
Question

CFpdf Thumbnail Lock

  • January 15, 2012
  • 1 reply
  • 1250 views

I had this code running a long time on a cold fusion 8 server and no issues. The code basiclly processed pdf documents and created thumbnails from the pdf's. Now, whenever the code runs it puts a lock on the pdf document and can't continue and everytime the code runs it keeps adding locks. I also get this errror:

An error occurred during THUMBNAIL operation in the cfpdf tag.

I've tried cflock but nothing helps. Any ideas? Could it be a new type of pdf coming in? Could it be a patch that Cold Fudion 8 needs?

Code:

<cfsetting requestTimeOut = "999999">

<cfdirectory action="LIST" directory="d:\faxes\" name="GetData" filter="*.pdf">

<cfoutput>

<cfloop query="GetData">

<cfset v_file = "d:\faxes\#GetData.name#">

<cftry>

  <cfpdf action="getinfo" source="#v_file#" name="fullPdf">

  <cfset totalpages = fullPdf.TotalPages>

  <cfpdf action="thumbnail"

  source="#v_file#"

  overwrite="yes"

  destination="d:\faxes\"

  scale=100

  format="png">

  <cffile action="DELETE" file="#v_file#">

  <cfcatch type="Any">

  #v_file#-#cfcatch.message#<br>

  </cfcatch>

</cftry>

</cfloop>

</cfoutput>

Message was edited by: dadress20001

    This topic has been closed for replies.

    1 reply

    BKBK
    Community Expert
    Community Expert
    January 16, 2012

    Two suggestions:

    1) I think it is sufficient to let the try-catch cover the entire code block.

    2) There is too much going on in the directory d:\faxes, so I would create a separate directory, a subdirectory, for the thumbnails.

    <cftry>

    <cfdirectory action="LIST" directory="d:\faxes\" name="GetData" filter="*.pdf">

    <cfloop query="GetData">

      <cfset v_file = "d:\faxes\#GetData.name#">

      <cfpdf action="getinfo" source="#v_file#" name="fullPdf">

      <cfpdf action="thumbnail"

      source="#v_file#"

      overwrite="yes"

      destination="d:\faxes\thumbnails"

      scale="100"

      format="png">

      <cffile action="DELETE" file="#v_file#">

    </cfloop>

    <cfcatch type="Any">

      <cfdump var="#cfcatch#">

    </cfcatch>

    </cftry>

    Did that do any better?

    January 16, 2012

    This did the trick...I added...

    <cfpdf action="write" source="#v_file#" destination="d:\faxes\In-#GetData.name#" overwrite="yes">

    it seems that thd pdf is not great..i noticed that when i opened pdf and resaved it again from adobe reader it worked fine and no locks. So I added this line that rewrites the pdf and it worked fine.

    Thanks