-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CSS not included in converted document #50
Comments
You need to include the stylesheet parameter set to retro.css unless you're
strictly going from HTML to PDF.
See the first example here: https://docverter.com/api/
…On Thu, Dec 22, 2016 at 6:44 PM Bryson Reece ***@***.***> wrote:
I'm currently accessing the Docverter API via cURL to convert some
documents, like so:
$url = 'http://c.docverter.com/convert';
$fields = array(
'from' => $_POST["inputButton"],
'to' => $_POST["outputButton"],
'input_files[]' => "@/" . $uploadedFilePath,
'other_files[]' => ***@***.***"
);
//open connection
$ch = curl_init();
//set options
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-type: multipart/form-data"));
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); //needed so that the $result=curl_exec() output is the file and isn't just true/false
//execute POST
$result = curl_exec($ch);
//close connection
curl_close($ch);
//write to file
$convertedFile = fopen($convertedFilePath, 'w');
fwrite($convertedFile, $result);
fclose($convertedFile);
*Note:* retro.css is located in the same directory as this page and
to/from values are determine from the POST values of two separate buttons.
However, no matter what formats I try to convert from/to, the CSS contents
of retro.css are never included in the converted document.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#50>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAA2mdMdb4YSmj1vUSGgE80SiirHLL7eks5rKwtMgaJpZM4LUeSK>
.
|
Changing my $fields array to
still fails for HTML -> PDF. My documents gets converted, however no CSS styling is included. |
You misunderstand. Your first fields array was correct but you need to add
another field named stylesheet set to "retro.css". So you'd have from and
to set to your post params, input_files[] set to your upload, other_files[]
how you have it, and stylesheet = "retro.css"
…On Thu, Dec 22, 2016 at 7:09 PM Bryson Reece ***@***.***> wrote:
Changing my $fields array to
$fields = array(
'from' => $_POST["inputButton"],
'to' => $_POST["outputButton"],
'css' => "retro.css", // or @retro.css
'input_files[]' => "@/" . $uploadedFilePath,
'other_files[]' => ***@***.***"
);
still fails. My documents gets converted, how no CSS styling is included.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#50 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAA2mdh7yLDwKctRb_7Y31Jpz1M9HfA4ks5rKxEygaJpZM4LUeSK>
.
|
Like so?
My second example seemed to work when converting Markdown -> PDF, however this example is returning an error when going from Markdown -> PDF and still not including styling when going from HTML -> PDF. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm currently accessing the Docverter API via cURL to convert some documents, like so:
Note: retro.css is located in the same directory as this page and to/from values are determined from the POST values of two separate buttons.
However, no matter what formats I try to convert from/to, the CSS contents of retro.css are never included in the converted document.
The text was updated successfully, but these errors were encountered: