Hello,
I want to use cURL with PHP to compare two PDF files.
I’m passing two PDF files with credentials (Bearer in header request) but it shows me error 400 for format not supported : File of this format doesn’t support comparison. Perhaps you have specified an invalid file extension or the file is damaged.
When it’s not this message, i have this return : CloudFront attempted to establish a connection with the origin, but either the attempt failed or the origin closed the connection. We can’t connect to the server for this app or website at this time. There might be too much traffic or a configuration error. Try again later, or contact the app or website owner.
I have tested the comparison API with sample PDF documents and unable to notice any issue. Please share your sample code along with the source documents. We will investigate the issue and will guide you.
Please confirm are you passing the same file path for source and target file? As I notice if I use the same file path as a source and target file then I get your above reported error. Otherwise, it works fine. Secondly, you need to generate JSON Web Token for request authentication.
I generate JSON Web Token before call API.
I don’t provide the same paths for source and target when calling, there are two separate files :image.png (24.2 KB)
Here are the values provided: {"SourceFile":{"FilePath":"\/comparison\/sources\/d8dc84ac4bdcc7dab418dac479e7f75fce4701973f029c20f2947602c87f93be.pdf"},"TargetFiles":[{"FilePath":"\/comparison\/sources\/c82cde6dc80792a727b43b515f02b033605121033f8dbc96a3f9adfb17583681.pdf"}],"Settings":{"GenerateSummaryPage":true,"ShowDeletedContent":true,"ShowInsertedContent":true,"StyleChangeDetection":true,"HeaderFootersComparison":true},"OutputPath":"\/comparison\/results\/ee1015d4ad789058e87c42a5a3d8332c51983dee6fe29176cce5bf74a9b4bef1.pdf"}
And the response : {"error":{"code":"error","message":"File of this format doesn't support comparison. Perhaps you have specified an invalid file extension or the file is damaged.","description":"Operation Failed.","innerError":{"requestId":null,"date":"2020-10-30T16:25:18.0054653Z"}}}
Thanks for your feedback. I tried your sample PHP code to compare two PDF documents and it is working fine on my end. Are you getting the error message for some specific files or all the files? As the above error looks like file specific issue. Can you please share above mentioned PDF files as well?
<HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<TITLE>ERROR: The request could not be satisfied</TITLE>
</HEAD><BODY>
<H1>504 ERROR</H1>
<H2>The request could not be satisfied.</H2>
<HR noshade size="1px">
CloudFront attempted to establish a connection with the origin, but either the attempt failed or the origin closed the connection.
We can't connect to the server for this app or website at this time. There might be too much traffic or a configuration error. Try again later, or contact the app or website owner.
<BR clear="all">
If you provide content to customers through CloudFront, you can find steps to troubleshoot and help prevent this error by reviewing the CloudFront documentation.
<BR clear="all">
<HR noshade size="1px">
<PRE>
Generated by cloudfront (CloudFront)
Request ID: 8gVDNU0xcd6n_eaxb1DR6fUjNmoZsfDk7wLodfBoPAHMbau2L0KHhA==
</PRE>
<ADDRESS>
</ADDRESS>
</BODY></HTML>
[2020-10-30 17:23:02] local.ERROR: /media/sf_oqto/app/ExternalServices/GroupDocsService.php(line 413) : Status 504 - Erreur lors de la comparaison - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<TITLE>ERROR: The request could not be satisfied</TITLE>
</HEAD><BODY>
<H1>504 ERROR</H1>
<H2>The request could not be satisfied.</H2>
<HR noshade size="1px">
CloudFront attempted to establish a connection with the origin, but either the attempt failed or the origin closed the connection.
We can't connect to the server for this app or website at this time. There might be too much traffic or a configuration error. Try again later, or contact the app or website owner.
<BR clear="all">
If you provide content to customers through CloudFront, you can find steps to troubleshoot and help prevent this error by reviewing the CloudFront documentation.
<BR clear="all">
<HR noshade size="1px">
<PRE>
Generated by cloudfront (CloudFront)
Request ID: 8gVDNU0xcd6n_eaxb1DR6fUjNmoZsfDk7wLodfBoPAHMbau2L0KHhA==
</PRE>
<ADDRESS>
</ADDRESS>
</BODY></HTML>
Thanks for sharing the input files. I have tested again the scenario and getting your above reported exception randomly. So logged a ticket COMPARISONCLOUD-157 for further investigation and rectification. We will update you as soon as it is resolved.
We have investigated your shared PDF documents, but it seems your documents have the wrong PDF signature. These are not detected as a PDF, which is causing the issue.