@@ -25,16 +36,21 @@ That's it! You can now begin exporting Nuxt 3 components to PDF. For example:
+```
-
-```
+Or use our server side code based approch to define your design! You can learn more about using `nuxt-pdf` on the server side [here](/nuxt-pdf/server-side).
-We offer two separate options parameters, that allow you to customize your pdf export.
+```ts
+// file: ~/server/api/pdf/my-pdf.vue
+import { createPDF, streamReturnPDF } from '#pdf'
+
+export default eventHandler(async (event) => {
+ const pdf = createPDF()
+ pdf.text('Welcome to NuxtPDF!')
+ pdf.end()
-- The `documentOptions`, allow you to customize the general layout of your document. You can find the options [here](http://raw.githack.com/MrRio/jsPDF/master/docs/jsPDF.html).
-- The `htmlOptions`, allow you to customize the conversion of your HTML to a canvas. You can find the options [here](http://raw.githack.com/MrRio/jsPDF/master/docs/module-html.html#~html).
+ return streamReturnPDF(event, pdf)
+})
+```
diff --git a/content/6.nuxt-pdf/1.getting-started/4.getting-help.md b/content/6.nuxt-pdf/1.getting-started/4.getting-help.md
new file mode 100644
index 0000000..385808d
--- /dev/null
+++ b/content/6.nuxt-pdf/1.getting-started/4.getting-help.md
@@ -0,0 +1,15 @@
+---
+description: "How to get help when using `nuxt-pdf` in your Vue / Nuxt 3 application."
+---
+
+# Getting Help
+
+At some point, you may find that there's an issue you need some help with.
+
+But don't worry! We're a friendly community of developers and we'd love to help. Concretely this means to:
+- Checkout the docs (page that you are currently viewing),
+- Search open issues and discussions: https://github.com/sidebase/nuxt-pdf/issues
+- Hop on Discord to ask us directly: https://discord.gg/VzABbVsqAc,
+- Open an issue to file a bug, ask for an enhancement or get an answer to a question: https://github.com/sidebase/nuxt-pdf/issues/new/choose
+
+We aim to follow the getting-help standards of the nuxt-project as described here and ask you to do the same when opening an issue or pinging us for help: https://nuxt.com/docs/community/getting-help#getting-help.
diff --git a/content/6.nuxt-pdf/2.application-side/4.composables.md b/content/6.nuxt-pdf/2.application-side/4.composables.md
new file mode 100644
index 0000000..360cfac
--- /dev/null
+++ b/content/6.nuxt-pdf/2.application-side/4.composables.md
@@ -0,0 +1,75 @@
+# Composables
+
+`nuxt-pdf` exposes multiple composables, that you can access to easily create pdfs through vue code.
+
+## Options
+
+Both of our composables, accept 2 seperate configuration options.
+- The `documentOptions`, allow you to customize the general layout of your document. You can find the options [here](http://raw.githack.com/MrRio/jsPDF/master/docs/jsPDF.html).
+- The `htmlOptions`, allow you to customize the conversion of your HTML to a canvas. You can find the options [here](http://raw.githack.com/MrRio/jsPDF/master/docs/module-html.html#~html).
+
+
+## `exportToPDF`
+
+`exportToPDF` allows you to usea native vue ref, to target either a native HTML element, or a Vue component, which will then be converted into a PDF.
+
+The composable accepts 4 parameters:
+- The fileName
+- The component you wish to convert
+- The documentOptions
+- The HTMLOptions.
+
+To learn more about the options, please refer [here](#options)
+
+```vue
+
+
+
+
+
Hello world!
+
+
+```
+
+### Tips & Tricks
+
+- Ensure that the section you want to export has a fixed width, to ensure the layout does not shift when exporting
+- Setting a fixed width and height, to match your document size, will lead to better results
+- Use the `scale` option in the document section, to slightly increase or decrease the size of the rendered html
+- Optimize your HTML to reduce the PDF file size
+
+## `htmlToPDF`
+
+`htmlToPdf` allows you to pass an HTML string and format it into a PDF. This can allow you to futhur customize the behaviour of how the module interacts with your UI.
+
+```ts
+import { htmlToPdf } from '#imports'
+
+const openInWindow = async (HTMLElement: HTMLElement) => {
+ const pdf = await htmlToPdf(HTMLElement,
+ undefined,
+ {
+ html2canvas: {
+ scale: 0.7,
+ useCORS: true
+ }
+ })
+ const totalPages = pdf.getNumberOfPages()
+ const pdfHeight = pdf.getPageHeight()
+ await pdf.html('
I am a custom pdf!!!', {
+ x: 20,
+ y: (pdfHeight - 50) * totalPages // place in the bottom
+ })
+ const blob = pdf.output('blob')
+ window.open(URL.createObjectURL(blob), '_blank')
+}
+```
diff --git a/content/6.nuxt-pdf/2.application-side/_dir.yml b/content/6.nuxt-pdf/2.application-side/_dir.yml
new file mode 100644
index 0000000..201d148
--- /dev/null
+++ b/content/6.nuxt-pdf/2.application-side/_dir.yml
@@ -0,0 +1,2 @@
+title: Application-Side
+icon: heroicons-outline:computer-desktop
diff --git a/content/6.nuxt-pdf/3.server-side/1.index.md b/content/6.nuxt-pdf/3.server-side/1.index.md
new file mode 100644
index 0000000..0c9d866
--- /dev/null
+++ b/content/6.nuxt-pdf/3.server-side/1.index.md
@@ -0,0 +1,3 @@
+# Introduction
+
+This page is a work in progress. Please have a look at the playground until we get around to these!
diff --git a/content/6.nuxt-pdf/3.server-side/_dir.yml b/content/6.nuxt-pdf/3.server-side/_dir.yml
new file mode 100644
index 0000000..ce2c961
--- /dev/null
+++ b/content/6.nuxt-pdf/3.server-side/_dir.yml
@@ -0,0 +1,2 @@
+title: Server-Side
+icon: heroicons-outline:server