You’re trying to convert an HTML file into a PDF in Landscape mode, but the output is stuck in Portrait—even after explicitly setting the "orientation": "landscape"
parameter.
Why This Happens
This issue typically occurs because the HTML contains <style>
tags that override the default orientation settings used by the PDF rendering engine. These styles often come from Microsoft Outlook or similar HTML generators, which embed formatting inside <style>
elements in the head and body of the HTML.
How to Fix It
To correct the page orientation issue, follow these steps:
Step 1: Clean the HTML
Remove the <style>
elements that may be interfering with layout rendering. These are usually found in HTML files exported from tools like Microsoft Word, Outlook, or email editors.
HTML with <style>
(causes error):
<html xmlns:v=3D"urn:schemas-microsoft-com:vml" xmlns:o=3D"urn:schemas-micr=
osoft-com:office:office" xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:x=3D"urn:schemas-microsoft-com:office:excel" xmlns:m=3D"http://schema=
s.microsoft.com/office/2004/12/omml" xmlns=3D"http://www.w3.org/TR/REC-html=
40"><head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Diso-8859-=
2">
<meta name=3D"Generator" content=3D"Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
span.E-mailStijl17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext=3D"edit">
<o:idmap v:ext=3D"edit" data=3D"1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=3D"NL" link=3D"#0563C1" vlink=3D"#954F72">
Cleaned HTML (fixes the error):
Simply remove or skip the <style>
section entirely so the orientation setting works correctly:
<html xmlns:v=3D"urn:schemas-microsoft-com:vml" xmlns:o=3D"urn:schemas-micr=
osoft-com:office:office" xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:x=3D"urn:schemas-microsoft-com:office:excel" xmlns:m=3D"http://schema=
s.microsoft.com/office/2004/12/omml" xmlns=3D"http://www.w3.org/TR/REC-html=
40"><head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Diso-8859-=
2">
<meta name=3D"Generator" content=3D"Microsoft Word 15 (filtered medium)">
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext=3D"edit">
<o:idmap v:ext=3D"edit" data=3D"1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=3D"NL" link=3D"#0563C1" vlink=3D"#954F72">
Step 2: Use Profile Parameters to Automate the Cleanup
Instead of manually editing HTML, use PDF.co profile parameters to automatically remove conflicting styles:
"profiles": "{ \"removeHTMLHeadStyleTags\":\"true\", \"removeHTMLBodyStyleTags\":\"true\" }"
This tells PDF.co to strip out <style>
tags from the HTML before rendering the PDF.
Zapier: Use “Profiles” field in the PDF.co module
Make: Set profile params in the action settings
Postman or Other Clients: Add the
profiles
field to your JSON request body
Helpful Tips
Always check for embedded styles when using HTML from email tools or Word processors.+
Landscape mode works reliably with clean HTML or by using the profile filters.
Test your HTML using simple editors like Notepad++ or CodePen to preview layout.