Skip to content

Commit 8ebef13

Browse files
committed
fix-pdf-gen: Replace html2PDF with browser-based pdf generation
turn off transitions
1 parent 7437be1 commit 8ebef13

File tree

1 file changed

+12
-27
lines changed

1 file changed

+12
-27
lines changed

_templates/_page_openshift.html.erb

Lines changed: 12 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,14 @@
1313
<%= (distro_key == "openshift-dpu") ? '<meta name="robots" content="noindex,nofollow">' : '' %>
1414
<%= ((["3.0", "3.1", "3.2", "3.3", "3.4", "3.5", "3.6", "3.7", "3.9", "3.10", "4.1", "4.2", "4.3", "4.4", "4.5"].include?(version)) && distro_key == "openshift-enterprise") ? '<meta name="googlebot" content="noindex">' : '' %>
1515
<title><%= [topic_title, subgroup_title].compact.join(' - ') %> | <%= group_title %> | <%= distro %> <%= version %></title>
16-
<link href="https://assets.openshift.net/content/subdomain.css" rel="stylesheet" type="text/css">
17-
<link href="https://docs.openshift.com/container-platform/4.1/_stylesheets/search.css" rel="stylesheet" />
18-
<link href="https://docs.openshift.com/container-platform/4.1/_stylesheets/autumn.css" rel="stylesheet" />
19-
<link href="https://assets.openshift.net/content/subdomain/touch-icon-precomposed.png" rel="apple-touch-icon-precomposed" type="image/png">
20-
<link href="https://assets.openshift.net/content/subdomain/favicon32x32.png" rel="shortcut icon" type="text/css">
21-
<link href="https://assets.openshift.net/content/osh-nav-footer.css" rel="stylesheet" type="text/css" media="screen, print" />
22-
<link href="https://docs.openshift.com/container-platform/4.1/_stylesheets/docs.css" rel="stylesheet" />
16+
<link href="https://assets.openshift.net/content/subdomain.css" rel="stylesheet" type="text/css"/>
17+
<link href="https://docs.openshift.com/container-platform/4.1/_stylesheets/search.css" rel="stylesheet" media="screen"/>
18+
<link href="https://docs.openshift.com/container-platform/4.1/_stylesheets/autumn.css" rel="stylesheet" media="screen"/>
19+
<link href="https://assets.openshift.net/content/subdomain/touch-icon-precomposed.png" rel="apple-touch-icon-precomposed" type="image/png"/>
20+
<link href="https://assets.openshift.net/content/subdomain/favicon32x32.png" rel="shortcut icon" type="text/css"/>
21+
<link href="https://assets.openshift.net/content/osh-nav-footer.css" rel="stylesheet" type="text/css" media="screen"/>
22+
<link href="https://docs.openshift.com/container-platform/4.1/_stylesheets/docs.css" rel="stylesheet" media="screen"/>
23+
<link href="https://docs.openshift.com/container-platform/4.1/_stylesheets/print.css" rel="stylesheet" type="text/css" media="print"/>
2324
<!--[if IE]><link rel="shortcut icon" href="https://assets.openshift.net/content/subdomain/favicon.ico"><![endif]-->
2425
<!-- or, set /favicon.ico for IE10 win -->
2526
<meta content="OpenShift" name="application-name">
@@ -30,28 +31,10 @@
3031
<script src="//www.redhat.com/dtm.js" type="text/javascript"></script>
3132
<!-- End Adobe DTM -->
3233

33-
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.9.3/html2pdf.bundle.min.js"></script>
34-
3534
<script id="trustarc" src="https://static.redhat.com/libs/redhat/marketing/latest/trustarc/trustarc.js"></script>
3635

3736
<link href="https://fonts.googleapis.com/icon?family=Material+Icons+Outlined"
3837
rel="stylesheet">
39-
<script>
40-
41-
function getPDF() {
42-
var element = document.getElementsByClassName('main');
43-
<%
44-
filepath = repo_path[0...-5]
45-
%>
46-
var opt = {
47-
margin: 10,
48-
filename: '<%= "#{filepath}.pdf" %>',
49-
html2canvas: { windowWidth: 650 },
50-
image: { type: 'jpeg', quality: 0.98 }
51-
};
52-
html2pdf().set(opt).from(element[0]).save();
53-
}
54-
</script>
5538

5639
</head>
5740

@@ -165,7 +148,7 @@
165148
<a href="https://github.com/openshift/openshift-docs/issues/new?title=<%= (distro_key == "openshift-enterprise") ? "[enterprise-#{version}] Issue in file #{repo_path}" : ((distro_key=="openshift-dedicated" ) ? "[dedicated] Issue in file #{repo_path}" : "[online] Issue in file #{repo_path}" ) %>">
166149
<span class="material-icons-outlined" title="Open an issue">bug_report</span>
167150
</a>
168-
<a href="javascript: void(0);" onclick="getPDF();"><span class="material-icons-outlined" title="Download PDF (may take a while for large pages)">picture_as_pdf</span></a>
151+
<a href="javascript: void(0);" onclick="window.print()"><span class="material-icons-outlined" title="Print page (Save as PDF)">picture_as_pdf</span></a>
169152
<% if (version == "4.5") %>
170153
/
171154
<select onchange="selectLang(this);">
@@ -222,6 +205,9 @@
222205
</div>
223206
</div>
224207
</div>
208+
<div class="print-logo">
209+
<img src="https://www.redhat.com/cms/managed-files/Logo-Red_Hat-OpenShift-A-Standard-RGB_0_0.svg" alt="print logo"/>
210+
</div>
225211
<div class="col-xs-12 col-sm-9 col-md-9 main">
226212
<div class="page-header">
227213
<h1>
@@ -587,5 +573,4 @@
587573
</script>
588574

589575
</body>
590-
591576
</html>

0 commit comments

Comments
 (0)