Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import app from "../../pdf_munk.app.mjs";

export default {
key: "pdf_munk-capture-website-screenshot-into-image",
name: "Capture Website Screenshot into Image",
description: "Capture Screenshot of a Website URL into an image. [See documentation](https://pdfmunk.com/api-docs#:~:text=Image%20Generation)",
version: "0.0.1",
type: "action",
props: {
app,
url: {
type: "string",
label: "Website URL",
description: "The URL of the website to capture as a screenshot",
},
},
async run({ $ }) {
const { url } = this;

const response = await this.app.captureWebsiteScreenshot({
$,
url,
});

$.export("$summary", `Successfully captured screenshot of ${url}`);
return response;
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
import app from "../../pdf_munk.app.mjs";

export default {
key: "pdf_munk-capture-website-screenshot-into-pdf",
name: "Capture Website Screenshot into PDF",
description: "Converts a URL to a PDF file with customizable options. [See documentation](https://pdfmunk.com/api-docs#:~:text=Operations%20related%20to%20PDF)",
version: "0.0.1",
type: "action",
props: {
app,
url: {
type: "string",
label: "Website URL",
description: "The URL of the website to convert to PDF",
},
paper_size: {
type: "string",
label: "Paper Size",
description: "The paper size for the PDF",
options: [
{
label: "A4",
value: "A4",
},
{
label: "A3",
value: "A3",
},
{
label: "A5",
value: "A5",
},
{
label: "Letter",
value: "Letter",
},
{
label: "Legal",
value: "Legal",
},
{
label: "Tabloid",
value: "Tabloid",
},
],
default: "A4",
},
landscape: {
type: "boolean",
label: "Landscape",
description: "Whether to use landscape orientation",
default: false,
},
displayHeaderFooter: {
type: "boolean",
label: "Display Header Footer",
description: "Whether to display header and footer",
default: false,
},
page_size: {
type: "integer",
label: "Page Size",
description: "The page size in points",
default: 5,
},
printBackground: {
type: "boolean",
label: "Print Background",
description: "Whether to print background graphics",
default: true,
},
},
async run({ $ }) {
const {
url,
paper_size,
landscape,
displayHeaderFooter,
page_size,
printBackground,
} = this;

const response = await this.app.captureWebsiteToPdf({
$,
url,
paper_size,
landscape,
displayHeaderFooter,
page_size,
printBackground,
});

$.export("$summary", `Successfully converted ${url} to PDF`);
return response;
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import app from "../../pdf_munk.app.mjs";

export default {
key: "pdf_munk-convert-html-to-image",
name: "Convert HTML to Image",
description: "Converts HTML/CSS content to an image. [See documentation](https://pdfmunk.com/api-docs#:~:text=Image%20Generation)",
version: "0.0.1",
type: "action",
props: {
app,
html_content: {
type: "string",
label: "HTML Content",
description: "The HTML content to convert to an image",
},
css_content: {
type: "string",
label: "CSS Content",
description: "The CSS content to style the HTML",
optional: true,
},
width: {
type: "integer",
label: "Width",
description: "The width of the generated image in pixels",
default: 800,
},
height: {
type: "integer",
label: "Height",
description: "The height of the generated image in pixels",
default: 600,
},
},
async run({ $ }) {
const {
html_content,
css_content,
width,
height,
} = this;

const response = await this.app.convertHtmlToImage({
$,
html_content,
css_content,
width,
height,
});

$.export("$summary", "Successfully converted HTML to image");
return response;
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
import app from "../../pdf_munk.app.mjs";

export default {
key: "pdf_munk-convert-html-to-pdf",
name: "Convert HTML to PDF",
description: "Converts HTML/CSS content to a PDF file with customizable options. [See documentation](https://pdfmunk.com/api-docs#:~:text=Operations%20related%20to%20PDF)",
version: "0.0.1",
type: "action",
props: {
app,
html_content: {
type: "string",
label: "HTML Content",
description: "The HTML content to convert to PDF",
},
css_content: {
type: "string",
label: "CSS Content",
description: "The CSS content to style the HTML",
optional: true,
},
paper_size: {
type: "string",
label: "Paper Size",
description: "The paper size for the PDF",
options: [
{
label: "A4",
value: "A4",
},
{
label: "A3",
value: "A3",
},
{
label: "A5",
value: "A5",
},
{
label: "Letter",
value: "Letter",
},
{
label: "Legal",
value: "Legal",
},
{
label: "Tabloid",
value: "Tabloid",
},
],
default: "A4",
},
page_size: {
type: "integer",
label: "Page Size",
description: "The page size in points",
default: 2,
},
},
async run({ $ }) {
const {
html_content,
css_content,
paper_size,
page_size,
} = this;

const response = await this.app.convertHtmlToPdf({
$,
html_content,
css_content,
paper_size,
page_size,
});

$.export("$summary", "Successfully converted HTML to PDF");
return response;
},
};
7 changes: 5 additions & 2 deletions components/pdf_munk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/pdf_munk",
"version": "0.0.1",
"version": "0.1.0",
"description": "Pipedream PDF Munk Components",
"main": "pdf_munk.app.mjs",
"keywords": [
Expand All @@ -11,5 +11,8 @@
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
"publishConfig": {
"access": "public"
},
"dependencies": {
"@pipedream/platform": "^3.1.0"
}
}
}
Loading
Loading