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.
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
...Copy link to clipboard
Copied
Bump
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.
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 |
Copy link to clipboard
Copied
Your Coldfusion version?
Copy link to clipboard
Copied
Version: 9,0,0,251028
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.
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!
Copy link to clipboard
Copied
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>