Skip to content

Commit ce72bbe

Browse files
committed
Enhance Razor template engine and update API example
- Improved JSON structure in `index.html` API example for clarity. - Changed `pdfOptions` margins from pixels to centimeters.
1 parent ad38abd commit ce72bbe

File tree

2 files changed

+17
-20
lines changed

2 files changed

+17
-20
lines changed

src/PdfSmith.BusinessLayer/Templating/RazorTemplateEngine.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ public async Task<string> RenderAsync(string template, object model, CultureInfo
2929
@using System
3030
@using System.Collections.Generic
3131
@using System.Linq
32+
3233
{template}
3334
""";
3435

src/PdfSmith/wwwroot/index.html

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ <h3>Easy Integration</h3>
7878
<div class="container">
7979
<h2>Quick Start Example</h2>
8080
<p style="text-align: center; margin-bottom: 2rem;">Send a POST request to generate your first PDF:</p>
81-
81+
8282
<div class="code-block">
8383
<strong>Endpoint:</strong> POST /api/pdf<br>
8484
<strong>Content-Type:</strong> application/json<br>
@@ -88,33 +88,29 @@ <h2>Quick Start Example</h2>
8888

8989
<div class="code-block">
9090
<pre><code>{
91-
"template":"&lt;h1&gt;Hello @Model.Name!&lt;/h1&gt;",
92-
"model":{
93-
"Name":"World"
91+
"template": "&lt;h1&gt;Hello @Model.Name!&lt;/h1&gt;",
92+
"model": {
93+
"Name": "World"
9494
},
95-
"templateEngine":"razor",
96-
"pdfOptions":{
97-
"margin":{
98-
"top":"20",
99-
"bottom":"20",
100-
"left":"20",
101-
"right":"20"
95+
"templateEngine": "razor",
96+
"pdfOptions": {
97+
"margin": {
98+
"top": "2.5cm",
99+
"bottom": "2cm",
100+
"left": "2.5cm",
101+
"right": "2.5cm"
102102
}
103103
}
104104
}</code></pre>
105105
</div>
106106

107-
<div style="text-align: center; margin-top: 2rem;">
108-
<a href="/swagger" class="btn btn-primary">Try it in Swagger UI</a>
109-
</div>
110-
</div>
111-
</section>
112-
113-
<section id="api-key" class="api-example">
114-
<div class="container">
115107
<div class="api-key-notice">
116108
<p>🔑 <strong>Want to try PDF Smith?</strong> Request your API key by filling out our form at <a href="https://tinyurl.com/pdfsmith-apikeyrequest" target="_blank" rel="noopener noreferrer">tinyurl.com/pdfsmith-apikeyrequest</a></p>
117109
</div>
110+
111+
<div style="text-align: center; margin-top: 2rem;">
112+
<a href="/swagger" class="btn btn-primary">If you already have a key, try it in Swagger UI</a>
113+
</div>
118114
</div>
119115
</section>
120116
</main>
@@ -146,7 +142,7 @@ <h2>Quick Start Example</h2>
146142
card.addEventListener('mouseenter', function() {
147143
this.style.transform = 'translateY(-10px) scale(1.02)';
148144
});
149-
145+
150146
card.addEventListener('mouseleave', function() {
151147
this.style.transform = 'translateY(0) scale(1)';
152148
});

0 commit comments

Comments
 (0)