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

cfpdf optimize

Explorer ,
May 28, 2014 May 28, 2014

Copy link to clipboard

Copied

I am uploading pdf files to our server and want to save space.  I am trying to use cfpdf to optimize the file size.  The one I am testing on is 1.25MB, so it's not a big file.  When I reduce it using desktop Acrobat it takes less than 1 second.  When I use Coldfusion it times out after several minutes.

The file is first uploaded to it's own directory, then I use this to try to reduce it.

<cfpdf

    action = "optimize"

    source = "H:\Inetpub\Wwwroot\MySite.com\newsletters\files\#Section#\#issue#.pdf" 

    algo = "bilinear" />

I'm sure it's something I've done wrong, please advise.

Views

1.7K

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 , Jun 04, 2014 Jun 04, 2014

ctreeves wrote:

Thank you, I tried your code to see if I could reduce one file directly on the server as compared to while I am uploading it.  The pdf is not protected and does have many images embedded.

I get this error:

An error occurred during OPTIMIZE operation in the cfpdf tag.

Error: com.adobe.internal.pdftoolkit.core.exceptions.PDFCosParseException: Undefined filter - JPXDecode

In my opinion, you have found a bug in ColdFusion 9. You should create a bug report, attaching the

...

Votes

Translate

Translate
Explorer ,
Jun 02, 2014 Jun 02, 2014

Copy link to clipboard

Copied

Bump 

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 ,
Jun 03, 2014 Jun 03, 2014

Copy link to clipboard

Copied

It should take seconds, not minutes. When I tested, using the following code on a 2MB PDF, it took 8 seconds.

<cfpdf

    action = "optimize"

    source =  "C:\ColdFusion11\cfusion\wwwroot\workspace\cfTest\pdf\myDoc.pdf"

    algo = "bilinear"

    pages = "*"

    destination =  "C:\ColdFusion11\cfusion\wwwroot\workspace\cfTest\pdf\myDoc_optimized.pdf" 

    overwrite = "true">

   Done optimizing.

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 ,
Jun 03, 2014 Jun 03, 2014

Copy link to clipboard

Copied

Thank you, I tried your code to see if I could reduce one file directly on the server as compared to while I am uploading it.  The pdf is not protected and does have many images embedded.

I get this error:

An error occurred during OPTIMIZE operation in the cfpdf tag.

Error: com.adobe.internal.pdftoolkit.core.exceptions.PDFCosParseException: Undefined filter - JPXDecode

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 ,
Jun 04, 2014 Jun 04, 2014

Copy link to clipboard

Copied

Your Coldfusion version?

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 ,
Jun 04, 2014 Jun 04, 2014

Copy link to clipboard

Copied

Version: 9,0,0,251028

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 ,
Jun 04, 2014 Jun 04, 2014

Copy link to clipboard

Copied

ctreeves wrote:

Thank you, I tried your code to see if I could reduce one file directly on the server as compared to while I am uploading it.  The pdf is not protected and does have many images embedded.

I get this error:

An error occurred during OPTIMIZE operation in the cfpdf tag.

Error: com.adobe.internal.pdftoolkit.core.exceptions.PDFCosParseException: Undefined filter - JPXDecode

In my opinion, you have found a bug in ColdFusion 9. You should create a bug report, attaching the PDF file to it.

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 ,
Jun 04, 2014 Jun 04, 2014

Copy link to clipboard

Copied

Thank you, I submitted a bug.  I may be able to migrate to CF10 in the next 6 months to a year, but this is disappointing for now.  Maybe they'll fix my bug today? 

I appreciate your help!

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 ,
Nov 23, 2017 Nov 23, 2017

Copy link to clipboard

Copied

LATEST

Have you tried a PDF "transform" action on your result PDF? I've found this can make a massive difference to the file size. eg:

 

    <cflock name="PerformTransform" timeout="160" throwontimeout="yes" type="exclusive">

        <cfpdf action="GetInfo" name="GetPDFInfo" source="mydocument.pdf" password="ifrequired">

        <cfset NumberOfPages=GetPDFInfo.TotalPages>
   
        <cfloop index="p" from="1" to="#NumberOfPages#" step="1">
   
            <cfpdf action="transform" source="mydocument.pdf" pages="#p#" overwrite="yes" destination="reducedsize.pdf" password="ifrequired">
   
        </cfloop>

    </cflock>

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