[{"data":1,"prerenderedAt":12059},["Reactive",2],{"/guides/node/superagent":3},[4,68,311,474,584,651,682,775,831,928,1058,1101,1145,1186,1232,1401,1499,1589,1698,1735,1836,2003,2043,2236,2371,2470,2525,2552,2631,2677,2759,2867,2904,2945,2982,3023,3168,3251,3327,3420,3451,3537,3679,3719,3912,4047,4146,4201,4228,4307,4353,4435,4543,4580,4621,4658,4699,4844,4927,5003,5096,5127,5213,5355,5395,5588,5723,5822,5877,5904,5983,6029,6111,6219,6256,6297,6334,6375,6520,6603,6679,6772,6803,6889,7031,7071,7264,7399,7498,7553,7580,7659,7705,7787,7895,7932,7973,8010,8051,8196,8279,8355,8448,8479,8565,8707,8747,8940,9075,9174,9229,9256,9335,9381,9463,9571,9608,9649,9686,9727,9872,9955,10031,10124,10155,10241,10383,10423,10616,10751,10850,10905,10932,11011,11057,11139,11247,11284,11325,11362,11403,11548,11631,11707,11800,11831,11917],{"_path":5,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":9,"description":10,"language":11,"library":12,"property":13,"output":14,"related":15,"default":18,"body":19,"_type":63,"_id":64,"_source":65,"_file":66,"_extension":67},"/guides/node/axios/accessing-secured-pages","axios",false,"","Accessing secured pages","Learn how to access secured pages using Node and the Axios library. This guide offers detailed steps with code samples in Node and the Axios library, highlighting how you can acces page protected by basic authentication to convert them to PDF using PDFShift's API.","Node","Axios","auth","pdf",[16,17],"send-custom-http-headers","using-cookies",true,{"type":20,"children":21,"toc":60},"root",[22,30,43,55],{"type":23,"tag":24,"props":25,"children":26},"element","p",{},[27],{"type":28,"value":29},"text","In this guide, we'll show you how to access secured page (protected by basic authentication) using Node and the Axios library to convert them to PDF using PDFShift's API.",{"type":23,"tag":24,"props":31,"children":32},{},[33,35,41],{"type":28,"value":34},"When you're converting a document, you might want to access a secured page (protected by basic authentication) to convert it to PDF. This can be done by setting the ",{"type":23,"tag":36,"props":37,"children":39},"code",{"className":38},[],[40],{"type":28,"value":13},{"type":28,"value":42}," parameter to the request.",{"type":23,"tag":44,"props":45,"children":50},"pre",{"className":46,"code":48,"language":49,"meta":8},[47],"language-javascript","const axios = require('axios');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    // You can set a basic authentication by passing the \"auth\" property which contains a username and password\n    auth: {\n        username: 'user',\n        password: 'password'\n    }\n}\n\nconst response = await axios.post(\n    `https://api.pdfshift.io/v3/convert/pdf`,\n    params,\n    {\n        headers: { 'X-API-Key': api_key }\n    }\n});\n\n// Handle errors:\nif (response.status >= 400) {\n    throw new Error(`Request failed with status code ${response.status}: ${response.data}`);\n}\n\nfs.writeFileSync('result.pdf', response.data);\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n","javascript",[51],{"type":23,"tag":36,"props":52,"children":53},{"__ignoreMap":8},[54],{"type":28,"value":48},{"type":23,"tag":24,"props":56,"children":57},{},[58],{"type":28,"value":59},"This allows you to protect your documents from any visitors while allowing PDFShift to access the page and convert it to PDF.",{"title":8,"searchDepth":61,"depth":61,"links":62},2,[],"markdown","content:guides:node:axios:accessing-secured-pages.md","content","guides/node/axios/accessing-secured-pages.md","md",{"_path":69,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":70,"description":71,"language":11,"library":12,"property":72,"output":14,"related":73,"default":18,"body":78,"_type":63,"_id":309,"_source":65,"_file":310,"_extension":67},"/guides/node/axios/adding-a-custom-header-or-footer","Adding a custom header or footer","Discover how to add custom headers or footers to a PDF using Node and the Axios library. This in-depth guide includes Node codes that you can easily follow and quickly generate documents with PDFShift's API.","header",[74,75,76,77],"loading-css-from-a-string","loading-css-from-a-url","loading-javascript-from-a-string","loading-javascript-from-a-url",{"type":20,"children":79,"toc":307},[80,85,113,125,195,206,211,220,231,236,302],{"type":23,"tag":24,"props":81,"children":82},{},[83],{"type":28,"value":84},"In this guide, we'll show you how to add custom headers or footers to a PDF using Node and the Axios library.",{"type":23,"tag":24,"props":86,"children":87},{},[88,90,95,97,103,105,111],{"type":28,"value":89},"We'll focus this guide on the ",{"type":23,"tag":36,"props":91,"children":93},{"className":92},[],[94],{"type":28,"value":72},{"type":28,"value":96}," parameter, but know that the ",{"type":23,"tag":36,"props":98,"children":100},{"className":99},[],[101],{"type":28,"value":102},"footer",{"type":28,"value":104}," parameter works ",{"type":23,"tag":106,"props":107,"children":108},"em",{},[109],{"type":28,"value":110},"exactly",{"type":28,"value":112}," the same way.",{"type":23,"tag":24,"props":114,"children":115},{},[116,118,123],{"type":28,"value":117},"The ",{"type":23,"tag":36,"props":119,"children":121},{"className":120},[],[122],{"type":28,"value":72},{"type":28,"value":124}," parameter is an object that accepts the following parameters:",{"type":23,"tag":126,"props":127,"children":128},"ul",{},[129,141,184],{"type":23,"tag":130,"props":131,"children":132},"li",{},[133,139],{"type":23,"tag":36,"props":134,"children":136},{"className":135},[],[137],{"type":28,"value":138},"source",{"type":28,"value":140},": The source of the header. It can be a URL or a raw HTML document. You can also provide some variables that we'll explain at the bottom of this guide.",{"type":23,"tag":130,"props":142,"children":143},{},[144,150,152,158,160,166,168,174,176,182],{"type":23,"tag":36,"props":145,"children":147},{"className":146},[],[148],{"type":28,"value":149},"height",{"type":28,"value":151},": The height of the header. By default, the height is in pixels, but you can also use ",{"type":23,"tag":36,"props":153,"children":155},{"className":154},[],[156],{"type":28,"value":157},"mm",{"type":28,"value":159},", ",{"type":23,"tag":36,"props":161,"children":163},{"className":162},[],[164],{"type":28,"value":165},"cm",{"type":28,"value":167}," or ",{"type":23,"tag":36,"props":169,"children":171},{"className":170},[],[172],{"type":28,"value":173},"in",{"type":28,"value":175}," as units, like ",{"type":23,"tag":36,"props":177,"children":179},{"className":178},[],[180],{"type":28,"value":181},"10mm",{"type":28,"value":183},".",{"type":23,"tag":130,"props":185,"children":186},{},[187,193],{"type":23,"tag":36,"props":188,"children":190},{"className":189},[],[191],{"type":28,"value":192},"start_at",{"type":28,"value":194},": The page number where the header should start. By default, the header will start at the first page.",{"type":23,"tag":24,"props":196,"children":197},{},[198,204],{"type":23,"tag":199,"props":200,"children":201},"strong",{},[202],{"type":28,"value":203},"NOTE",{"type":28,"value":205},": You must provide the full data in the header/footer, and not via a network request. Loading files such as external CSS, Js or Fonts won't work in the header or footer.\nInstead, we recommend you to embed them in Base64.",{"type":23,"tag":24,"props":207,"children":208},{},[209],{"type":28,"value":210},"Here's an example:",{"type":23,"tag":44,"props":212,"children":215},{"className":213,"code":214,"language":49,"meta":8},[47],"const axios = require('axios');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://en.wikipedia.org/wiki/PDF',\n    header: {\n        source: '\u003Cdiv>Page {{ page }} over a total of {{ total }}. Made on {{ date }}\u003C/div>',\n        height: 150,\n        start_at: 2\n    }\n}\n\nconst response = await axios.post(\n    `https://api.pdfshift.io/v3/convert/pdf`,\n    params,\n    {\n        headers: { 'X-API-Key': api_key }\n    }\n});\n\n// Handle errors:\nif (response.status >= 400) {\n    throw new Error(`Request failed with status code ${response.status}: ${response.data}`);\n}\n\nfs.writeFileSync('result.pdf', response.data);\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[216],{"type":23,"tag":36,"props":217,"children":218},{"__ignoreMap":8},[219],{"type":28,"value":214},{"type":23,"tag":24,"props":221,"children":222},{},[223,224,229],{"type":28,"value":117},{"type":23,"tag":36,"props":225,"children":227},{"className":226},[],[228],{"type":28,"value":138},{"type":28,"value":230}," parameter present in the header/footer accepts a set of variables that will be translated when converting the document.",{"type":23,"tag":24,"props":232,"children":233},{},[234],{"type":28,"value":235},"Here are the properties you can use:",{"type":23,"tag":126,"props":237,"children":238},{},[239,250,261,272,283],{"type":23,"tag":130,"props":240,"children":241},{},[242,248],{"type":23,"tag":36,"props":243,"children":245},{"className":244},[],[246],{"type":28,"value":247},"{{ title }}",{"type":28,"value":249},": The title of the document.",{"type":23,"tag":130,"props":251,"children":252},{},[253,259],{"type":23,"tag":36,"props":254,"children":256},{"className":255},[],[257],{"type":28,"value":258},"{{ url }}",{"type":28,"value":260},": The URL of the document.",{"type":23,"tag":130,"props":262,"children":263},{},[264,270],{"type":23,"tag":36,"props":265,"children":267},{"className":266},[],[268],{"type":28,"value":269},"{{ page }}",{"type":28,"value":271},": The current page number.",{"type":23,"tag":130,"props":273,"children":274},{},[275,281],{"type":23,"tag":36,"props":276,"children":278},{"className":277},[],[279],{"type":28,"value":280},"{{ total }}",{"type":28,"value":282},": The total number of pages in the document.",{"type":23,"tag":130,"props":284,"children":285},{},[286,292,294,300],{"type":23,"tag":36,"props":287,"children":289},{"className":288},[],[290],{"type":28,"value":291},"{{ date }}",{"type":28,"value":293},": The current date in the format ",{"type":23,"tag":36,"props":295,"children":297},{"className":296},[],[298],{"type":28,"value":299},"M/D/YY-H:MM am/pm",{"type":28,"value":301}," such as \"3/16/24, 2:04 PM\".",{"type":23,"tag":24,"props":303,"children":304},{},[305],{"type":28,"value":306},"This will allow you to generate a document that looks more like a printable version of a website, with page number and customized header and footer.",{"title":8,"searchDepth":61,"depth":61,"links":308},[],"content:guides:node:axios:adding-a-custom-header-or-footer.md","guides/node/axios/adding-a-custom-header-or-footer.md",{"_path":312,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":313,"description":314,"language":11,"library":12,"property":315,"output":14,"related":316,"default":18,"body":319,"_type":63,"_id":472,"_source":65,"_file":473,"_extension":67},"/guides/node/axios/adding-a-text-watermark","Adding a text watermark","Learn how to add text watermarks to your generated PDF document using Node and the Axios library. With this guide, you'll be able to add watermarks on top of your generated PDFs easily with a quick request to PDFShift's API.","watermark",[317,318],"adding-an-image-watermark","protecting-the-generated-pdf",{"type":20,"children":320,"toc":470},[321,326,338,347,352,421,426,451,456,461],{"type":23,"tag":24,"props":322,"children":323},{},[324],{"type":28,"value":325},"In this guide, we'll walk you through the process of adding text watermarks to your PDF files, using PDFShift's API.",{"type":23,"tag":24,"props":327,"children":328},{},[329,331,336],{"type":28,"value":330},"Adding a watermark to your PDF can be done by adding the ",{"type":23,"tag":36,"props":332,"children":334},{"className":333},[],[335],{"type":28,"value":315},{"type":28,"value":337}," object to your query. Adding a text allows you to customize its content and PDFShift's API provides a few properties to help you customize the visual aspect, such as the font size, color, and position.",{"type":23,"tag":44,"props":339,"children":342},{"className":340,"code":341,"language":49,"meta":8},[47],"const axios = require('axios');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    watermark: {\n        text: 'PROTECTED DOCUMENT',\n        offset_x: 'center',\n        offset_top: 'top'\n    }\n}\n\nconst response = await axios.post(\n    `https://api.pdfshift.io/v3/convert/pdf`,\n    params,\n    {\n        headers: { 'X-API-Key': api_key }\n    }\n});\n\n// Handle errors:\nif (response.status >= 400) {\n    throw new Error(`Request failed with status code ${response.status}: ${response.data}`);\n}\n\nfs.writeFileSync('result.pdf', response.data);\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[343],{"type":23,"tag":36,"props":344,"children":345},{"__ignoreMap":8},[346],{"type":28,"value":341},{"type":23,"tag":24,"props":348,"children":349},{},[350],{"type":28,"value":351},"You can customize the text watermark by applying the following properties:",{"type":23,"tag":126,"props":353,"children":354},{},[355,366,377,388,399,410],{"type":23,"tag":130,"props":356,"children":357},{},[358,364],{"type":23,"tag":36,"props":359,"children":361},{"className":360},[],[362],{"type":28,"value":363},"font_size",{"type":28,"value":365},": The size of the text. An integer value in pixels. Defaults to 16.",{"type":23,"tag":130,"props":367,"children":368},{},[369,375],{"type":23,"tag":36,"props":370,"children":372},{"className":371},[],[373],{"type":28,"value":374},"font_family",{"type":28,"value":376}," : The font family to be used. Defaults to Helvetica.",{"type":23,"tag":130,"props":378,"children":379},{},[380,386],{"type":23,"tag":36,"props":381,"children":383},{"className":382},[],[384],{"type":28,"value":385},"font_color",{"type":28,"value":387}," : The color of the text. A hexadecimal color value. Defaults to '000000'.",{"type":23,"tag":130,"props":389,"children":390},{},[391,397],{"type":23,"tag":36,"props":392,"children":394},{"className":393},[],[395],{"type":28,"value":396},"font_opacity",{"type":28,"value":398}," : The opacity of the text. A float value between 0 and 100. Defaults to 100.",{"type":23,"tag":130,"props":400,"children":401},{},[402,408],{"type":23,"tag":36,"props":403,"children":405},{"className":404},[],[406],{"type":28,"value":407},"font_bold",{"type":28,"value":409},": A boolean to set the text as bold. Defaults to false.",{"type":23,"tag":130,"props":411,"children":412},{},[413,419],{"type":23,"tag":36,"props":414,"children":416},{"className":415},[],[417],{"type":28,"value":418},"font_italic",{"type":28,"value":420},": A boolean to set the text as italic. Defaults to false.",{"type":23,"tag":24,"props":422,"children":423},{},[424],{"type":28,"value":425},"You can also customize the position of the text watermark by applying the following properties:",{"type":23,"tag":126,"props":427,"children":428},{},[429,440],{"type":23,"tag":130,"props":430,"children":431},{},[432,438],{"type":23,"tag":36,"props":433,"children":435},{"className":434},[],[436],{"type":28,"value":437},"offset_x",{"type":28,"value":439},": The horizontal position of the text. Can be 'left', 'center', 'right', or a specific value in pixels. Defaults to 'center'.",{"type":23,"tag":130,"props":441,"children":442},{},[443,449],{"type":23,"tag":36,"props":444,"children":446},{"className":445},[],[447],{"type":28,"value":448},"offset_y",{"type":28,"value":450},": The vertical position of the text. Can be 'top', 'middle', 'bottom', or a specific value in pixels. Defaults to 'center'.",{"type":23,"tag":24,"props":452,"children":453},{},[454],{"type":28,"value":455},"For the offset positions, we accept a value in integer which will be translated to pixels, but you can also pass a unit such as 'px', 'in', 'cm', 'mm', 'pt'.",{"type":23,"tag":24,"props":457,"children":458},{},[459],{"type":28,"value":460},"For example:",{"type":23,"tag":44,"props":462,"children":465},{"className":463,"code":464,"language":49,"meta":8},[47],"params = {\n    \"source\": \"https://www.example.com\",\n    \"watermark\": {\n        \"text\": \"PROTECTED DOCUMENT\",\n        \"offset_x\": \"5cm\",\n        \"offset_top\": \"15mm\"\n    }\n}\n",[466],{"type":23,"tag":36,"props":467,"children":468},{"__ignoreMap":8},[469],{"type":28,"value":464},{"title":8,"searchDepth":61,"depth":61,"links":471},[],"content:guides:node:axios:adding-a-text-watermark.md","guides/node/axios/adding-a-text-watermark.md",{"_path":475,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":476,"description":477,"language":11,"library":12,"property":315,"output":14,"related":478,"default":18,"body":480,"_type":63,"_id":582,"_source":65,"_file":583,"_extension":67},"/guides/node/axios/adding-an-image-watermark","Adding an image watermark","Discover how to effortlessly add image watermarks to PDFs using Node and the Axios library. Our guide shows you how to add images on top of your PDF to protect your document easily. This is easily done with a simple request to PDFShift's API.",[318,479],"adding-a-text-watermark",{"type":20,"children":481,"toc":580},[482,486,497,506,511,524,537,541,562,566,570],{"type":23,"tag":24,"props":483,"children":484},{},[485],{"type":28,"value":325},{"type":23,"tag":24,"props":487,"children":488},{},[489,490,495],{"type":28,"value":330},{"type":23,"tag":36,"props":491,"children":493},{"className":492},[],[494],{"type":28,"value":315},{"type":28,"value":496}," object to your query.\nThe advantage of providing an image is that you can add a visual stamp on top of each of your pages that are generated through PDFShift.",{"type":23,"tag":44,"props":498,"children":501},{"className":499,"code":500,"language":49,"meta":8},[47],"const axios = require('axios');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    watermark: {\n        image: 'https://placekitten.com/200/300',\n        offset_x: 'center',\n        offset_top: 'top'\n    }\n}\n\nconst response = await axios.post(\n    `https://api.pdfshift.io/v3/convert/pdf`,\n    params,\n    {\n        headers: { 'X-API-Key': api_key }\n    }\n});\n\n// Handle errors:\nif (response.status >= 400) {\n    throw new Error(`Request failed with status code ${response.status}: ${response.data}`);\n}\n\nfs.writeFileSync('result.pdf', response.data);\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[502],{"type":23,"tag":36,"props":503,"children":504},{"__ignoreMap":8},[505],{"type":28,"value":500},{"type":23,"tag":24,"props":507,"children":508},{},[509],{"type":28,"value":510},"The \"image\" parameter for the watermark can be used in two different values:",{"type":23,"tag":126,"props":512,"children":513},{},[514,519],{"type":23,"tag":130,"props":515,"children":516},{},[517],{"type":28,"value":518},"URL : A full URL to an image that will be used as the watermark.",{"type":23,"tag":130,"props":520,"children":521},{},[522],{"type":28,"value":523},"Base64 : A base64 encoded image that will be used as the watermark.",{"type":23,"tag":24,"props":525,"children":526},{},[527,529,535],{"type":28,"value":528},"Note that you can also rotate the image by passing the ",{"type":23,"tag":36,"props":530,"children":532},{"className":531},[],[533],{"type":28,"value":534},"rotate",{"type":28,"value":536}," parameter as a degree (or negative degree)",{"type":23,"tag":24,"props":538,"children":539},{},[540],{"type":28,"value":425},{"type":23,"tag":126,"props":542,"children":543},{},[544,553],{"type":23,"tag":130,"props":545,"children":546},{},[547,552],{"type":23,"tag":36,"props":548,"children":550},{"className":549},[],[551],{"type":28,"value":437},{"type":28,"value":439},{"type":23,"tag":130,"props":554,"children":555},{},[556,561],{"type":23,"tag":36,"props":557,"children":559},{"className":558},[],[560],{"type":28,"value":448},{"type":28,"value":450},{"type":23,"tag":24,"props":563,"children":564},{},[565],{"type":28,"value":455},{"type":23,"tag":24,"props":567,"children":568},{},[569],{"type":28,"value":460},{"type":23,"tag":44,"props":571,"children":575},{"className":572,"code":464,"language":574,"meta":8},[573],"language-json","json",[576],{"type":23,"tag":36,"props":577,"children":578},{"__ignoreMap":8},[579],{"type":28,"value":464},{"title":8,"searchDepth":61,"depth":61,"links":581},[],"content:guides:node:axios:adding-an-image-watermark.md","guides/node/axios/adding-an-image-watermark.md",{"_path":585,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":586,"description":587,"language":11,"library":12,"property":588,"output":14,"related":589,"default":18,"body":591,"_type":63,"_id":649,"_source":65,"_file":650,"_extension":67},"/guides/node/axios/avoid-conversion-on-error","Avoid the conversion on error when loading the document","Learn how to avoid the conversion on error when loading the document using Node and the Axios library and relies on the PDFShift's API.","raise_for_status",[590],"convert-html-to-pdf-from-raw-html",{"type":20,"children":592,"toc":647},[593,598,618,627],{"type":23,"tag":24,"props":594,"children":595},{},[596],{"type":28,"value":597},"In this guide, we'll show you how to abort the conversion when loading the distant source does not return a 2XX response.",{"type":23,"tag":24,"props":599,"children":600},{},[601,603,608,610,616],{"type":28,"value":602},"When you're converting a document, you might want to avoid the conversion on error when loading the document. This can be done by setting the ",{"type":23,"tag":36,"props":604,"children":606},{"className":605},[],[607],{"type":28,"value":588},{"type":28,"value":609}," parameter to ",{"type":23,"tag":36,"props":611,"children":613},{"className":612},[],[614],{"type":28,"value":615},"True",{"type":28,"value":617}," in the request.",{"type":23,"tag":44,"props":619,"children":622},{"className":620,"code":621,"language":49,"meta":8},[47],"const axios = require('axios');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.httpstat.us/404',\n    raise_for_status: True\n}\n\nconst response = await axios.post(\n    `https://api.pdfshift.io/v3/convert/pdf`,\n    params,\n    {\n        headers: { 'X-API-Key': api_key }\n    }\n});\n\n// Handle errors:\nif (response.status >= 400) {\n    throw new Error(`Request failed with status code ${response.status}: ${response.data}`);\n}\n\nfs.writeFileSync('result.pdf', response.data);\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[623],{"type":23,"tag":36,"props":624,"children":625},{"__ignoreMap":8},[626],{"type":28,"value":621},{"type":23,"tag":24,"props":628,"children":629},{},[630,632,637,639,645],{"type":28,"value":631},"Passing ",{"type":23,"tag":36,"props":633,"children":635},{"className":634},[],[636],{"type":28,"value":588},{"type":28,"value":638}," to ",{"type":23,"tag":36,"props":640,"children":642},{"className":641},[],[643],{"type":28,"value":644},"true",{"type":28,"value":646}," will ensure that if PDFShift can not load your document, the conversion will fail with an error.",{"title":8,"searchDepth":61,"depth":61,"links":648},[],"content:guides:node:axios:avoid-conversion-on-error.md","guides/node/axios/avoid-conversion-on-error.md",{"_path":652,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":653,"description":654,"language":11,"library":12,"property":138,"output":14,"related":655,"default":18,"body":657,"_type":63,"_id":680,"_source":65,"_file":681,"_extension":67},"/guides/node/axios/convert-html-to-pdf-from-a-url","Convert an HTML document to PDF from a URL","Learn how to easily convert HTML documents to PDF from a URL using Node and the Axios library. This how-to guide offers clear Node code examples that show developers how to implement this using the PDFShift API.",[590,656],"avoid-conversion-on-error",{"type":20,"children":658,"toc":678},[659,664,673],{"type":23,"tag":24,"props":660,"children":661},{},[662],{"type":28,"value":663},"In this guide, we'll show you how to convert HTML documents to PDFs using PDFShift's API. This is a straightforward process that can be accomplished with just a few lines of Node code.",{"type":23,"tag":44,"props":665,"children":668},{"className":666,"code":667,"language":49,"meta":8},[47],"const axios = require('axios');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n}\n\nconst response = await axios.post(\n    `https://api.pdfshift.io/v3/convert/pdf`,\n    params,\n    {\n        headers: { 'X-API-Key': api_key }\n    }\n});\n\n// Handle errors:\nif (response.status >= 400) {\n    throw new Error(`Request failed with status code ${response.status}: ${response.data}`);\n}\n\nfs.writeFileSync('result.pdf', response.data);\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[669],{"type":23,"tag":36,"props":670,"children":671},{"__ignoreMap":8},[672],{"type":28,"value":667},{"type":23,"tag":24,"props":674,"children":675},{},[676],{"type":28,"value":677},"With this Node script, you can effortlessly convert HTML documents from a URL to PDF files using PDFShift's API. Happy coding!",{"title":8,"searchDepth":61,"depth":61,"links":679},[],"content:guides:node:axios:convert-html-to-pdf-from-a-url.md","guides/node/axios/convert-html-to-pdf-from-a-url.md",{"_path":683,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":684,"description":685,"language":11,"library":12,"output":14,"related":686,"default":18,"body":688,"_type":63,"_id":773,"_source":65,"_file":774,"_extension":67},"/guides/node/axios/convert-html-to-pdf-from-raw-html","Convert an HTML document to PDF from raw HTML","Learn how to to convert raw HTML document to PDF using Node and the Axios library. Our guide will explain you how to quickly convert documents with PDFShift's API.",[687],"convert-html-to-pdf-from-a-url",{"type":20,"children":689,"toc":771},[690,695,713,734,746,750,759],{"type":23,"tag":24,"props":691,"children":692},{},[693],{"type":28,"value":694},"In this guide, we'll show you how to convert an HTML document to PDF using Node and the Axios library.\nProviding the HTML document as raw as a lot of great advantages :",{"type":23,"tag":126,"props":696,"children":697},{},[698,703,708],{"type":23,"tag":130,"props":699,"children":700},{},[701],{"type":28,"value":702},"It avoids PDFShift to make a network request to fetch the HTML document.",{"type":23,"tag":130,"props":704,"children":705},{},[706],{"type":28,"value":707},"It allows you to convert HTML documents that are not publicly accessible.",{"type":23,"tag":130,"props":709,"children":710},{},[711],{"type":28,"value":712},"It improves the speed of the conversion",{"type":23,"tag":24,"props":714,"children":715},{},[716,718,724,726,732],{"type":28,"value":717},"If, on top of that, you can provide the styles and javascript also inline in the document (",{"type":23,"tag":36,"props":719,"children":721},{"className":720},[],[722],{"type":28,"value":723},"\u003Cstyle>",{"type":28,"value":725}," and ",{"type":23,"tag":36,"props":727,"children":729},{"className":728},[],[730],{"type":28,"value":731},"\u003Cscript>",{"type":28,"value":733}," tags), it will also drastically reduce the duration of the conversion.",{"type":23,"tag":24,"props":735,"children":736},{},[737,739,744],{"type":28,"value":738},"For converting a raw document, we use the same parameter as for the URL, which is the ",{"type":23,"tag":36,"props":740,"children":742},{"className":741},[],[743],{"type":28,"value":138},{"type":28,"value":745}," parameter.\nAll you have to do is provide an HTML document.",{"type":23,"tag":24,"props":747,"children":748},{},[749],{"type":28,"value":210},{"type":23,"tag":44,"props":751,"children":754},{"className":752,"code":753,"language":49,"meta":8},[47],"const axios = require('axios');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: '\u003Chtml>\u003Cbody>\u003Ch1>This will be a PDF document\u003C/h1>\u003Cp>This will generate a basic PDF to show how you can add raw HTML\u003C/body>\u003C/html>',\n}\n\nconst response = await axios.post(\n    `https://api.pdfshift.io/v3/convert/pdf`,\n    params,\n    {\n        headers: { 'X-API-Key': api_key }\n    }\n});\n\n// Handle errors:\nif (response.status >= 400) {\n    throw new Error(`Request failed with status code ${response.status}: ${response.data}`);\n}\n\nfs.writeFileSync('result.pdf', response.data);\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[755],{"type":23,"tag":36,"props":756,"children":757},{"__ignoreMap":8},[758],{"type":28,"value":753},{"type":23,"tag":24,"props":760,"children":761},{},[762,764,769],{"type":28,"value":763},"Providing the ",{"type":23,"tag":36,"props":765,"children":767},{"className":766},[],[768],{"type":28,"value":138},{"type":28,"value":770}," parameter as a raw HTML document is by far the best recommended method to convert HTML documents in PDFShift as it reduce the amount of network requests, loading time of each documents (image, css, javascript, etc) and thus improve the conversion time.",{"title":8,"searchDepth":61,"depth":61,"links":772},[],"content:guides:node:axios:convert-html-to-pdf-from-raw-html.md","guides/node/axios/convert-html-to-pdf-from-raw-html.md",{"_path":776,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":777,"description":778,"language":11,"library":12,"property":779,"output":14,"related":780,"default":18,"body":782,"_type":63,"_id":829,"_source":65,"_file":830,"_extension":67},"/guides/node/axios/define-a-time-limit","Define a time limit","Learn how to set a conversion time limit at PDFShift. This will allow you to define a maximum time for the conversion process to complete, and if the process takes longer than the defined time, the conversion will be aborted. This guides explains you how to achieve it using Node and the Axios library.","timeout",[781],"waiting-for-a-custom-element-to-be-ready",{"type":20,"children":783,"toc":827},[784,789,794,813,822],{"type":23,"tag":24,"props":785,"children":786},{},[787],{"type":28,"value":788},"In this guide, we'll show you how you can set a conversion time limit at PDFShift. This will allow you to define a maximum time for the conversion process to complete, and if the process takes longer than the defined time, the conversion will be aborted.",{"type":23,"tag":24,"props":790,"children":791},{},[792],{"type":28,"value":793},"In some cases, this can be useful if you want the request to not be too long and then handle failure on your end depending on the result.",{"type":23,"tag":24,"props":795,"children":796},{},[797,799,804,806,811],{"type":28,"value":798},"To do so, we use the ",{"type":23,"tag":36,"props":800,"children":802},{"className":801},[],[803],{"type":28,"value":779},{"type":28,"value":805}," property, which is the maximum time in ",{"type":23,"tag":199,"props":807,"children":808},{},[809],{"type":28,"value":810},"seconds",{"type":28,"value":812}," that the request is allowed to take. If the request takes longer than the defined time, the conversion will be aborted.",{"type":23,"tag":44,"props":814,"children":817},{"className":815,"code":816,"language":49,"meta":8},[47],"const axios = require('axios');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    timeout: 10\n}\n\nconst response = await axios.post(\n    `https://api.pdfshift.io/v3/convert/pdf`,\n    params,\n    {\n        headers: { 'X-API-Key': api_key }\n    }\n});\n\n// Handle errors:\nif (response.status >= 400) {\n    throw new Error(`Request failed with status code ${response.status}: ${response.data}`);\n}\n\nfs.writeFileSync('result.pdf', response.data);\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[818],{"type":23,"tag":36,"props":819,"children":820},{"__ignoreMap":8},[821],{"type":28,"value":816},{"type":23,"tag":24,"props":823,"children":824},{},[825],{"type":28,"value":826},"In the above example, the conversion could fail if the conversion takes longer than 10 seconds.",{"title":8,"searchDepth":61,"depth":61,"links":828},[],"content:guides:node:axios:define-a-time-limit.md","guides/node/axios/define-a-time-limit.md",{"_path":832,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":833,"description":834,"language":11,"library":12,"property":835,"output":14,"default":18,"body":836,"_type":63,"_id":926,"_source":65,"_file":927,"_extension":67},"/guides/node/axios/exporting-only-a-specific-set-of-pages","Exporting only a specific set of pages","Learn how to export only a specific set of pages from a document using Node and the Axios library. This guide offers detailed steps with code samples in Node and the Axios library, highlighting how you can export only a specific set of pages from a document using PDFShift's API.","pages",{"type":20,"children":837,"toc":924},[838,843,854,859,864,906,911,915],{"type":23,"tag":24,"props":839,"children":840},{},[841],{"type":28,"value":842},"In this guide, we'll show you how to export only a specific set of pages from a document using Node and the Axios library to convert them to PDF using PDFShift's API.",{"type":23,"tag":24,"props":844,"children":845},{},[846,848,853],{"type":28,"value":847},"When you're converting a document, you might want to export only a specific set of pages from a document. This can be done by setting the ",{"type":23,"tag":36,"props":849,"children":851},{"className":850},[],[852],{"type":28,"value":835},{"type":28,"value":42},{"type":23,"tag":24,"props":855,"children":856},{},[857],{"type":28,"value":858},"It behaves exactly like the page parameter you can see when you print a document from your browser.",{"type":23,"tag":24,"props":860,"children":861},{},[862],{"type":28,"value":863},"It accepts the following pattern:",{"type":23,"tag":126,"props":865,"children":866},{},[867,880,893],{"type":23,"tag":130,"props":868,"children":869},{},[870,872,878],{"type":28,"value":871},"A number, such as ",{"type":23,"tag":36,"props":873,"children":875},{"className":874},[],[876],{"type":28,"value":877},"2",{"type":28,"value":879},". This will print the page 2",{"type":23,"tag":130,"props":881,"children":882},{},[883,885,891],{"type":28,"value":884},"A range, such as ",{"type":23,"tag":36,"props":886,"children":888},{"className":887},[],[889],{"type":28,"value":890},"2-4",{"type":28,"value":892},". This will print the pages 2 to 4 (2, 3 and 4)",{"type":23,"tag":130,"props":894,"children":895},{},[896,898,904],{"type":28,"value":897},"A list, such as ",{"type":23,"tag":36,"props":899,"children":901},{"className":900},[],[902],{"type":28,"value":903},"2,4,5,9",{"type":28,"value":905},". This will print the pages 2, 4, 5 and 9",{"type":23,"tag":24,"props":907,"children":908},{},[909],{"type":28,"value":910},"This way, you can only export the pages that you really need and get immediately the result you want in the PDF, without having to edit it.",{"type":23,"tag":24,"props":912,"children":913},{},[914],{"type":28,"value":210},{"type":23,"tag":44,"props":916,"children":919},{"className":917,"code":918,"language":49,"meta":8},[47],"const axios = require('axios');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://en.wikipedia.org/wiki/PDF',\n    pages: '2-4'\n}\n\nconst response = await axios.post(\n    `https://api.pdfshift.io/v3/convert/pdf`,\n    params,\n    {\n        headers: { 'X-API-Key': api_key }\n    }\n});\n\n// Handle errors:\nif (response.status >= 400) {\n    throw new Error(`Request failed with status code ${response.status}: ${response.data}`);\n}\n\nfs.writeFileSync('result.pdf', response.data);\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[920],{"type":23,"tag":36,"props":921,"children":922},{"__ignoreMap":8},[923],{"type":28,"value":918},{"title":8,"searchDepth":61,"depth":61,"links":925},[],"content:guides:node:axios:exporting-only-a-specific-set-of-pages.md","guides/node/axios/exporting-only-a-specific-set-of-pages.md",{"_path":929,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":930,"description":931,"language":11,"library":12,"property":932,"output":14,"default":18,"body":933,"_type":63,"_id":1056,"_source":65,"_file":1057,"_extension":67},"/guides/node/axios/generate-a-document-with-full-height","Generate a document with full height","Learn to generate full-height documents dynamically with our step-by-step guide. This will allow you to create documents with a dynamic height, based on the content of the document. This guide provides Node code samples using the Axios library to help you generate full-height documents with PDFShift's API.","format",{"type":20,"children":934,"toc":1054},[935,940,960,969,974,985,1004,1009,1018],{"type":23,"tag":24,"props":936,"children":937},{},[938],{"type":28,"value":939},"In this guide, we'll show you how to generate a document with full height dynamically using Node and the Axios library to convert them to PDF using PDFShift's API.",{"type":23,"tag":24,"props":941,"children":942},{},[943,945,950,952,958],{"type":28,"value":944},"When you're converting a document, you might want to generate a document with full height dynamically. This can be done by setting the ",{"type":23,"tag":36,"props":946,"children":948},{"className":947},[],[949],{"type":28,"value":932},{"type":28,"value":951}," parameter to the request and passing it a custom \"auto\" value for the ",{"type":23,"tag":36,"props":953,"children":955},{"className":954},[],[956],{"type":28,"value":957},"{height}",{"type":28,"value":959}," part.",{"type":23,"tag":44,"props":961,"children":964},{"className":962,"code":963,"language":49,"meta":8},[47],"const axios = require('axios');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    format: '1280xauto'\n}\n\nconst response = await axios.post(\n    `https://api.pdfshift.io/v3/convert/pdf`,\n    params,\n    {\n        headers: { 'X-API-Key': api_key }\n    }\n});\n\n// Handle errors:\nif (response.status >= 400) {\n    throw new Error(`Request failed with status code ${response.status}: ${response.data}`);\n}\n\nfs.writeFileSync('result.pdf', response.data);\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[965],{"type":23,"tag":36,"props":966,"children":967},{"__ignoreMap":8},[968],{"type":28,"value":963},{"type":23,"tag":24,"props":970,"children":971},{},[972],{"type":28,"value":973},"The format parameter can accept various values, such as 'Letter', 'Legal', 'Tabloid', 'Ledger', 'A0', 'A1', 'A2', 'A3', 'A4', 'A5'.",{"type":23,"tag":24,"props":975,"children":976},{},[977,979],{"type":28,"value":978},"But it can also accept a custom values that is defined per the width and height as follow: ",{"type":23,"tag":36,"props":980,"children":982},{"className":981},[],[983],{"type":28,"value":984},"{width}x{height}",{"type":23,"tag":24,"props":986,"children":987},{},[988,990,996,997,1002],{"type":28,"value":989},"Both ",{"type":23,"tag":36,"props":991,"children":993},{"className":992},[],[994],{"type":28,"value":995},"width",{"type":28,"value":725},{"type":23,"tag":36,"props":998,"children":1000},{"className":999},[],[1001],{"type":28,"value":149},{"type":28,"value":1003}," are pixel value by default, but if you precise the unit (in \"cm\", \"mm\", \"in\" or \"pt\"). That unit will be used instead.",{"type":23,"tag":24,"props":1005,"children":1006},{},[1007],{"type":28,"value":1008},"For instance, you can set a format of:",{"type":23,"tag":44,"props":1010,"children":1013},{"className":1011,"code":1012,"language":574,"meta":8},[573],"{\n    \"source\": \"https://www.example.com\",\n    \"format\": \"21cmx29,7cm\"\n}\n",[1014],{"type":23,"tag":36,"props":1015,"children":1016},{"__ignoreMap":8},[1017],{"type":28,"value":1012},{"type":23,"tag":24,"props":1019,"children":1020},{},[1021,1023,1028,1030,1036,1038,1044,1046,1052],{"type":28,"value":1022},"Now, if you want a \"liquid\" height, which will analyze the height of the page and use it as your format, you can set the ",{"type":23,"tag":36,"props":1024,"children":1026},{"className":1025},[],[1027],{"type":28,"value":957},{"type":28,"value":1029}," value to ",{"type":23,"tag":36,"props":1031,"children":1033},{"className":1032},[],[1034],{"type":28,"value":1035},"auto",{"type":28,"value":1037},".\nSo, instead of setting a fixed height such as ",{"type":23,"tag":36,"props":1039,"children":1041},{"className":1040},[],[1042],{"type":28,"value":1043},"format: '1280x1024'",{"type":28,"value":1045},", you can set ",{"type":23,"tag":36,"props":1047,"children":1049},{"className":1048},[],[1050],{"type":28,"value":1051},"format: '1280xauto'",{"type":28,"value":1053}," and the height will be calculated based on the content of the page.",{"title":8,"searchDepth":61,"depth":61,"links":1055},[],"content:guides:node:axios:generate-a-document-with-full-height.md","guides/node/axios/generate-a-document-with-full-height.md",{"_path":1059,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":1060,"description":1061,"language":11,"library":12,"property":1062,"output":14,"related":1063,"default":18,"body":1065,"_type":63,"_id":1099,"_source":65,"_file":1100,"_extension":67},"/guides/node/axios/loading-css-from-a-string","Loading CSS from a string","Follow this guide to load custom CSS as a given string when converting an HTML document to PDF with PDFShift's API. This guide provides Node code samples with the Axios library.","css",[1064,75,76,77],"adding-a-custom-header-or-footer",{"type":20,"children":1066,"toc":1097},[1067,1072,1077,1086],{"type":23,"tag":24,"props":1068,"children":1069},{},[1070],{"type":28,"value":1071},"In this guide, we'll show you how to load custom CSS as a given string when converting an HTML document to PDF using PDFShift's API. This allows you to add custom CSS to your page to customize the output of your generated PDF.",{"type":23,"tag":24,"props":1073,"children":1074},{},[1075],{"type":28,"value":1076},"It can be interesting to be able to set a custom CSS value to adjust the rendering of your page specifically when exporting the document to PDF.\nThis allows you to keep a standard look and feel to your users, but adjust some areas when sending that same document to PDFShift to get back a PDF.",{"type":23,"tag":44,"props":1078,"children":1081},{"className":1079,"code":1080,"language":49,"meta":8},[47],"const axios = require('axios');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    css: 'body { background-color: #f00; }'\n}\n\nconst response = await axios.post(\n    `https://api.pdfshift.io/v3/convert/pdf`,\n    params,\n    {\n        headers: { 'X-API-Key': api_key }\n    }\n});\n\n// Handle errors:\nif (response.status >= 400) {\n    throw new Error(`Request failed with status code ${response.status}: ${response.data}`);\n}\n\nfs.writeFileSync('result.pdf', response.data);\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[1082],{"type":23,"tag":36,"props":1083,"children":1084},{"__ignoreMap":8},[1085],{"type":28,"value":1080},{"type":23,"tag":24,"props":1087,"children":1088},{},[1089,1090,1095],{"type":28,"value":117},{"type":23,"tag":36,"props":1091,"children":1093},{"className":1092},[],[1094],{"type":28,"value":1062},{"type":28,"value":1096}," parameter accepts either a string or a URL. It will be used as the CSS for the page when converting it to PDF. This allows you to set a custom CSS value to adjust the rendering of your page specifically when exporting the document to PDF.",{"title":8,"searchDepth":61,"depth":61,"links":1098},[],"content:guides:node:axios:loading-css-from-a-string.md","guides/node/axios/loading-css-from-a-string.md",{"_path":1102,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":1103,"description":1104,"language":11,"library":12,"property":1062,"output":14,"related":1105,"default":18,"body":1106,"_type":63,"_id":1143,"_source":65,"_file":1144,"_extension":67},"/guides/node/axios/loading-css-from-a-url","Loading CSS from a URL","This guides shows you how to add a custom CSS from an URL onto your document to customize the output of your generated PDF. Follow this guides to learn how to do it using Node and the Axios library and see how it can quickly be implemented using the PDFShift's API.",[1064,74,76,77],{"type":20,"children":1107,"toc":1141},[1108,1113,1117,1122,1131],{"type":23,"tag":24,"props":1109,"children":1110},{},[1111],{"type":28,"value":1112},"In this guide, we'll show you how to load custom CSS as a URL when converting an HTML document to PDF using PDFShift's API. This allows you to add custom CSS to your page to customize the output of your generated PDF.",{"type":23,"tag":24,"props":1114,"children":1115},{},[1116],{"type":28,"value":1076},{"type":23,"tag":24,"props":1118,"children":1119},{},[1120],{"type":28,"value":1121},"Moreover, adding a URL can be easier to do than passing the raw CSS content, as it allows you to later modify that CSS without having to modify the query made to PDFShift.",{"type":23,"tag":44,"props":1123,"children":1126},{"className":1124,"code":1125,"language":49,"meta":8},[47],"const axios = require('axios');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    css: \"https://www.example.com/public/style/print.css\"\n}\n\nconst response = await axios.post(\n    `https://api.pdfshift.io/v3/convert/pdf`,\n    params,\n    {\n        headers: { 'X-API-Key': api_key }\n    }\n});\n\n// Handle errors:\nif (response.status >= 400) {\n    throw new Error(`Request failed with status code ${response.status}: ${response.data}`);\n}\n\nfs.writeFileSync('result.pdf', response.data);\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[1127],{"type":23,"tag":36,"props":1128,"children":1129},{"__ignoreMap":8},[1130],{"type":28,"value":1125},{"type":23,"tag":24,"props":1132,"children":1133},{},[1134,1135,1140],{"type":28,"value":117},{"type":23,"tag":36,"props":1136,"children":1138},{"className":1137},[],[1139],{"type":28,"value":1062},{"type":28,"value":1096},{"title":8,"searchDepth":61,"depth":61,"links":1142},[],"content:guides:node:axios:loading-css-from-a-url.md","guides/node/axios/loading-css-from-a-url.md",{"_path":1146,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":1147,"description":1148,"language":11,"library":12,"property":49,"output":14,"related":1149,"default":18,"body":1150,"_type":63,"_id":1184,"_source":65,"_file":1185,"_extension":67},"/guides/node/axios/loading-javascript-from-a-string","Loading Javascript from a string","Follow this guide to learn how to add custom javascript to your page to customize the output of your generated PDF. This allows you to modify elements on the page, add or remove content, etc. This guide uses Node and the Axios library and relies on the PDFShift's API.",[1064,74,75,77],{"type":20,"children":1151,"toc":1182},[1152,1157,1162,1171],{"type":23,"tag":24,"props":1153,"children":1154},{},[1155],{"type":28,"value":1156},"In this guide, we'll show you how to load custom javascript code as a given string when converting an HTML document to PDF using PDFShift's API. This allows you to add custom JS to your page to customize the output of your generated PDF.",{"type":23,"tag":24,"props":1158,"children":1159},{},[1160],{"type":28,"value":1161},"It can be interesting to be able to set a custom JS value to adjust the rendering of your page specifically when exporting the document to PDF.\nThis allows you to keep a standard look and feel to your users, but adjust some areas when sending that same document to PDFShift to get back a PDF.",{"type":23,"tag":44,"props":1163,"children":1166},{"className":1164,"code":1165,"language":49,"meta":8},[47],"const axios = require('axios');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    javascript: 'document.querySelector(\"h1\").style.color = \"red\";'\n}\n\nconst response = await axios.post(\n    `https://api.pdfshift.io/v3/convert/pdf`,\n    params,\n    {\n        headers: { 'X-API-Key': api_key }\n    }\n});\n\n// Handle errors:\nif (response.status >= 400) {\n    throw new Error(`Request failed with status code ${response.status}: ${response.data}`);\n}\n\nfs.writeFileSync('result.pdf', response.data);\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[1167],{"type":23,"tag":36,"props":1168,"children":1169},{"__ignoreMap":8},[1170],{"type":28,"value":1165},{"type":23,"tag":24,"props":1172,"children":1173},{},[1174,1175,1180],{"type":28,"value":117},{"type":23,"tag":36,"props":1176,"children":1178},{"className":1177},[],[1179],{"type":28,"value":49},{"type":28,"value":1181}," parameter accepts either a string or a URL. It will be used as the javascript for the page when converting it to PDF. This allows you to set a custom JS value to adjust the rendering of your page specifically when exporting the document to PDF.",{"title":8,"searchDepth":61,"depth":61,"links":1183},[],"content:guides:node:axios:loading-javascript-from-a-string.md","guides/node/axios/loading-javascript-from-a-string.md",{"_path":1187,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":1188,"description":1189,"language":11,"library":12,"property":49,"output":14,"related":1190,"default":18,"body":1191,"_type":63,"_id":1230,"_source":65,"_file":1231,"_extension":67},"/guides/node/axios/loading-javascript-from-a-url","Loading Javascript from a URL","Follow this guide to add custom javascript to your page before converting it to PDF. Using a URL allows you to later be able to change the content of the javascript without having to update the query made to PDFShift. Learn how you can implement this using Node and the Axios library to call the PDFShift's API.",[1064,74,75,76],{"type":20,"children":1192,"toc":1228},[1193,1198,1203,1208,1217],{"type":23,"tag":24,"props":1194,"children":1195},{},[1196],{"type":28,"value":1197},"In this guide, we'll show you how to load custom javascript as a URL when converting an HTML document to PDF using PDFShift's API. This allows you to add custom Js to your page to customize the output of your generated PDF.",{"type":23,"tag":24,"props":1199,"children":1200},{},[1201],{"type":28,"value":1202},"It can be interesting to be able to set a custom javascript value to adjust the rendering of your page specifically when exporting the document to PDF.\nThis allows you to keep a standard look and feel to your users, but adjust some areas when sending that same document to PDFShift to get back a PDF.",{"type":23,"tag":24,"props":1204,"children":1205},{},[1206],{"type":28,"value":1207},"Moreover, adding a URL can be easier to do than passing the raw javascript content, as it allows you to later modify that javascript without having to modify the query made to PDFShift.",{"type":23,"tag":44,"props":1209,"children":1212},{"className":1210,"code":1211,"language":49,"meta":8},[47],"const axios = require('axios');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    javascript: 'https://www.example.com/custom.js'\n}\n\nconst response = await axios.post(\n    `https://api.pdfshift.io/v3/convert/pdf`,\n    params,\n    {\n        headers: { 'X-API-Key': api_key }\n    }\n});\n\n// Handle errors:\nif (response.status >= 400) {\n    throw new Error(`Request failed with status code ${response.status}: ${response.data}`);\n}\n\nfs.writeFileSync('result.pdf', response.data);\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[1213],{"type":23,"tag":36,"props":1214,"children":1215},{"__ignoreMap":8},[1216],{"type":28,"value":1211},{"type":23,"tag":24,"props":1218,"children":1219},{},[1220,1221,1226],{"type":28,"value":117},{"type":23,"tag":36,"props":1222,"children":1224},{"className":1223},[],[1225],{"type":28,"value":49},{"type":28,"value":1227}," parameter accepts either a string or a URL. It will be used as the javascript for the page when converting it to PDF. This allows you to set a custom javascript value to adjust the rendering of your page specifically when exporting the document to PDF.",{"title":8,"searchDepth":61,"depth":61,"links":1229},[],"content:guides:node:axios:loading-javascript-from-a-url.md","guides/node/axios/loading-javascript-from-a-url.md",{"_path":1233,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":1234,"description":1235,"language":11,"library":12,"property":1236,"output":14,"related":1237,"default":18,"body":1238,"_type":63,"_id":1399,"_source":65,"_file":1400,"_extension":67},"/guides/node/axios/protecting-the-generated-pdf","Protecting the generated PDF","Learn how to protect your generated PDF with encryption for owner and user, and for choosing who can modify, print and/or copy the generated PDF. This guides explains you to do it using Node and the Axios library and relies on the PDFShift's API.","protection",[317,479],{"type":20,"children":1239,"toc":1397},[1240,1245,1250,1262,1267,1276,1288,1299,1387],{"type":23,"tag":24,"props":1241,"children":1242},{},[1243],{"type":28,"value":1244},"In this guide, we'll show you how you can protect your generated PDF with encryption for owner and user, and for choosing who can modify, print and/or copy the generated PDF. This guides explains you to do it using Node and the Axios library and relies on the PDFShift's API.",{"type":23,"tag":24,"props":1246,"children":1247},{},[1248],{"type":28,"value":1249},"One of the most useful feature here is the ability to set a password for the owner and the user of the PDF. This allows you to protect your document from anyone and restrict its access to only a few people.",{"type":23,"tag":24,"props":1251,"children":1252},{},[1253,1255,1260],{"type":28,"value":1254},"PDFShift allows you to do this easily by adding the ",{"type":23,"tag":36,"props":1256,"children":1258},{"className":1257},[],[1259],{"type":28,"value":1236},{"type":28,"value":1261}," object to your query.",{"type":23,"tag":24,"props":1263,"children":1264},{},[1265],{"type":28,"value":1266},"Here's a sample:",{"type":23,"tag":44,"props":1268,"children":1271},{"className":1269,"code":1270,"language":49,"meta":8},[47],"const axios = require('axios');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    protection: {\n        owner_password: 'owner_password',\n        user_password: 'user_password',\n        no_print: True,\n        no_modify: True\n    }\n}\n\nconst response = await axios.post(\n    `https://api.pdfshift.io/v3/convert/pdf`,\n    params,\n    {\n        headers: { 'X-API-Key': api_key }\n    }\n});\n\n// Handle errors:\nif (response.status >= 400) {\n    throw new Error(`Request failed with status code ${response.status}: ${response.data}`);\n}\n\nfs.writeFileSync('result.pdf', response.data);\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[1272],{"type":23,"tag":36,"props":1273,"children":1274},{"__ignoreMap":8},[1275],{"type":28,"value":1270},{"type":23,"tag":24,"props":1277,"children":1278},{},[1279,1281,1286],{"type":28,"value":1280},"Adding the ",{"type":23,"tag":36,"props":1282,"children":1284},{"className":1283},[],[1285],{"type":28,"value":1236},{"type":28,"value":1287}," object to your query will tell PDFShift to generate a PDF that will be password protected.",{"type":23,"tag":24,"props":1289,"children":1290},{},[1291,1292,1297],{"type":28,"value":117},{"type":23,"tag":36,"props":1293,"children":1295},{"className":1294},[],[1296],{"type":28,"value":1236},{"type":28,"value":1298}," object accepts the following parameters:",{"type":23,"tag":126,"props":1300,"children":1301},{},[1302,1313,1324,1335,1353,1370],{"type":23,"tag":130,"props":1303,"children":1304},{},[1305,1311],{"type":23,"tag":36,"props":1306,"children":1308},{"className":1307},[],[1309],{"type":28,"value":1310},"author",{"type":28,"value":1312}," : The name of the author in the PDF metadata.",{"type":23,"tag":130,"props":1314,"children":1315},{},[1316,1322],{"type":23,"tag":36,"props":1317,"children":1319},{"className":1318},[],[1320],{"type":28,"value":1321},"owner_password",{"type":28,"value":1323},": The password set for the owner.",{"type":23,"tag":130,"props":1325,"children":1326},{},[1327,1333],{"type":23,"tag":36,"props":1328,"children":1330},{"className":1329},[],[1331],{"type":28,"value":1332},"user_password",{"type":28,"value":1334},": The password set for the user.",{"type":23,"tag":130,"props":1336,"children":1337},{},[1338,1344,1346,1351],{"type":23,"tag":36,"props":1339,"children":1341},{"className":1340},[],[1342],{"type":28,"value":1343},"no_print",{"type":28,"value":1345},": If set to ",{"type":23,"tag":36,"props":1347,"children":1349},{"className":1348},[],[1350],{"type":28,"value":615},{"type":28,"value":1352},", the user won't be able to print the PDF. (Only the owner)",{"type":23,"tag":130,"props":1354,"children":1355},{},[1356,1362,1363,1368],{"type":23,"tag":36,"props":1357,"children":1359},{"className":1358},[],[1360],{"type":28,"value":1361},"no_modify",{"type":28,"value":1345},{"type":23,"tag":36,"props":1364,"children":1366},{"className":1365},[],[1367],{"type":28,"value":615},{"type":28,"value":1369},", the user won't be able to modify the PDF. (Only the owner)",{"type":23,"tag":130,"props":1371,"children":1372},{},[1373,1379,1380,1385],{"type":23,"tag":36,"props":1374,"children":1376},{"className":1375},[],[1377],{"type":28,"value":1378},"no_copy",{"type":28,"value":1345},{"type":23,"tag":36,"props":1381,"children":1383},{"className":1382},[],[1384],{"type":28,"value":615},{"type":28,"value":1386},", the user won't be able to copy the content of the PDF. (Only the owner)",{"type":23,"tag":24,"props":1388,"children":1389},{},[1390,1395],{"type":23,"tag":199,"props":1391,"children":1392},{},[1393],{"type":28,"value":1394},"IMPORTANT",{"type":28,"value":1396},":\nIt is important to note that most PDF reader don't respect the protection parameter. For instance, if you set the user_password to none (allowing anyone to view the PDF) but set the owner_password and block the modify, print and copy, most PDF reader will still allow user (and not owners) to modify, print and copy the PDF. This is a limitation of the PDF format and not PDFShift.",{"title":8,"searchDepth":61,"depth":61,"links":1398},[],"content:guides:node:axios:protecting-the-generated-pdf.md","guides/node/axios/protecting-the-generated-pdf.md",{"_path":1402,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":1403,"description":1404,"language":11,"library":12,"property":1405,"output":14,"related":1406,"default":18,"body":1409,"_type":63,"_id":1497,"_source":65,"_file":1498,"_extension":67},"/guides/node/axios/receive-a-webhook-event","Receive a webhook event","Receive a notification via a POST request on your server once the conversion was done. This allows you to trigger a massive amount of conversion without having to wait on their results, and get notified once they are done. This guides will show you how to receive webhook events in Node and the Axios library to call the PDFShift's API.","webhook",[1407,1408],"save-your-pdf-online-and-get-back-a-url","save-your-pdf-to-your-amazon-s3-bucket",{"type":20,"children":1410,"toc":1495},[1411,1416,1421,1425,1434,1439,1444,1449,1458,1463,1472,1477,1482,1490],{"type":23,"tag":24,"props":1412,"children":1413},{},[1414],{"type":28,"value":1415},"In this guide, we'll show you how you can receive a notification via a POST request on your server once the conversion was done. This allows you to trigger a massive amount of conversion without having to wait on their results, and get notified once they are done.",{"type":23,"tag":24,"props":1417,"children":1418},{},[1419],{"type":28,"value":1420},"For this guide, we are going to use the \"webhook\" parameter when sending a request to PDFShift. It expects a URL to which the POST request will be sent once the conversion is done.",{"type":23,"tag":24,"props":1422,"children":1423},{},[1424],{"type":28,"value":1266},{"type":23,"tag":44,"props":1426,"children":1429},{"className":1427,"code":1428,"language":49,"meta":8},[47],"const axios = require('axios');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    webhook: 'https://enyygzdj8jy9b.x.pipedream.net/'\n}\n\nconst response = await axios.post(\n    `https://api.pdfshift.io/v3/convert/pdf`,\n    params,\n    {\n        headers: { 'X-API-Key': api_key }\n    }\n});\n\n// Handle errors:\nif (response.status >= 400) {\n    throw new Error(`Request failed with status code ${response.status}: ${response.data}`);\n}\n\nconsole.log('The PDF document was generated and you will receive an event on your webhook once it is done.');\n",[1430],{"type":23,"tag":36,"props":1431,"children":1432},{"__ignoreMap":8},[1433],{"type":28,"value":1428},{"type":23,"tag":24,"props":1435,"children":1436},{},[1437],{"type":28,"value":1438},"(Please note that the webhook requires a valid API key)",{"type":23,"tag":24,"props":1440,"children":1441},{},[1442],{"type":28,"value":1443},"We used Requestbin.com to generate a endpoint that will receive our POST event, but you can set your own endpoint with custom parameters.",{"type":23,"tag":24,"props":1445,"children":1446},{},[1447],{"type":28,"value":1448},"When sending the above request to PDFShift, the response will be immediate with a status code of 202 (Request accepted), with the following JSON body:",{"type":23,"tag":44,"props":1450,"children":1453},{"className":1451,"code":1452,"language":574,"meta":8},[573],"{\n    \"success\":true,\n    \"queued\":true\n}\n",[1454],{"type":23,"tag":36,"props":1455,"children":1456},{"__ignoreMap":8},[1457],{"type":28,"value":1452},{"type":23,"tag":24,"props":1459,"children":1460},{},[1461],{"type":28,"value":1462},"Once the conversion is actually done at PDFShift, you will receive a POST request containing the following JSON body:",{"type":23,"tag":44,"props":1464,"children":1467},{"className":1465,"code":1466,"language":574,"meta":8},[573],"{\n    \"success\": true,\n    \"url\": \"https://pdfshift.s3.amazonaws.com/d/2/2024-03/39775239d74d4accbabb709800f034d2/8a3ec881-fa69-4059-9c71-0f40c633317e.pdf\",\n    \"filesize\": 34980,\n    \"duration\": 1058,\n    \"response\": {\n        \"status-code\": 200,\n        \"content-length\": 0,\n        \"requests\": 0,\n        \"duration\": 934.5173301696777\n    },\n    \"executed\": \"2024-03-06T09:10:10.981098\",\n    \"pdf_pages\": 1\n}\n",[1468],{"type":23,"tag":36,"props":1469,"children":1470},{"__ignoreMap":8},[1471],{"type":28,"value":1466},{"type":23,"tag":24,"props":1473,"children":1474},{},[1475],{"type":28,"value":1476},"It might occur that the conversion fails, for instance if PDFShift can't access the page or if there is any parameter that cause the loading page to fail (page taking to long to load, etc).",{"type":23,"tag":24,"props":1478,"children":1479},{},[1480],{"type":28,"value":1481},"In this case, the POST request will contain the following JSON body:",{"type":23,"tag":44,"props":1483,"children":1485},{"className":1484,"code":8,"language":574,"meta":8},[573],[1486],{"type":23,"tag":36,"props":1487,"children":1488},{"__ignoreMap":8},[1489],{"type":28,"value":8},{"type":23,"tag":24,"props":1491,"children":1492},{},[1493],{"type":28,"value":1494},"This can be useful if you don't need to wait for the conversion to continue your process. For instance, when generating all the invoices from last month's payment, you can trigger the conversions and save the PDF on your webhook's destination. This way, you can continue your process without having to wait for the conversion to be done.",{"title":8,"searchDepth":61,"depth":61,"links":1496},[],"content:guides:node:axios:receive-a-webhook-event.md","guides/node/axios/receive-a-webhook-event.md",{"_path":1500,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":1501,"description":1502,"language":11,"library":12,"property":1503,"output":14,"related":1504,"default":18,"body":1506,"_type":63,"_id":1587,"_source":65,"_file":1588,"_extension":67},"/guides/node/axios/save-your-pdf-online-and-get-back-a-url","Save your PDF online and get back a URL","This guides shows you how can generate a PDF document from HTML and get back an URL instead of the raw PDF. This allows you to share the link directly to your users or redirect them to that page. Learn how you can achieve it using Node and the Axios library to call PDFShift's API.","filename",[1408,1505],"receive-a-webhook-event",{"type":20,"children":1507,"toc":1585},[1508,1513,1525,1534,1553,1558,1567,1576],{"type":23,"tag":24,"props":1509,"children":1510},{},[1511],{"type":28,"value":1512},"In this guide, we'll show you how you can generate a PDF document from HTML and get back an URL instead of the raw PDF. This allows you to share the link directly to your users or redirect them to that page.",{"type":23,"tag":24,"props":1514,"children":1515},{},[1516,1518,1523],{"type":28,"value":1517},"To do so, we are going to pass the ",{"type":23,"tag":36,"props":1519,"children":1521},{"className":1520},[],[1522],{"type":28,"value":1503},{"type":28,"value":1524}," parameter to the request. It expects a string that will be the name of the file once it is saved on our servers.",{"type":23,"tag":44,"props":1526,"children":1529},{"className":1527,"code":1528,"language":49,"meta":8},[47],"const axios = require('axios');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    filename: 'example.pdf'\n}\n\nconst response = await axios.post(\n    `https://api.pdfshift.io/v3/convert/pdf`,\n    params,\n    {\n        headers: { 'X-API-Key': api_key }\n    }\n});\n\n// Handle errors:\nif (response.status >= 400) {\n    throw new Error(`Request failed with status code ${response.status}: ${response.data}`);\n}\n\nconsole.log('The PDF document was generated and is available online via the url in the response');\n",[1530],{"type":23,"tag":36,"props":1531,"children":1532},{"__ignoreMap":8},[1533],{"type":28,"value":1528},{"type":23,"tag":24,"props":1535,"children":1536},{},[1537,1539,1544,1546,1551],{"type":28,"value":1538},"In the above example, we used the ",{"type":23,"tag":36,"props":1540,"children":1542},{"className":1541},[],[1543],{"type":28,"value":1503},{"type":28,"value":1545}," parameter to specify the name of the file once it is saved on our servers. The response will convert the document ",{"type":23,"tag":199,"props":1547,"children":1548},{},[1549],{"type":28,"value":1550},"but return a JSON response",{"type":28,"value":1552}," instead of the raw PDF.",{"type":23,"tag":24,"props":1554,"children":1555},{},[1556],{"type":28,"value":1557},"The body of the response will be similar to this:",{"type":23,"tag":44,"props":1559,"children":1562},{"className":1560,"code":1561,"language":574,"meta":8},[573],"{\n    \"success\": true,\n    \"url\": \"https://pdfshift.s3.amazonaws.com/d/2/2024-03/c9c2d3e536ff42d892f06fdda6bb1ff7/example.pdf\",\n    \"filesize\": 34980,\n    \"duration\": 1237,\n    \"response\": {\n        \"status-code\": 200,\n        \"content-length\": 0,\n        \"requests\": 0,\n        \"duration\": 1085.6739225387573\n    },\n    \"executed\": \"2024-03-06T10:05:51.516413\",\n    \"pdf_pages\": 1\n}\n",[1563],{"type":23,"tag":36,"props":1564,"children":1565},{"__ignoreMap":8},[1566],{"type":28,"value":1561},{"type":23,"tag":24,"props":1568,"children":1569},{},[1570,1574],{"type":23,"tag":199,"props":1571,"children":1572},{},[1573],{"type":28,"value":203},{"type":28,"value":1575},": Using the filename does save your document on our S3 storage for 2 days. After two days, the document is automatically deleted.",{"type":23,"tag":24,"props":1577,"children":1578},{},[1579,1583],{"type":23,"tag":199,"props":1580,"children":1581},{},[1582],{"type":28,"value":203},{"type":28,"value":1584},": Since we store your documents on our server, this command is not recommended if you want to be HIPAA compliant.",{"title":8,"searchDepth":61,"depth":61,"links":1586},[],"content:guides:node:axios:save-your-pdf-online-and-get-back-a-url.md","guides/node/axios/save-your-pdf-online-and-get-back-a-url.md",{"_path":1590,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":1591,"description":1592,"language":11,"library":12,"property":1593,"output":14,"related":1594,"default":18,"body":1595,"_type":63,"_id":1696,"_source":65,"_file":1697,"_extension":67},"/guides/node/axios/save-your-pdf-to-your-amazon-s3-bucket","Save your PDF to your Amazon S3 Bucket","This guides shows you how can generate a PDF document from HTML with PDFShift's API and save it to your own Amazon S3 bucket. This allows you to generate document and automate actions once the document has been created on your bucket. This guides explains you how to do it using Node and the Axios library.","s3_destination",[1407,1505],{"type":20,"children":1596,"toc":1694},[1597,1602,1607,1612,1621,1633,1642,1654,1663,1668,1677,1682],{"type":23,"tag":24,"props":1598,"children":1599},{},[1600],{"type":28,"value":1601},"In this guide, we'll show you how you can generate a PDF document from HTML with PDFShift's API and save it to your own Amazon S3 bucket. This allows you to generate document and automate actions once the document has been created on your bucket.",{"type":23,"tag":24,"props":1603,"children":1604},{},[1605],{"type":28,"value":1606},"First, you'll need to set up permissions in your bucket to allow PDFShift to write in it.",{"type":23,"tag":24,"props":1608,"children":1609},{},[1610],{"type":28,"value":1611},"We crafted a very simple policy that only does what is required and nothing more.\nYou can copy/paste it and apply it on your bucket, but don't forget to change the name of your bucket:",{"type":23,"tag":44,"props":1613,"children":1616},{"className":1614,"code":1615,"language":574,"meta":8},[573],"{\n    \"Version\": \"2012-10-17\",\n    \"Statement\": [{\n        \"Sid\": \"Allows PDFShift.io to write the generated PDF in this bucket.\",\n        \"Effect\": \"Allow\",\n        \"Principal\": {\n            \"AWS\": [\"arn:aws:iam::804461045055:user/pdfshift\"]\n        },\n        \"Action\": [\"s3:PutObject\"],\n        \"Resource\": \"arn:aws:s3:::DOC-EXAMPLE-BUCKET/*\"\n    }]\n}\n",[1617],{"type":23,"tag":36,"props":1618,"children":1619},{"__ignoreMap":8},[1620],{"type":28,"value":1615},{"type":23,"tag":24,"props":1622,"children":1623},{},[1624,1626,1631],{"type":28,"value":1625},"Once this is done, you can send a request to PDFShift by adding the ",{"type":23,"tag":36,"props":1627,"children":1629},{"className":1628},[],[1630],{"type":28,"value":1593},{"type":28,"value":1632}," parameter. It takes the full s3 bucket as a URL.\nOnce the conversion will be done, PDFShift will",{"type":23,"tag":44,"props":1634,"children":1637},{"className":1635,"code":1636,"language":49,"meta":8},[47],"const axios = require('axios');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    s3_destination: 's3://DOC-EXAMPLE-BUCKET/test/example.pdf'\n}\n\nconst response = await axios.post(\n    `https://api.pdfshift.io/v3/convert/pdf`,\n    params,\n    {\n        headers: { 'X-API-Key': api_key }\n    }\n});\n\n// Handle errors:\nif (response.status >= 400) {\n    throw new Error(`Request failed with status code ${response.status}: ${response.data}`);\n}\n\nconsole.log('The PDF document was generated and saved to your S3 Bucket');\n",[1638],{"type":23,"tag":36,"props":1639,"children":1640},{"__ignoreMap":8},[1641],{"type":28,"value":1636},{"type":23,"tag":24,"props":1643,"children":1644},{},[1645,1647,1652],{"type":28,"value":1646},"Once the conversion is done, PDFShift will save the content to your given ",{"type":23,"tag":36,"props":1648,"children":1650},{"className":1649},[],[1651],{"type":28,"value":1593},{"type":28,"value":1653}," path and will return a response with a JSON body, such as:",{"type":23,"tag":44,"props":1655,"children":1658},{"className":1656,"code":1657,"language":574,"meta":8},[573],"{\n    \"success\": true,\n    \"url\": \"https://DOC-EXAMPLE-BUCKET.s3.amazonaws.com/test/example.pdf\",\n    \"filesize\": 34980,\n    \"duration\": 1423,\n    \"response\": {\n        \"status-code\": 200,\n        \"content-length\": 0,\n        \"requests\": 0,\n        \"duration\": 1263.254446029663\n    },\n    \"executed\": \"2024-03-06T10:13:33.154960\",\n    \"pdf_pages\": 1\n}\n",[1659],{"type":23,"tag":36,"props":1660,"children":1661},{"__ignoreMap":8},[1662],{"type":28,"value":1657},{"type":23,"tag":24,"props":1664,"children":1665},{},[1666],{"type":28,"value":1667},"In the event you haven't setup the permissions properly, PDFShift will fail with the following JSON body error:",{"type":23,"tag":44,"props":1669,"children":1672},{"className":1670,"code":1671,"language":574,"meta":8},[573],"{\n    \"success\": false,\n    \"error\": \"The S3 destination you provided can not be accessed.\",\n    \"code\": 400\n}\n",[1673],{"type":23,"tag":36,"props":1674,"children":1675},{"__ignoreMap":8},[1676],{"type":28,"value":1671},{"type":23,"tag":24,"props":1678,"children":1679},{},[1680],{"type":28,"value":1681},"This features is really interesting as it allows you to not have to write the logic once the file was generated if your intention is to backup the file (such as an invoice, a report or saving a document).",{"type":23,"tag":24,"props":1683,"children":1684},{},[1685,1687,1692],{"type":28,"value":1686},"You can couple it with the ",{"type":23,"tag":36,"props":1688,"children":1690},{"className":1689},[],[1691],{"type":28,"value":1405},{"type":28,"value":1693}," parameter to increase the speed of processing. By doing so, PDFShift will treat your conversion request asynchronously and save the document in the given path. The request made to PDFShift will be immediate.",{"title":8,"searchDepth":61,"depth":61,"links":1695},[],"content:guides:node:axios:save-your-pdf-to-your-amazon-s3-bucket.md","guides/node/axios/save-your-pdf-to-your-amazon-s3-bucket.md",{"_path":1699,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":1700,"description":1701,"language":11,"library":12,"property":1702,"output":14,"related":1703,"default":18,"body":1705,"_type":63,"_id":1733,"_source":65,"_file":1734,"_extension":67},"/guides/node/axios/send-custom-http-headers","Send custom HTTP headers","Learn how to add custom HTTP headers when requesting an URL to be converted in PDF with PDFShift's API. It allows you to add specific headers that your backend can check against to authenticate a query before converting it to PDF. This guide explains you how using Node and the Axios library.","http_headers",[17,1704],"accessing-secured-pages",{"type":20,"children":1706,"toc":1731},[1707,1712,1717,1726],{"type":23,"tag":24,"props":1708,"children":1709},{},[1710],{"type":28,"value":1711},"In this guide, we'll walk you through the process of sending custom HTTP headers when requesting an URL to be converted to PDF using PDFShift's API.",{"type":23,"tag":24,"props":1713,"children":1714},{},[1715],{"type":28,"value":1716},"This can be useful to pass custom parameters to your server. It can help for instance to identify from where is coming the request, and add some extra layer of security.",{"type":23,"tag":44,"props":1718,"children":1721},{"className":1719,"code":1720,"language":49,"meta":8},[47],"const axios = require('axios');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    http_headers: {\n        'x-custom-header': 'custom-value',\n        Authorization: 'Bearer {token}'  // This allows you to authenticate PDFShift to your service in a custom way\n    }\n}\n\nconst response = await axios.post(\n    `https://api.pdfshift.io/v3/convert/pdf`,\n    params,\n    {\n        headers: { 'X-API-Key': api_key }\n    }\n});\n\n// Handle errors:\nif (response.status >= 400) {\n    throw new Error(`Request failed with status code ${response.status}: ${response.data}`);\n}\n\nfs.writeFileSync('result.pdf', response.data);\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[1722],{"type":23,"tag":36,"props":1723,"children":1724},{"__ignoreMap":8},[1725],{"type":28,"value":1720},{"type":23,"tag":24,"props":1727,"children":1728},{},[1729],{"type":28,"value":1730},"This allows you to set specific HTTP headers that will be send along with the request PDFShift will make to your server.\nIt can be helpful to authenticate the request that your backend can check against before converting it to PDF.",{"title":8,"searchDepth":61,"depth":61,"links":1732},[],"content:guides:node:axios:send-custom-http-headers.md","guides/node/axios/send-custom-http-headers.md",{"_path":1736,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":1737,"description":1738,"language":11,"library":12,"property":1739,"output":14,"related":1740,"default":18,"body":1741,"_type":63,"_id":1834,"_source":65,"_file":1835,"_extension":67},"/guides/node/axios/using-cookies","Using cookies to convert HTML documents to PDF","Learn how to add custom Cookies when requesting an URL to be converted in PDF with PDFShift's API. It allows you to pursue an active session for instance, that will authenticate the request as a specific user before converting the page to PDF. This guide explains you how using Node and the Axios library.","cookies",[16,1704],{"type":20,"children":1742,"toc":1832},[1743,1748,1760,1769,1780,1827],{"type":23,"tag":24,"props":1744,"children":1745},{},[1746],{"type":28,"value":1747},"In this comprehensive guide, we will demonstrate the step-by-step process of incorporating custom Cookies into your URL request for PDF conversion using PDFShift's API. By leveraging this functionality, you can maintain an active session, enabling authentication as a specific user before generating the PDF document.",{"type":23,"tag":24,"props":1749,"children":1750},{},[1751,1753,1758],{"type":28,"value":1752},"To do so, we'll use the ",{"type":23,"tag":36,"props":1754,"children":1756},{"className":1755},[],[1757],{"type":28,"value":1739},{"type":28,"value":1759}," parameter when sending a request to PDFShift. It expects a list of dictionnary that contains the name and the value of the cookies (more details after):",{"type":23,"tag":44,"props":1761,"children":1764},{"className":1762,"code":1763,"language":49,"meta":8},[47],"const axios = require('axios');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    // The \"cookies\" parameter expects a list of dictionnary that contains the name and the value of the cookies\n    cookies: [\n        { name: 'PHPSESSID', value: 'el4ukv0kqbvoirg7nkp4dncpk3' }\n    ]\n}\n\nconst response = await axios.post(\n    `https://api.pdfshift.io/v3/convert/pdf`,\n    params,\n    {\n        headers: { 'X-API-Key': api_key }\n    }\n});\n\n// Handle errors:\nif (response.status >= 400) {\n    throw new Error(`Request failed with status code ${response.status}: ${response.data}`);\n}\n\nfs.writeFileSync('result.pdf', response.data);\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[1765],{"type":23,"tag":36,"props":1766,"children":1767},{"__ignoreMap":8},[1768],{"type":28,"value":1763},{"type":23,"tag":24,"props":1770,"children":1771},{},[1772,1773,1778],{"type":28,"value":117},{"type":23,"tag":36,"props":1774,"children":1776},{"className":1775},[],[1777],{"type":28,"value":1739},{"type":28,"value":1779}," parameter accept the following parameters:",{"type":23,"tag":126,"props":1781,"children":1782},{},[1783,1794,1805,1816],{"type":23,"tag":130,"props":1784,"children":1785},{},[1786,1792],{"type":23,"tag":36,"props":1787,"children":1789},{"className":1788},[],[1790],{"type":28,"value":1791},"name",{"type":28,"value":1793}," : The name of the cookie.",{"type":23,"tag":130,"props":1795,"children":1796},{},[1797,1803],{"type":23,"tag":36,"props":1798,"children":1800},{"className":1799},[],[1801],{"type":28,"value":1802},"value",{"type":28,"value":1804},": The value of the cookie.",{"type":23,"tag":130,"props":1806,"children":1807},{},[1808,1814],{"type":23,"tag":36,"props":1809,"children":1811},{"className":1810},[],[1812],{"type":28,"value":1813},"secure",{"type":28,"value":1815},": A boolean (defaults to false) that will tell the browser to only send the cookie if the request is being sent over HTTPS.",{"type":23,"tag":130,"props":1817,"children":1818},{},[1819,1825],{"type":23,"tag":36,"props":1820,"children":1822},{"className":1821},[],[1823],{"type":28,"value":1824},"http_only",{"type":28,"value":1826},": A boolean (defaults to false) that will tell the browser to not expose it to client-side scripts.",{"type":23,"tag":24,"props":1828,"children":1829},{},[1830],{"type":28,"value":1831},"Like in our guide to send custom HTTP headers or to access secured pages, this allows you to protect your documents from any visitors while allowing PDFShift to access the page and convert it to PDF.",{"title":8,"searchDepth":61,"depth":61,"links":1833},[],"content:guides:node:axios:using-cookies.md","guides/node/axios/using-cookies.md",{"_path":1837,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":1838,"description":1839,"language":11,"library":12,"property":1840,"output":14,"related":1841,"default":18,"body":1843,"_type":63,"_id":2001,"_source":65,"_file":2002,"_extension":67},"/guides/node/axios/waiting-for-a-custom-element-to-be-ready","Waiting for a custom element to be ready","Learn how to set up a custom javascript function that will waits for a specific condition to become true before allowing the conversion to happen. This is very interesting for waiting on charts to be generated, or custom fonts to be loaded. With PDFShift's API, this can easily be done using Node and the Axios library.","wait_for",[1842,76],"define-a-time-limit",{"type":20,"children":1844,"toc":1999},[1845,1856,1868,1880,1892,1903,1908,1917,1950,1959,1964,1973],{"type":23,"tag":24,"props":1846,"children":1847},{},[1848,1849,1854],{"type":28,"value":117},{"type":23,"tag":36,"props":1850,"children":1852},{"className":1851},[],[1853],{"type":28,"value":1840},{"type":28,"value":1855}," parameter is one of the most powerful feature of PDFShift. It allows you to control when the document is ready to be converted to PDF.",{"type":23,"tag":24,"props":1857,"children":1858},{},[1859,1861,1866],{"type":28,"value":1860},"For instance, you might need the ",{"type":23,"tag":36,"props":1862,"children":1864},{"className":1863},[],[1865],{"type":28,"value":1840},{"type":28,"value":1867}," parameter to wait on your charts to be visible.",{"type":23,"tag":24,"props":1869,"children":1870},{},[1871,1873,1878],{"type":28,"value":1872},"It makes sense because from our engine point of view, all the resources are loaded so the conversion to PDF can be executed. But from your page stand point, even though everything is loaded, ",{"type":23,"tag":106,"props":1874,"children":1875},{},[1876],{"type":28,"value":1877},"not everything is rendered",{"type":28,"value":1879},"!",{"type":23,"tag":24,"props":1881,"children":1882},{},[1883,1885,1890],{"type":28,"value":1884},"So by using the ",{"type":23,"tag":36,"props":1886,"children":1888},{"className":1887},[],[1889],{"type":28,"value":1840},{"type":28,"value":1891}," parameter, you can tell PDFShift to wait for a specific condition to be true before allowing the conversion to happen.",{"type":23,"tag":24,"props":1893,"children":1894},{},[1895,1897,1902],{"type":28,"value":1896},"That property ",{"type":23,"tag":199,"props":1898,"children":1899},{},[1900],{"type":28,"value":1901},"expects a string which points to a global function",{"type":28,"value":183},{"type":23,"tag":24,"props":1904,"children":1905},{},[1906],{"type":28,"value":1907},"For instance, if in your HTML page, you have the following script:",{"type":23,"tag":44,"props":1909,"children":1912},{"className":1910,"code":1911,"language":49,"meta":8},[47],"\u003Cscript>\nfunction isPageReady() {\n    return document.getElementById('chart').clientHeight > 0;\n}\n\u003C/script>\n",[1913],{"type":23,"tag":36,"props":1914,"children":1915},{"__ignoreMap":8},[1916],{"type":28,"value":1911},{"type":23,"tag":24,"props":1918,"children":1919},{},[1920,1922,1927,1928,1934,1936,1941,1943,1948],{"type":28,"value":1921},"You can set the ",{"type":23,"tag":36,"props":1923,"children":1925},{"className":1924},[],[1926],{"type":28,"value":1840},{"type":28,"value":609},{"type":23,"tag":36,"props":1929,"children":1931},{"className":1930},[],[1932],{"type":28,"value":1933},"isPageReady",{"type":28,"value":1935}," and PDFShift will wait for the ",{"type":23,"tag":36,"props":1937,"children":1939},{"className":1938},[],[1940],{"type":28,"value":1933},{"type":28,"value":1942}," function to return ",{"type":23,"tag":36,"props":1944,"children":1946},{"className":1945},[],[1947],{"type":28,"value":644},{"type":28,"value":1949}," before converting the page to PDF.",{"type":23,"tag":44,"props":1951,"children":1954},{"className":1952,"code":1953,"language":49,"meta":8},[47],"const axios = require('axios');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    wait_for: 'isPageReady'\n}\n\nconst response = await axios.post(\n    `https://api.pdfshift.io/v3/convert/pdf`,\n    params,\n    {\n        headers: { 'X-API-Key': api_key }\n    }\n});\n\n// Handle errors:\nif (response.status >= 400) {\n    throw new Error(`Request failed with status code ${response.status}: ${response.data}`);\n}\n\nfs.writeFileSync('result.pdf', response.data);\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[1955],{"type":23,"tag":36,"props":1956,"children":1957},{"__ignoreMap":8},[1958],{"type":28,"value":1953},{"type":23,"tag":24,"props":1960,"children":1961},{},[1962],{"type":28,"value":1963},"In case your page doesn't have the javascript function available, but you still need to wait on some elements to be rendered before continuing the conversion, you can add javascript code directly in the request and use it at the same time:",{"type":23,"tag":44,"props":1965,"children":1968},{"className":1966,"code":1967,"language":49,"meta":8},[47],"const axios = require('axios');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    javascript: 'let isFontReady = false; document.fonts.ready.then(() => isFontReady = true); function isPageReady() { return isFontReady; }',\n    wait_for: 'isPageReady'\n}\n\nconst response = await axios.post(\n    `https://api.pdfshift.io/v3/convert/pdf`,\n    params,\n    {\n        headers: { 'X-API-Key': api_key }\n    }\n});\n\n// Handle errors:\nif (response.status >= 400) {\n    throw new Error(`Request failed with status code ${response.status}: ${response.data}`);\n}\n\nfs.writeFileSync('result.pdf', response.data);\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[1969],{"type":23,"tag":36,"props":1970,"children":1971},{"__ignoreMap":8},[1972],{"type":28,"value":1967},{"type":23,"tag":24,"props":1974,"children":1975},{},[1976,1978,1983,1985,1990,1992,1997],{"type":28,"value":1977},"The above script will wait for all fonts to be ready before returning ",{"type":23,"tag":36,"props":1979,"children":1981},{"className":1980},[],[1982],{"type":28,"value":644},{"type":28,"value":1984}," for the ",{"type":23,"tag":36,"props":1986,"children":1988},{"className":1987},[],[1989],{"type":28,"value":1933},{"type":28,"value":1991}," function.\nPDFShift will then wait for the fonts to be ready, via the ",{"type":23,"tag":36,"props":1993,"children":1995},{"className":1994},[],[1996],{"type":28,"value":1933},{"type":28,"value":1998},", before converting the page to PDF.",{"title":8,"searchDepth":61,"depth":61,"links":2000},[],"content:guides:node:axios:waiting-for-a-custom-element-to-be-ready.md","guides/node/axios/waiting-for-a-custom-element-to-be-ready.md",{"_path":2004,"_dir":2005,"_draft":7,"_partial":7,"_locale":8,"title":9,"description":2006,"language":11,"library":2007,"property":13,"output":14,"related":2008,"default":7,"body":2009,"_type":63,"_id":2041,"_source":65,"_file":2042,"_extension":67},"/guides/node/bent/accessing-secured-pages","bent","Learn how to access secured pages using Node and the Bent library. This guide offers detailed steps with code samples in Node and the Bent library, highlighting how you can acces page protected by basic authentication to convert them to PDF using PDFShift's API.","Bent",[16,17],{"type":20,"children":2010,"toc":2039},[2011,2016,2026,2035],{"type":23,"tag":24,"props":2012,"children":2013},{},[2014],{"type":28,"value":2015},"In this guide, we'll show you how to access secured page (protected by basic authentication) using Node and the Bent library to convert them to PDF using PDFShift's API.",{"type":23,"tag":24,"props":2017,"children":2018},{},[2019,2020,2025],{"type":28,"value":34},{"type":23,"tag":36,"props":2021,"children":2023},{"className":2022},[],[2024],{"type":28,"value":13},{"type":28,"value":42},{"type":23,"tag":44,"props":2027,"children":2030},{"className":2028,"code":2029,"language":49,"meta":8},[47],"const bent = require('bent')\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    // You can set a basic authentication by passing the \"auth\" property which contains a username and password\n    auth: {\n        username: 'user',\n        password: 'password'\n    }\n}\n\nconst post = bent('https://api.pdfshift.io/v3/convert/pdf', 'POST', 'json', 200);\nconst response = await post('', params, {'X-API-Key': apiKey});\n\nif (response.status >= 400) {\n    throw new Error(`Request failed with status code ${response.status}: ${response.data}`);\n}\n\nconst getBuffer = bent('buffer')\nfs.writeFileSync('result.pdf', await getBuffer(response));\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[2031],{"type":23,"tag":36,"props":2032,"children":2033},{"__ignoreMap":8},[2034],{"type":28,"value":2029},{"type":23,"tag":24,"props":2036,"children":2037},{},[2038],{"type":28,"value":59},{"title":8,"searchDepth":61,"depth":61,"links":2040},[],"content:guides:node:bent:accessing-secured-pages.md","guides/node/bent/accessing-secured-pages.md",{"_path":2044,"_dir":2005,"_draft":7,"_partial":7,"_locale":8,"title":70,"description":2045,"language":11,"library":2007,"property":72,"output":14,"related":2046,"default":7,"body":2047,"_type":63,"_id":2234,"_source":65,"_file":2235,"_extension":67},"/guides/node/bent/adding-a-custom-header-or-footer","Discover how to add custom headers or footers to a PDF using Node and the Bent library. This in-depth guide includes Node codes that you can easily follow and quickly generate documents with PDFShift's API.",[74,75,76,77],{"type":20,"children":2048,"toc":2232},[2049,2054,2075,2085,2139,2147,2151,2160,2170,2174,2228],{"type":23,"tag":24,"props":2050,"children":2051},{},[2052],{"type":28,"value":2053},"In this guide, we'll show you how to add custom headers or footers to a PDF using Node and the Bent library.",{"type":23,"tag":24,"props":2055,"children":2056},{},[2057,2058,2063,2064,2069,2070,2074],{"type":28,"value":89},{"type":23,"tag":36,"props":2059,"children":2061},{"className":2060},[],[2062],{"type":28,"value":72},{"type":28,"value":96},{"type":23,"tag":36,"props":2065,"children":2067},{"className":2066},[],[2068],{"type":28,"value":102},{"type":28,"value":104},{"type":23,"tag":106,"props":2071,"children":2072},{},[2073],{"type":28,"value":110},{"type":28,"value":112},{"type":23,"tag":24,"props":2076,"children":2077},{},[2078,2079,2084],{"type":28,"value":117},{"type":23,"tag":36,"props":2080,"children":2082},{"className":2081},[],[2083],{"type":28,"value":72},{"type":28,"value":124},{"type":23,"tag":126,"props":2086,"children":2087},{},[2088,2097,2130],{"type":23,"tag":130,"props":2089,"children":2090},{},[2091,2096],{"type":23,"tag":36,"props":2092,"children":2094},{"className":2093},[],[2095],{"type":28,"value":138},{"type":28,"value":140},{"type":23,"tag":130,"props":2098,"children":2099},{},[2100,2105,2106,2111,2112,2117,2118,2123,2124,2129],{"type":23,"tag":36,"props":2101,"children":2103},{"className":2102},[],[2104],{"type":28,"value":149},{"type":28,"value":151},{"type":23,"tag":36,"props":2107,"children":2109},{"className":2108},[],[2110],{"type":28,"value":157},{"type":28,"value":159},{"type":23,"tag":36,"props":2113,"children":2115},{"className":2114},[],[2116],{"type":28,"value":165},{"type":28,"value":167},{"type":23,"tag":36,"props":2119,"children":2121},{"className":2120},[],[2122],{"type":28,"value":173},{"type":28,"value":175},{"type":23,"tag":36,"props":2125,"children":2127},{"className":2126},[],[2128],{"type":28,"value":181},{"type":28,"value":183},{"type":23,"tag":130,"props":2131,"children":2132},{},[2133,2138],{"type":23,"tag":36,"props":2134,"children":2136},{"className":2135},[],[2137],{"type":28,"value":192},{"type":28,"value":194},{"type":23,"tag":24,"props":2140,"children":2141},{},[2142,2146],{"type":23,"tag":199,"props":2143,"children":2144},{},[2145],{"type":28,"value":203},{"type":28,"value":205},{"type":23,"tag":24,"props":2148,"children":2149},{},[2150],{"type":28,"value":210},{"type":23,"tag":44,"props":2152,"children":2155},{"className":2153,"code":2154,"language":49,"meta":8},[47],"const bent = require('bent')\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://en.wikipedia.org/wiki/PDF',\n    header: {\n        source: '\u003Cdiv>Page {{ page }} over a total of {{ total }}. Made on {{ date }}\u003C/div>',\n        height: 150,\n        start_at: 2\n    }\n}\n\nconst post = bent('https://api.pdfshift.io/v3/convert/pdf', 'POST', 'json', 200);\nconst response = await post('', params, {'X-API-Key': apiKey});\n\nif (response.status >= 400) {\n    throw new Error(`Request failed with status code ${response.status}: ${response.data}`);\n}\n\nconst getBuffer = bent('buffer')\nfs.writeFileSync('result.pdf', await getBuffer(response));\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[2156],{"type":23,"tag":36,"props":2157,"children":2158},{"__ignoreMap":8},[2159],{"type":28,"value":2154},{"type":23,"tag":24,"props":2161,"children":2162},{},[2163,2164,2169],{"type":28,"value":117},{"type":23,"tag":36,"props":2165,"children":2167},{"className":2166},[],[2168],{"type":28,"value":138},{"type":28,"value":230},{"type":23,"tag":24,"props":2171,"children":2172},{},[2173],{"type":28,"value":235},{"type":23,"tag":126,"props":2175,"children":2176},{},[2177,2186,2195,2204,2213],{"type":23,"tag":130,"props":2178,"children":2179},{},[2180,2185],{"type":23,"tag":36,"props":2181,"children":2183},{"className":2182},[],[2184],{"type":28,"value":247},{"type":28,"value":249},{"type":23,"tag":130,"props":2187,"children":2188},{},[2189,2194],{"type":23,"tag":36,"props":2190,"children":2192},{"className":2191},[],[2193],{"type":28,"value":258},{"type":28,"value":260},{"type":23,"tag":130,"props":2196,"children":2197},{},[2198,2203],{"type":23,"tag":36,"props":2199,"children":2201},{"className":2200},[],[2202],{"type":28,"value":269},{"type":28,"value":271},{"type":23,"tag":130,"props":2205,"children":2206},{},[2207,2212],{"type":23,"tag":36,"props":2208,"children":2210},{"className":2209},[],[2211],{"type":28,"value":280},{"type":28,"value":282},{"type":23,"tag":130,"props":2214,"children":2215},{},[2216,2221,2222,2227],{"type":23,"tag":36,"props":2217,"children":2219},{"className":2218},[],[2220],{"type":28,"value":291},{"type":28,"value":293},{"type":23,"tag":36,"props":2223,"children":2225},{"className":2224},[],[2226],{"type":28,"value":299},{"type":28,"value":301},{"type":23,"tag":24,"props":2229,"children":2230},{},[2231],{"type":28,"value":306},{"title":8,"searchDepth":61,"depth":61,"links":2233},[],"content:guides:node:bent:adding-a-custom-header-or-footer.md","guides/node/bent/adding-a-custom-header-or-footer.md",{"_path":2237,"_dir":2005,"_draft":7,"_partial":7,"_locale":8,"title":313,"description":2238,"language":11,"library":2007,"property":315,"output":14,"related":2239,"default":7,"body":2240,"_type":63,"_id":2369,"_source":65,"_file":2370,"_extension":67},"/guides/node/bent/adding-a-text-watermark","Learn how to add text watermarks to your generated PDF document using Node and the Bent library. With this guide, you'll be able to add watermarks on top of your generated PDFs easily with a quick request to PDFShift's API.",[317,318],{"type":20,"children":2241,"toc":2367},[2242,2246,2256,2265,2269,2326,2330,2351,2355,2359],{"type":23,"tag":24,"props":2243,"children":2244},{},[2245],{"type":28,"value":325},{"type":23,"tag":24,"props":2247,"children":2248},{},[2249,2250,2255],{"type":28,"value":330},{"type":23,"tag":36,"props":2251,"children":2253},{"className":2252},[],[2254],{"type":28,"value":315},{"type":28,"value":337},{"type":23,"tag":44,"props":2257,"children":2260},{"className":2258,"code":2259,"language":49,"meta":8},[47],"const bent = require('bent')\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    watermark: {\n        text: 'PROTECTED DOCUMENT',\n        offset_x: 'center',\n        offset_top: 'top'\n    }\n}\n\nconst post = bent('https://api.pdfshift.io/v3/convert/pdf', 'POST', 'json', 200);\nconst response = await post('', params, {'X-API-Key': apiKey});\n\nif (response.status >= 400) {\n    throw new Error(`Request failed with status code ${response.status}: ${response.data}`);\n}\n\nconst getBuffer = bent('buffer')\nfs.writeFileSync('result.pdf', await getBuffer(response));\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[2261],{"type":23,"tag":36,"props":2262,"children":2263},{"__ignoreMap":8},[2264],{"type":28,"value":2259},{"type":23,"tag":24,"props":2266,"children":2267},{},[2268],{"type":28,"value":351},{"type":23,"tag":126,"props":2270,"children":2271},{},[2272,2281,2290,2299,2308,2317],{"type":23,"tag":130,"props":2273,"children":2274},{},[2275,2280],{"type":23,"tag":36,"props":2276,"children":2278},{"className":2277},[],[2279],{"type":28,"value":363},{"type":28,"value":365},{"type":23,"tag":130,"props":2282,"children":2283},{},[2284,2289],{"type":23,"tag":36,"props":2285,"children":2287},{"className":2286},[],[2288],{"type":28,"value":374},{"type":28,"value":376},{"type":23,"tag":130,"props":2291,"children":2292},{},[2293,2298],{"type":23,"tag":36,"props":2294,"children":2296},{"className":2295},[],[2297],{"type":28,"value":385},{"type":28,"value":387},{"type":23,"tag":130,"props":2300,"children":2301},{},[2302,2307],{"type":23,"tag":36,"props":2303,"children":2305},{"className":2304},[],[2306],{"type":28,"value":396},{"type":28,"value":398},{"type":23,"tag":130,"props":2309,"children":2310},{},[2311,2316],{"type":23,"tag":36,"props":2312,"children":2314},{"className":2313},[],[2315],{"type":28,"value":407},{"type":28,"value":409},{"type":23,"tag":130,"props":2318,"children":2319},{},[2320,2325],{"type":23,"tag":36,"props":2321,"children":2323},{"className":2322},[],[2324],{"type":28,"value":418},{"type":28,"value":420},{"type":23,"tag":24,"props":2327,"children":2328},{},[2329],{"type":28,"value":425},{"type":23,"tag":126,"props":2331,"children":2332},{},[2333,2342],{"type":23,"tag":130,"props":2334,"children":2335},{},[2336,2341],{"type":23,"tag":36,"props":2337,"children":2339},{"className":2338},[],[2340],{"type":28,"value":437},{"type":28,"value":439},{"type":23,"tag":130,"props":2343,"children":2344},{},[2345,2350],{"type":23,"tag":36,"props":2346,"children":2348},{"className":2347},[],[2349],{"type":28,"value":448},{"type":28,"value":450},{"type":23,"tag":24,"props":2352,"children":2353},{},[2354],{"type":28,"value":455},{"type":23,"tag":24,"props":2356,"children":2357},{},[2358],{"type":28,"value":460},{"type":23,"tag":44,"props":2360,"children":2362},{"className":2361,"code":464,"language":49,"meta":8},[47],[2363],{"type":23,"tag":36,"props":2364,"children":2365},{"__ignoreMap":8},[2366],{"type":28,"value":464},{"title":8,"searchDepth":61,"depth":61,"links":2368},[],"content:guides:node:bent:adding-a-text-watermark.md","guides/node/bent/adding-a-text-watermark.md",{"_path":2372,"_dir":2005,"_draft":7,"_partial":7,"_locale":8,"title":476,"description":2373,"language":11,"library":2007,"property":315,"output":14,"related":2374,"default":7,"body":2375,"_type":63,"_id":2468,"_source":65,"_file":2469,"_extension":67},"/guides/node/bent/adding-an-image-watermark","Discover how to effortlessly add image watermarks to PDFs using Node and the Bent library. Our guide shows you how to add images on top of your PDF to protect your document easily. This is easily done with a simple request to PDFShift's API.",[318,479],{"type":20,"children":2376,"toc":2466},[2377,2381,2391,2400,2404,2415,2425,2429,2450,2454,2458],{"type":23,"tag":24,"props":2378,"children":2379},{},[2380],{"type":28,"value":325},{"type":23,"tag":24,"props":2382,"children":2383},{},[2384,2385,2390],{"type":28,"value":330},{"type":23,"tag":36,"props":2386,"children":2388},{"className":2387},[],[2389],{"type":28,"value":315},{"type":28,"value":496},{"type":23,"tag":44,"props":2392,"children":2395},{"className":2393,"code":2394,"language":49,"meta":8},[47],"const bent = require('bent')\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    watermark: {\n        image: 'https://placekitten.com/200/300',\n        offset_x: 'center',\n        offset_top: 'top'\n    }\n}\n\nconst post = bent('https://api.pdfshift.io/v3/convert/pdf', 'POST', 'json', 200);\nconst response = await post('', params, {'X-API-Key': apiKey});\n\nif (response.status >= 400) {\n    throw new Error(`Request failed with status code ${response.status}: ${response.data}`);\n}\n\nconst getBuffer = bent('buffer')\nfs.writeFileSync('result.pdf', await getBuffer(response));\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[2396],{"type":23,"tag":36,"props":2397,"children":2398},{"__ignoreMap":8},[2399],{"type":28,"value":2394},{"type":23,"tag":24,"props":2401,"children":2402},{},[2403],{"type":28,"value":510},{"type":23,"tag":126,"props":2405,"children":2406},{},[2407,2411],{"type":23,"tag":130,"props":2408,"children":2409},{},[2410],{"type":28,"value":518},{"type":23,"tag":130,"props":2412,"children":2413},{},[2414],{"type":28,"value":523},{"type":23,"tag":24,"props":2416,"children":2417},{},[2418,2419,2424],{"type":28,"value":528},{"type":23,"tag":36,"props":2420,"children":2422},{"className":2421},[],[2423],{"type":28,"value":534},{"type":28,"value":536},{"type":23,"tag":24,"props":2426,"children":2427},{},[2428],{"type":28,"value":425},{"type":23,"tag":126,"props":2430,"children":2431},{},[2432,2441],{"type":23,"tag":130,"props":2433,"children":2434},{},[2435,2440],{"type":23,"tag":36,"props":2436,"children":2438},{"className":2437},[],[2439],{"type":28,"value":437},{"type":28,"value":439},{"type":23,"tag":130,"props":2442,"children":2443},{},[2444,2449],{"type":23,"tag":36,"props":2445,"children":2447},{"className":2446},[],[2448],{"type":28,"value":448},{"type":28,"value":450},{"type":23,"tag":24,"props":2451,"children":2452},{},[2453],{"type":28,"value":455},{"type":23,"tag":24,"props":2455,"children":2456},{},[2457],{"type":28,"value":460},{"type":23,"tag":44,"props":2459,"children":2461},{"className":2460,"code":464,"language":574,"meta":8},[573],[2462],{"type":23,"tag":36,"props":2463,"children":2464},{"__ignoreMap":8},[2465],{"type":28,"value":464},{"title":8,"searchDepth":61,"depth":61,"links":2467},[],"content:guides:node:bent:adding-an-image-watermark.md","guides/node/bent/adding-an-image-watermark.md",{"_path":2471,"_dir":2005,"_draft":7,"_partial":7,"_locale":8,"title":586,"description":2472,"language":11,"library":2007,"property":588,"output":14,"related":2473,"default":7,"body":2474,"_type":63,"_id":2523,"_source":65,"_file":2524,"_extension":67},"/guides/node/bent/avoid-conversion-on-error","Learn how to avoid the conversion on error when loading the document using Node and the Bent library and relies on the PDFShift's API.",[590],{"type":20,"children":2475,"toc":2521},[2476,2480,2496,2505],{"type":23,"tag":24,"props":2477,"children":2478},{},[2479],{"type":28,"value":597},{"type":23,"tag":24,"props":2481,"children":2482},{},[2483,2484,2489,2490,2495],{"type":28,"value":602},{"type":23,"tag":36,"props":2485,"children":2487},{"className":2486},[],[2488],{"type":28,"value":588},{"type":28,"value":609},{"type":23,"tag":36,"props":2491,"children":2493},{"className":2492},[],[2494],{"type":28,"value":615},{"type":28,"value":617},{"type":23,"tag":44,"props":2497,"children":2500},{"className":2498,"code":2499,"language":49,"meta":8},[47],"const bent = require('bent')\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.httpstat.us/404',\n    raise_for_status: True\n}\n\nconst post = bent('https://api.pdfshift.io/v3/convert/pdf', 'POST', 'json', 200);\nconst response = await post('', params, {'X-API-Key': apiKey});\n\nif (response.status >= 400) {\n    throw new Error(`Request failed with status code ${response.status}: ${response.data}`);\n}\n\nconst getBuffer = bent('buffer')\nfs.writeFileSync('result.pdf', await getBuffer(response));\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[2501],{"type":23,"tag":36,"props":2502,"children":2503},{"__ignoreMap":8},[2504],{"type":28,"value":2499},{"type":23,"tag":24,"props":2506,"children":2507},{},[2508,2509,2514,2515,2520],{"type":28,"value":631},{"type":23,"tag":36,"props":2510,"children":2512},{"className":2511},[],[2513],{"type":28,"value":588},{"type":28,"value":638},{"type":23,"tag":36,"props":2516,"children":2518},{"className":2517},[],[2519],{"type":28,"value":644},{"type":28,"value":646},{"title":8,"searchDepth":61,"depth":61,"links":2522},[],"content:guides:node:bent:avoid-conversion-on-error.md","guides/node/bent/avoid-conversion-on-error.md",{"_path":2526,"_dir":2005,"_draft":7,"_partial":7,"_locale":8,"title":653,"description":2527,"language":11,"library":2007,"property":138,"output":14,"related":2528,"default":7,"body":2529,"_type":63,"_id":2550,"_source":65,"_file":2551,"_extension":67},"/guides/node/bent/convert-html-to-pdf-from-a-url","Learn how to easily convert HTML documents to PDF from a URL using Node and the Bent library. This how-to guide offers clear Node code examples that show developers how to implement this using the PDFShift API.",[590,656],{"type":20,"children":2530,"toc":2548},[2531,2535,2544],{"type":23,"tag":24,"props":2532,"children":2533},{},[2534],{"type":28,"value":663},{"type":23,"tag":44,"props":2536,"children":2539},{"className":2537,"code":2538,"language":49,"meta":8},[47],"const bent = require('bent')\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n}\n\nconst post = bent('https://api.pdfshift.io/v3/convert/pdf', 'POST', 'json', 200);\nconst response = await post('', params, {'X-API-Key': apiKey});\n\nif (response.status >= 400) {\n    throw new Error(`Request failed with status code ${response.status}: ${response.data}`);\n}\n\nconst getBuffer = bent('buffer')\nfs.writeFileSync('result.pdf', await getBuffer(response));\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[2540],{"type":23,"tag":36,"props":2541,"children":2542},{"__ignoreMap":8},[2543],{"type":28,"value":2538},{"type":23,"tag":24,"props":2545,"children":2546},{},[2547],{"type":28,"value":677},{"title":8,"searchDepth":61,"depth":61,"links":2549},[],"content:guides:node:bent:convert-html-to-pdf-from-a-url.md","guides/node/bent/convert-html-to-pdf-from-a-url.md",{"_path":2553,"_dir":2005,"_draft":7,"_partial":7,"_locale":8,"title":684,"description":2554,"language":11,"library":2007,"output":14,"related":2555,"default":7,"body":2556,"_type":63,"_id":2629,"_source":65,"_file":2630,"_extension":67},"/guides/node/bent/convert-html-to-pdf-from-raw-html","Learn how to to convert raw HTML document to PDF using Node and the Bent library. Our guide will explain you how to quickly convert documents with PDFShift's API.",[687],{"type":20,"children":2557,"toc":2627},[2558,2563,2578,2594,2604,2608,2617],{"type":23,"tag":24,"props":2559,"children":2560},{},[2561],{"type":28,"value":2562},"In this guide, we'll show you how to convert an HTML document to PDF using Node and the Bent library.\nProviding the HTML document as raw as a lot of great advantages :",{"type":23,"tag":126,"props":2564,"children":2565},{},[2566,2570,2574],{"type":23,"tag":130,"props":2567,"children":2568},{},[2569],{"type":28,"value":702},{"type":23,"tag":130,"props":2571,"children":2572},{},[2573],{"type":28,"value":707},{"type":23,"tag":130,"props":2575,"children":2576},{},[2577],{"type":28,"value":712},{"type":23,"tag":24,"props":2579,"children":2580},{},[2581,2582,2587,2588,2593],{"type":28,"value":717},{"type":23,"tag":36,"props":2583,"children":2585},{"className":2584},[],[2586],{"type":28,"value":723},{"type":28,"value":725},{"type":23,"tag":36,"props":2589,"children":2591},{"className":2590},[],[2592],{"type":28,"value":731},{"type":28,"value":733},{"type":23,"tag":24,"props":2595,"children":2596},{},[2597,2598,2603],{"type":28,"value":738},{"type":23,"tag":36,"props":2599,"children":2601},{"className":2600},[],[2602],{"type":28,"value":138},{"type":28,"value":745},{"type":23,"tag":24,"props":2605,"children":2606},{},[2607],{"type":28,"value":210},{"type":23,"tag":44,"props":2609,"children":2612},{"className":2610,"code":2611,"language":49,"meta":8},[47],"const bent = require('bent')\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: '\u003Chtml>\u003Cbody>\u003Ch1>This will be a PDF document\u003C/h1>\u003Cp>This will generate a basic PDF to show how you can add raw HTML\u003C/body>\u003C/html>',\n}\n\nconst post = bent('https://api.pdfshift.io/v3/convert/pdf', 'POST', 'json', 200);\nconst response = await post('', params, {'X-API-Key': apiKey});\n\nif (response.status >= 400) {\n    throw new Error(`Request failed with status code ${response.status}: ${response.data}`);\n}\n\nconst getBuffer = bent('buffer')\nfs.writeFileSync('result.pdf', await getBuffer(response));\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[2613],{"type":23,"tag":36,"props":2614,"children":2615},{"__ignoreMap":8},[2616],{"type":28,"value":2611},{"type":23,"tag":24,"props":2618,"children":2619},{},[2620,2621,2626],{"type":28,"value":763},{"type":23,"tag":36,"props":2622,"children":2624},{"className":2623},[],[2625],{"type":28,"value":138},{"type":28,"value":770},{"title":8,"searchDepth":61,"depth":61,"links":2628},[],"content:guides:node:bent:convert-html-to-pdf-from-raw-html.md","guides/node/bent/convert-html-to-pdf-from-raw-html.md",{"_path":2632,"_dir":2005,"_draft":7,"_partial":7,"_locale":8,"title":777,"description":2633,"language":11,"library":2007,"property":779,"output":14,"related":2634,"default":7,"body":2635,"_type":63,"_id":2675,"_source":65,"_file":2676,"_extension":67},"/guides/node/bent/define-a-time-limit","Learn how to set a conversion time limit at PDFShift. This will allow you to define a maximum time for the conversion process to complete, and if the process takes longer than the defined time, the conversion will be aborted. This guides explains you how to achieve it using Node and the Bent library.",[781],{"type":20,"children":2636,"toc":2673},[2637,2641,2645,2660,2669],{"type":23,"tag":24,"props":2638,"children":2639},{},[2640],{"type":28,"value":788},{"type":23,"tag":24,"props":2642,"children":2643},{},[2644],{"type":28,"value":793},{"type":23,"tag":24,"props":2646,"children":2647},{},[2648,2649,2654,2655,2659],{"type":28,"value":798},{"type":23,"tag":36,"props":2650,"children":2652},{"className":2651},[],[2653],{"type":28,"value":779},{"type":28,"value":805},{"type":23,"tag":199,"props":2656,"children":2657},{},[2658],{"type":28,"value":810},{"type":28,"value":812},{"type":23,"tag":44,"props":2661,"children":2664},{"className":2662,"code":2663,"language":49,"meta":8},[47],"const bent = require('bent')\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    timeout: 10\n}\n\nconst post = bent('https://api.pdfshift.io/v3/convert/pdf', 'POST', 'json', 200);\nconst response = await post('', params, {'X-API-Key': apiKey});\n\nif (response.status >= 400) {\n    throw new Error(`Request failed with status code ${response.status}: ${response.data}`);\n}\n\nconst getBuffer = bent('buffer')\nfs.writeFileSync('result.pdf', await getBuffer(response));\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[2665],{"type":23,"tag":36,"props":2666,"children":2667},{"__ignoreMap":8},[2668],{"type":28,"value":2663},{"type":23,"tag":24,"props":2670,"children":2671},{},[2672],{"type":28,"value":826},{"title":8,"searchDepth":61,"depth":61,"links":2674},[],"content:guides:node:bent:define-a-time-limit.md","guides/node/bent/define-a-time-limit.md",{"_path":2678,"_dir":2005,"_draft":7,"_partial":7,"_locale":8,"title":833,"description":2679,"language":11,"library":2007,"property":835,"output":14,"default":7,"body":2680,"_type":63,"_id":2757,"_source":65,"_file":2758,"_extension":67},"/guides/node/bent/exporting-only-a-specific-set-of-pages","Learn how to export only a specific set of pages from a document using Node and the Bent library. This guide offers detailed steps with code samples in Node and the Bent library, highlighting how you can export only a specific set of pages from a document using PDFShift's API.",{"type":20,"children":2681,"toc":2755},[2682,2687,2697,2701,2705,2738,2742,2746],{"type":23,"tag":24,"props":2683,"children":2684},{},[2685],{"type":28,"value":2686},"In this guide, we'll show you how to export only a specific set of pages from a document using Node and the Bent library to convert them to PDF using PDFShift's API.",{"type":23,"tag":24,"props":2688,"children":2689},{},[2690,2691,2696],{"type":28,"value":847},{"type":23,"tag":36,"props":2692,"children":2694},{"className":2693},[],[2695],{"type":28,"value":835},{"type":28,"value":42},{"type":23,"tag":24,"props":2698,"children":2699},{},[2700],{"type":28,"value":858},{"type":23,"tag":24,"props":2702,"children":2703},{},[2704],{"type":28,"value":863},{"type":23,"tag":126,"props":2706,"children":2707},{},[2708,2718,2728],{"type":23,"tag":130,"props":2709,"children":2710},{},[2711,2712,2717],{"type":28,"value":871},{"type":23,"tag":36,"props":2713,"children":2715},{"className":2714},[],[2716],{"type":28,"value":877},{"type":28,"value":879},{"type":23,"tag":130,"props":2719,"children":2720},{},[2721,2722,2727],{"type":28,"value":884},{"type":23,"tag":36,"props":2723,"children":2725},{"className":2724},[],[2726],{"type":28,"value":890},{"type":28,"value":892},{"type":23,"tag":130,"props":2729,"children":2730},{},[2731,2732,2737],{"type":28,"value":897},{"type":23,"tag":36,"props":2733,"children":2735},{"className":2734},[],[2736],{"type":28,"value":903},{"type":28,"value":905},{"type":23,"tag":24,"props":2739,"children":2740},{},[2741],{"type":28,"value":910},{"type":23,"tag":24,"props":2743,"children":2744},{},[2745],{"type":28,"value":210},{"type":23,"tag":44,"props":2747,"children":2750},{"className":2748,"code":2749,"language":49,"meta":8},[47],"const bent = require('bent')\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://en.wikipedia.org/wiki/PDF',\n    pages: '2-4'\n}\n\nconst post = bent('https://api.pdfshift.io/v3/convert/pdf', 'POST', 'json', 200);\nconst response = await post('', params, {'X-API-Key': apiKey});\n\nif (response.status >= 400) {\n    throw new Error(`Request failed with status code ${response.status}: ${response.data}`);\n}\n\nconst getBuffer = bent('buffer')\nfs.writeFileSync('result.pdf', await getBuffer(response));\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[2751],{"type":23,"tag":36,"props":2752,"children":2753},{"__ignoreMap":8},[2754],{"type":28,"value":2749},{"title":8,"searchDepth":61,"depth":61,"links":2756},[],"content:guides:node:bent:exporting-only-a-specific-set-of-pages.md","guides/node/bent/exporting-only-a-specific-set-of-pages.md",{"_path":2760,"_dir":2005,"_draft":7,"_partial":7,"_locale":8,"title":930,"description":2761,"language":11,"library":2007,"property":932,"output":14,"default":7,"body":2762,"_type":63,"_id":2865,"_source":65,"_file":2866,"_extension":67},"/guides/node/bent/generate-a-document-with-full-height","Learn to generate full-height documents dynamically with our step-by-step guide. This will allow you to create documents with a dynamic height, based on the content of the document. This guide provides Node code samples using the Bent library to help you generate full-height documents with PDFShift's API.",{"type":20,"children":2763,"toc":2863},[2764,2769,2785,2794,2798,2807,2823,2827,2835],{"type":23,"tag":24,"props":2765,"children":2766},{},[2767],{"type":28,"value":2768},"In this guide, we'll show you how to generate a document with full height dynamically using Node and the Bent library to convert them to PDF using PDFShift's API.",{"type":23,"tag":24,"props":2770,"children":2771},{},[2772,2773,2778,2779,2784],{"type":28,"value":944},{"type":23,"tag":36,"props":2774,"children":2776},{"className":2775},[],[2777],{"type":28,"value":932},{"type":28,"value":951},{"type":23,"tag":36,"props":2780,"children":2782},{"className":2781},[],[2783],{"type":28,"value":957},{"type":28,"value":959},{"type":23,"tag":44,"props":2786,"children":2789},{"className":2787,"code":2788,"language":49,"meta":8},[47],"const bent = require('bent')\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    format: '1280xauto'\n}\n\nconst post = bent('https://api.pdfshift.io/v3/convert/pdf', 'POST', 'json', 200);\nconst response = await post('', params, {'X-API-Key': apiKey});\n\nif (response.status >= 400) {\n    throw new Error(`Request failed with status code ${response.status}: ${response.data}`);\n}\n\nconst getBuffer = bent('buffer')\nfs.writeFileSync('result.pdf', await getBuffer(response));\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[2790],{"type":23,"tag":36,"props":2791,"children":2792},{"__ignoreMap":8},[2793],{"type":28,"value":2788},{"type":23,"tag":24,"props":2795,"children":2796},{},[2797],{"type":28,"value":973},{"type":23,"tag":24,"props":2799,"children":2800},{},[2801,2802],{"type":28,"value":978},{"type":23,"tag":36,"props":2803,"children":2805},{"className":2804},[],[2806],{"type":28,"value":984},{"type":23,"tag":24,"props":2808,"children":2809},{},[2810,2811,2816,2817,2822],{"type":28,"value":989},{"type":23,"tag":36,"props":2812,"children":2814},{"className":2813},[],[2815],{"type":28,"value":995},{"type":28,"value":725},{"type":23,"tag":36,"props":2818,"children":2820},{"className":2819},[],[2821],{"type":28,"value":149},{"type":28,"value":1003},{"type":23,"tag":24,"props":2824,"children":2825},{},[2826],{"type":28,"value":1008},{"type":23,"tag":44,"props":2828,"children":2830},{"className":2829,"code":1012,"language":574,"meta":8},[573],[2831],{"type":23,"tag":36,"props":2832,"children":2833},{"__ignoreMap":8},[2834],{"type":28,"value":1012},{"type":23,"tag":24,"props":2836,"children":2837},{},[2838,2839,2844,2845,2850,2851,2856,2857,2862],{"type":28,"value":1022},{"type":23,"tag":36,"props":2840,"children":2842},{"className":2841},[],[2843],{"type":28,"value":957},{"type":28,"value":1029},{"type":23,"tag":36,"props":2846,"children":2848},{"className":2847},[],[2849],{"type":28,"value":1035},{"type":28,"value":1037},{"type":23,"tag":36,"props":2852,"children":2854},{"className":2853},[],[2855],{"type":28,"value":1043},{"type":28,"value":1045},{"type":23,"tag":36,"props":2858,"children":2860},{"className":2859},[],[2861],{"type":28,"value":1051},{"type":28,"value":1053},{"title":8,"searchDepth":61,"depth":61,"links":2864},[],"content:guides:node:bent:generate-a-document-with-full-height.md","guides/node/bent/generate-a-document-with-full-height.md",{"_path":2868,"_dir":2005,"_draft":7,"_partial":7,"_locale":8,"title":1060,"description":2869,"language":11,"library":2007,"property":1062,"output":14,"related":2870,"default":7,"body":2871,"_type":63,"_id":2902,"_source":65,"_file":2903,"_extension":67},"/guides/node/bent/loading-css-from-a-string","Follow this guide to load custom CSS as a given string when converting an HTML document to PDF with PDFShift's API. This guide provides Node code samples with the Bent library.",[1064,75,76,77],{"type":20,"children":2872,"toc":2900},[2873,2877,2881,2890],{"type":23,"tag":24,"props":2874,"children":2875},{},[2876],{"type":28,"value":1071},{"type":23,"tag":24,"props":2878,"children":2879},{},[2880],{"type":28,"value":1076},{"type":23,"tag":44,"props":2882,"children":2885},{"className":2883,"code":2884,"language":49,"meta":8},[47],"const bent = require('bent')\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    css: 'body { background-color: #f00; }'\n}\n\nconst post = bent('https://api.pdfshift.io/v3/convert/pdf', 'POST', 'json', 200);\nconst response = await post('', params, {'X-API-Key': apiKey});\n\nif (response.status >= 400) {\n    throw new Error(`Request failed with status code ${response.status}: ${response.data}`);\n}\n\nconst getBuffer = bent('buffer')\nfs.writeFileSync('result.pdf', await getBuffer(response));\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[2886],{"type":23,"tag":36,"props":2887,"children":2888},{"__ignoreMap":8},[2889],{"type":28,"value":2884},{"type":23,"tag":24,"props":2891,"children":2892},{},[2893,2894,2899],{"type":28,"value":117},{"type":23,"tag":36,"props":2895,"children":2897},{"className":2896},[],[2898],{"type":28,"value":1062},{"type":28,"value":1096},{"title":8,"searchDepth":61,"depth":61,"links":2901},[],"content:guides:node:bent:loading-css-from-a-string.md","guides/node/bent/loading-css-from-a-string.md",{"_path":2905,"_dir":2005,"_draft":7,"_partial":7,"_locale":8,"title":1103,"description":2906,"language":11,"library":2007,"property":1062,"output":14,"related":2907,"default":7,"body":2908,"_type":63,"_id":2943,"_source":65,"_file":2944,"_extension":67},"/guides/node/bent/loading-css-from-a-url","This guides shows you how to add a custom CSS from an URL onto your document to customize the output of your generated PDF. Follow this guides to learn how to do it using Node and the Bent library and see how it can quickly be implemented using the PDFShift's API.",[1064,74,76,77],{"type":20,"children":2909,"toc":2941},[2910,2914,2918,2922,2931],{"type":23,"tag":24,"props":2911,"children":2912},{},[2913],{"type":28,"value":1112},{"type":23,"tag":24,"props":2915,"children":2916},{},[2917],{"type":28,"value":1076},{"type":23,"tag":24,"props":2919,"children":2920},{},[2921],{"type":28,"value":1121},{"type":23,"tag":44,"props":2923,"children":2926},{"className":2924,"code":2925,"language":49,"meta":8},[47],"const bent = require('bent')\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    css: \"https://www.example.com/public/style/print.css\"\n}\n\nconst post = bent('https://api.pdfshift.io/v3/convert/pdf', 'POST', 'json', 200);\nconst response = await post('', params, {'X-API-Key': apiKey});\n\nif (response.status >= 400) {\n    throw new Error(`Request failed with status code ${response.status}: ${response.data}`);\n}\n\nconst getBuffer = bent('buffer')\nfs.writeFileSync('result.pdf', await getBuffer(response));\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[2927],{"type":23,"tag":36,"props":2928,"children":2929},{"__ignoreMap":8},[2930],{"type":28,"value":2925},{"type":23,"tag":24,"props":2932,"children":2933},{},[2934,2935,2940],{"type":28,"value":117},{"type":23,"tag":36,"props":2936,"children":2938},{"className":2937},[],[2939],{"type":28,"value":1062},{"type":28,"value":1096},{"title":8,"searchDepth":61,"depth":61,"links":2942},[],"content:guides:node:bent:loading-css-from-a-url.md","guides/node/bent/loading-css-from-a-url.md",{"_path":2946,"_dir":2005,"_draft":7,"_partial":7,"_locale":8,"title":1147,"description":2947,"language":11,"library":2007,"property":49,"output":14,"related":2948,"default":7,"body":2949,"_type":63,"_id":2980,"_source":65,"_file":2981,"_extension":67},"/guides/node/bent/loading-javascript-from-a-string","Follow this guide to learn how to add custom javascript to your page to customize the output of your generated PDF. This allows you to modify elements on the page, add or remove content, etc. This guide uses Node and the Bent library and relies on the PDFShift's API.",[1064,74,75,77],{"type":20,"children":2950,"toc":2978},[2951,2955,2959,2968],{"type":23,"tag":24,"props":2952,"children":2953},{},[2954],{"type":28,"value":1156},{"type":23,"tag":24,"props":2956,"children":2957},{},[2958],{"type":28,"value":1161},{"type":23,"tag":44,"props":2960,"children":2963},{"className":2961,"code":2962,"language":49,"meta":8},[47],"const bent = require('bent')\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    javascript: 'document.querySelector(\"h1\").style.color = \"red\";'\n}\n\nconst post = bent('https://api.pdfshift.io/v3/convert/pdf', 'POST', 'json', 200);\nconst response = await post('', params, {'X-API-Key': apiKey});\n\nif (response.status >= 400) {\n    throw new Error(`Request failed with status code ${response.status}: ${response.data}`);\n}\n\nconst getBuffer = bent('buffer')\nfs.writeFileSync('result.pdf', await getBuffer(response));\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[2964],{"type":23,"tag":36,"props":2965,"children":2966},{"__ignoreMap":8},[2967],{"type":28,"value":2962},{"type":23,"tag":24,"props":2969,"children":2970},{},[2971,2972,2977],{"type":28,"value":117},{"type":23,"tag":36,"props":2973,"children":2975},{"className":2974},[],[2976],{"type":28,"value":49},{"type":28,"value":1181},{"title":8,"searchDepth":61,"depth":61,"links":2979},[],"content:guides:node:bent:loading-javascript-from-a-string.md","guides/node/bent/loading-javascript-from-a-string.md",{"_path":2983,"_dir":2005,"_draft":7,"_partial":7,"_locale":8,"title":1188,"description":2984,"language":11,"library":2007,"property":49,"output":14,"related":2985,"default":7,"body":2986,"_type":63,"_id":3021,"_source":65,"_file":3022,"_extension":67},"/guides/node/bent/loading-javascript-from-a-url","Follow this guide to add custom javascript to your page before converting it to PDF. Using a URL allows you to later be able to change the content of the javascript without having to update the query made to PDFShift. Learn how you can implement this using Node and the Bent library to call the PDFShift's API.",[1064,74,75,76],{"type":20,"children":2987,"toc":3019},[2988,2992,2996,3000,3009],{"type":23,"tag":24,"props":2989,"children":2990},{},[2991],{"type":28,"value":1197},{"type":23,"tag":24,"props":2993,"children":2994},{},[2995],{"type":28,"value":1202},{"type":23,"tag":24,"props":2997,"children":2998},{},[2999],{"type":28,"value":1207},{"type":23,"tag":44,"props":3001,"children":3004},{"className":3002,"code":3003,"language":49,"meta":8},[47],"const bent = require('bent')\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    javascript: 'https://www.example.com/custom.js'\n}\n\nconst post = bent('https://api.pdfshift.io/v3/convert/pdf', 'POST', 'json', 200);\nconst response = await post('', params, {'X-API-Key': apiKey});\n\nif (response.status >= 400) {\n    throw new Error(`Request failed with status code ${response.status}: ${response.data}`);\n}\n\nconst getBuffer = bent('buffer')\nfs.writeFileSync('result.pdf', await getBuffer(response));\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[3005],{"type":23,"tag":36,"props":3006,"children":3007},{"__ignoreMap":8},[3008],{"type":28,"value":3003},{"type":23,"tag":24,"props":3010,"children":3011},{},[3012,3013,3018],{"type":28,"value":117},{"type":23,"tag":36,"props":3014,"children":3016},{"className":3015},[],[3017],{"type":28,"value":49},{"type":28,"value":1227},{"title":8,"searchDepth":61,"depth":61,"links":3020},[],"content:guides:node:bent:loading-javascript-from-a-url.md","guides/node/bent/loading-javascript-from-a-url.md",{"_path":3024,"_dir":2005,"_draft":7,"_partial":7,"_locale":8,"title":1234,"description":3025,"language":11,"library":2007,"property":1236,"output":14,"related":3026,"default":7,"body":3027,"_type":63,"_id":3166,"_source":65,"_file":3167,"_extension":67},"/guides/node/bent/protecting-the-generated-pdf","Learn how to protect your generated PDF with encryption for owner and user, and for choosing who can modify, print and/or copy the generated PDF. This guides explains you to do it using Node and the Bent library and relies on the PDFShift's API.",[317,479],{"type":20,"children":3028,"toc":3164},[3029,3034,3038,3048,3052,3061,3071,3081,3156],{"type":23,"tag":24,"props":3030,"children":3031},{},[3032],{"type":28,"value":3033},"In this guide, we'll show you how you can protect your generated PDF with encryption for owner and user, and for choosing who can modify, print and/or copy the generated PDF. This guides explains you to do it using Node and the Bent library and relies on the PDFShift's API.",{"type":23,"tag":24,"props":3035,"children":3036},{},[3037],{"type":28,"value":1249},{"type":23,"tag":24,"props":3039,"children":3040},{},[3041,3042,3047],{"type":28,"value":1254},{"type":23,"tag":36,"props":3043,"children":3045},{"className":3044},[],[3046],{"type":28,"value":1236},{"type":28,"value":1261},{"type":23,"tag":24,"props":3049,"children":3050},{},[3051],{"type":28,"value":1266},{"type":23,"tag":44,"props":3053,"children":3056},{"className":3054,"code":3055,"language":49,"meta":8},[47],"const bent = require('bent')\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    protection: {\n        owner_password: 'owner_password',\n        user_password: 'user_password',\n        no_print: True,\n        no_modify: True\n    }\n}\n\nconst post = bent('https://api.pdfshift.io/v3/convert/pdf', 'POST', 'json', 200);\nconst response = await post('', params, {'X-API-Key': apiKey});\n\nif (response.status >= 400) {\n    throw new Error(`Request failed with status code ${response.status}: ${response.data}`);\n}\n\nconst getBuffer = bent('buffer')\nfs.writeFileSync('result.pdf', await getBuffer(response));\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[3057],{"type":23,"tag":36,"props":3058,"children":3059},{"__ignoreMap":8},[3060],{"type":28,"value":3055},{"type":23,"tag":24,"props":3062,"children":3063},{},[3064,3065,3070],{"type":28,"value":1280},{"type":23,"tag":36,"props":3066,"children":3068},{"className":3067},[],[3069],{"type":28,"value":1236},{"type":28,"value":1287},{"type":23,"tag":24,"props":3072,"children":3073},{},[3074,3075,3080],{"type":28,"value":117},{"type":23,"tag":36,"props":3076,"children":3078},{"className":3077},[],[3079],{"type":28,"value":1236},{"type":28,"value":1298},{"type":23,"tag":126,"props":3082,"children":3083},{},[3084,3093,3102,3111,3126,3141],{"type":23,"tag":130,"props":3085,"children":3086},{},[3087,3092],{"type":23,"tag":36,"props":3088,"children":3090},{"className":3089},[],[3091],{"type":28,"value":1310},{"type":28,"value":1312},{"type":23,"tag":130,"props":3094,"children":3095},{},[3096,3101],{"type":23,"tag":36,"props":3097,"children":3099},{"className":3098},[],[3100],{"type":28,"value":1321},{"type":28,"value":1323},{"type":23,"tag":130,"props":3103,"children":3104},{},[3105,3110],{"type":23,"tag":36,"props":3106,"children":3108},{"className":3107},[],[3109],{"type":28,"value":1332},{"type":28,"value":1334},{"type":23,"tag":130,"props":3112,"children":3113},{},[3114,3119,3120,3125],{"type":23,"tag":36,"props":3115,"children":3117},{"className":3116},[],[3118],{"type":28,"value":1343},{"type":28,"value":1345},{"type":23,"tag":36,"props":3121,"children":3123},{"className":3122},[],[3124],{"type":28,"value":615},{"type":28,"value":1352},{"type":23,"tag":130,"props":3127,"children":3128},{},[3129,3134,3135,3140],{"type":23,"tag":36,"props":3130,"children":3132},{"className":3131},[],[3133],{"type":28,"value":1361},{"type":28,"value":1345},{"type":23,"tag":36,"props":3136,"children":3138},{"className":3137},[],[3139],{"type":28,"value":615},{"type":28,"value":1369},{"type":23,"tag":130,"props":3142,"children":3143},{},[3144,3149,3150,3155],{"type":23,"tag":36,"props":3145,"children":3147},{"className":3146},[],[3148],{"type":28,"value":1378},{"type":28,"value":1345},{"type":23,"tag":36,"props":3151,"children":3153},{"className":3152},[],[3154],{"type":28,"value":615},{"type":28,"value":1386},{"type":23,"tag":24,"props":3157,"children":3158},{},[3159,3163],{"type":23,"tag":199,"props":3160,"children":3161},{},[3162],{"type":28,"value":1394},{"type":28,"value":1396},{"title":8,"searchDepth":61,"depth":61,"links":3165},[],"content:guides:node:bent:protecting-the-generated-pdf.md","guides/node/bent/protecting-the-generated-pdf.md",{"_path":3169,"_dir":2005,"_draft":7,"_partial":7,"_locale":8,"title":1403,"description":3170,"language":11,"library":2007,"property":1405,"output":14,"related":3171,"default":7,"body":3172,"_type":63,"_id":3249,"_source":65,"_file":3250,"_extension":67},"/guides/node/bent/receive-a-webhook-event","Receive a notification via a POST request on your server once the conversion was done. This allows you to trigger a massive amount of conversion without having to wait on their results, and get notified once they are done. This guides will show you how to receive webhook events in Node and the Bent library to call the PDFShift's API.",[1407,1408],{"type":20,"children":3173,"toc":3247},[3174,3178,3182,3186,3195,3199,3203,3207,3215,3219,3227,3231,3235,3243],{"type":23,"tag":24,"props":3175,"children":3176},{},[3177],{"type":28,"value":1415},{"type":23,"tag":24,"props":3179,"children":3180},{},[3181],{"type":28,"value":1420},{"type":23,"tag":24,"props":3183,"children":3184},{},[3185],{"type":28,"value":1266},{"type":23,"tag":44,"props":3187,"children":3190},{"className":3188,"code":3189,"language":49,"meta":8},[47],"const bent = require('bent')\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    webhook: 'https://enyygzdj8jy9b.x.pipedream.net/'\n}\n\nconst post = bent('https://api.pdfshift.io/v3/convert/pdf', 'POST', 'json', 200);\nconst response = await post('', params, {'X-API-Key': apiKey});\n\nif (response.status >= 400) {\n    throw new Error(`Request failed with status code ${response.status}: ${response.data}`);\n}\n\nconsole.log('The PDF document was generated and you will receive an event on your webhook once it is done.');\n",[3191],{"type":23,"tag":36,"props":3192,"children":3193},{"__ignoreMap":8},[3194],{"type":28,"value":3189},{"type":23,"tag":24,"props":3196,"children":3197},{},[3198],{"type":28,"value":1438},{"type":23,"tag":24,"props":3200,"children":3201},{},[3202],{"type":28,"value":1443},{"type":23,"tag":24,"props":3204,"children":3205},{},[3206],{"type":28,"value":1448},{"type":23,"tag":44,"props":3208,"children":3210},{"className":3209,"code":1452,"language":574,"meta":8},[573],[3211],{"type":23,"tag":36,"props":3212,"children":3213},{"__ignoreMap":8},[3214],{"type":28,"value":1452},{"type":23,"tag":24,"props":3216,"children":3217},{},[3218],{"type":28,"value":1462},{"type":23,"tag":44,"props":3220,"children":3222},{"className":3221,"code":1466,"language":574,"meta":8},[573],[3223],{"type":23,"tag":36,"props":3224,"children":3225},{"__ignoreMap":8},[3226],{"type":28,"value":1466},{"type":23,"tag":24,"props":3228,"children":3229},{},[3230],{"type":28,"value":1476},{"type":23,"tag":24,"props":3232,"children":3233},{},[3234],{"type":28,"value":1481},{"type":23,"tag":44,"props":3236,"children":3238},{"className":3237,"code":8,"language":574,"meta":8},[573],[3239],{"type":23,"tag":36,"props":3240,"children":3241},{"__ignoreMap":8},[3242],{"type":28,"value":8},{"type":23,"tag":24,"props":3244,"children":3245},{},[3246],{"type":28,"value":1494},{"title":8,"searchDepth":61,"depth":61,"links":3248},[],"content:guides:node:bent:receive-a-webhook-event.md","guides/node/bent/receive-a-webhook-event.md",{"_path":3252,"_dir":2005,"_draft":7,"_partial":7,"_locale":8,"title":1501,"description":3253,"language":11,"library":2007,"property":1503,"output":14,"related":3254,"default":7,"body":3255,"_type":63,"_id":3325,"_source":65,"_file":3326,"_extension":67},"/guides/node/bent/save-your-pdf-online-and-get-back-a-url","This guides shows you how can generate a PDF document from HTML and get back an URL instead of the raw PDF. This allows you to share the link directly to your users or redirect them to that page. Learn how you can achieve it using Node and the Bent library to call PDFShift's API.",[1408,1505],{"type":20,"children":3256,"toc":3323},[3257,3261,3271,3280,3295,3299,3307,3315],{"type":23,"tag":24,"props":3258,"children":3259},{},[3260],{"type":28,"value":1512},{"type":23,"tag":24,"props":3262,"children":3263},{},[3264,3265,3270],{"type":28,"value":1517},{"type":23,"tag":36,"props":3266,"children":3268},{"className":3267},[],[3269],{"type":28,"value":1503},{"type":28,"value":1524},{"type":23,"tag":44,"props":3272,"children":3275},{"className":3273,"code":3274,"language":49,"meta":8},[47],"const bent = require('bent')\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    'filename': 'example.pdf'\n}\n\nconst post = bent('https://api.pdfshift.io/v3/convert/pdf', 'POST', 'json', 200);\nconst response = await post('', params, {'X-API-Key': apiKey});\n\nif (response.status >= 400) {\n    throw new Error(`Request failed with status code ${response.status}: ${response.data}`);\n}\n\nconsole.log('The PDF document was generated and is available online via the url in the response');\n",[3276],{"type":23,"tag":36,"props":3277,"children":3278},{"__ignoreMap":8},[3279],{"type":28,"value":3274},{"type":23,"tag":24,"props":3281,"children":3282},{},[3283,3284,3289,3290,3294],{"type":28,"value":1538},{"type":23,"tag":36,"props":3285,"children":3287},{"className":3286},[],[3288],{"type":28,"value":1503},{"type":28,"value":1545},{"type":23,"tag":199,"props":3291,"children":3292},{},[3293],{"type":28,"value":1550},{"type":28,"value":1552},{"type":23,"tag":24,"props":3296,"children":3297},{},[3298],{"type":28,"value":1557},{"type":23,"tag":44,"props":3300,"children":3302},{"className":3301,"code":1561,"language":574,"meta":8},[573],[3303],{"type":23,"tag":36,"props":3304,"children":3305},{"__ignoreMap":8},[3306],{"type":28,"value":1561},{"type":23,"tag":24,"props":3308,"children":3309},{},[3310,3314],{"type":23,"tag":199,"props":3311,"children":3312},{},[3313],{"type":28,"value":203},{"type":28,"value":1575},{"type":23,"tag":24,"props":3316,"children":3317},{},[3318,3322],{"type":23,"tag":199,"props":3319,"children":3320},{},[3321],{"type":28,"value":203},{"type":28,"value":1584},{"title":8,"searchDepth":61,"depth":61,"links":3324},[],"content:guides:node:bent:save-your-pdf-online-and-get-back-a-url.md","guides/node/bent/save-your-pdf-online-and-get-back-a-url.md",{"_path":3328,"_dir":2005,"_draft":7,"_partial":7,"_locale":8,"title":1591,"description":3329,"language":11,"library":2007,"property":1593,"output":14,"related":3330,"default":7,"body":3331,"_type":63,"_id":3418,"_source":65,"_file":3419,"_extension":67},"/guides/node/bent/save-your-pdf-to-your-amazon-s3-bucket","This guides shows you how can generate a PDF document from HTML with PDFShift's API and save it to your own Amazon S3 bucket. This allows you to generate document and automate actions once the document has been created on your bucket. This guides explains you how to do it using Node and the Bent library.",[1407,1505],{"type":20,"children":3332,"toc":3416},[3333,3337,3341,3345,3353,3363,3372,3382,3390,3394,3402,3406],{"type":23,"tag":24,"props":3334,"children":3335},{},[3336],{"type":28,"value":1601},{"type":23,"tag":24,"props":3338,"children":3339},{},[3340],{"type":28,"value":1606},{"type":23,"tag":24,"props":3342,"children":3343},{},[3344],{"type":28,"value":1611},{"type":23,"tag":44,"props":3346,"children":3348},{"className":3347,"code":1615,"language":574,"meta":8},[573],[3349],{"type":23,"tag":36,"props":3350,"children":3351},{"__ignoreMap":8},[3352],{"type":28,"value":1615},{"type":23,"tag":24,"props":3354,"children":3355},{},[3356,3357,3362],{"type":28,"value":1625},{"type":23,"tag":36,"props":3358,"children":3360},{"className":3359},[],[3361],{"type":28,"value":1593},{"type":28,"value":1632},{"type":23,"tag":44,"props":3364,"children":3367},{"className":3365,"code":3366,"language":49,"meta":8},[47],"const bent = require('bent')\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    s3_destination: 's3://DOC-EXAMPLE-BUCKET/test/example.pdf'\n}\n\nconst post = bent('https://api.pdfshift.io/v3/convert/pdf', 'POST', 'json', 200);\nconst response = await post('', params, {'X-API-Key': apiKey});\n\nif (response.status >= 400) {\n    throw new Error(`Request failed with status code ${response.status}: ${response.data}`);\n}\n\nconsole.log('The PDF document was generated and saved to your S3 Bucket');\n",[3368],{"type":23,"tag":36,"props":3369,"children":3370},{"__ignoreMap":8},[3371],{"type":28,"value":3366},{"type":23,"tag":24,"props":3373,"children":3374},{},[3375,3376,3381],{"type":28,"value":1646},{"type":23,"tag":36,"props":3377,"children":3379},{"className":3378},[],[3380],{"type":28,"value":1593},{"type":28,"value":1653},{"type":23,"tag":44,"props":3383,"children":3385},{"className":3384,"code":1657,"language":574,"meta":8},[573],[3386],{"type":23,"tag":36,"props":3387,"children":3388},{"__ignoreMap":8},[3389],{"type":28,"value":1657},{"type":23,"tag":24,"props":3391,"children":3392},{},[3393],{"type":28,"value":1667},{"type":23,"tag":44,"props":3395,"children":3397},{"className":3396,"code":1671,"language":574,"meta":8},[573],[3398],{"type":23,"tag":36,"props":3399,"children":3400},{"__ignoreMap":8},[3401],{"type":28,"value":1671},{"type":23,"tag":24,"props":3403,"children":3404},{},[3405],{"type":28,"value":1681},{"type":23,"tag":24,"props":3407,"children":3408},{},[3409,3410,3415],{"type":28,"value":1686},{"type":23,"tag":36,"props":3411,"children":3413},{"className":3412},[],[3414],{"type":28,"value":1405},{"type":28,"value":1693},{"title":8,"searchDepth":61,"depth":61,"links":3417},[],"content:guides:node:bent:save-your-pdf-to-your-amazon-s3-bucket.md","guides/node/bent/save-your-pdf-to-your-amazon-s3-bucket.md",{"_path":3421,"_dir":2005,"_draft":7,"_partial":7,"_locale":8,"title":1700,"description":3422,"language":11,"library":2007,"property":1702,"output":14,"related":3423,"default":7,"body":3424,"_type":63,"_id":3449,"_source":65,"_file":3450,"_extension":67},"/guides/node/bent/send-custom-http-headers","Learn how to add custom HTTP headers when requesting an URL to be converted in PDF with PDFShift's API. It allows you to add specific headers that your backend can check against to authenticate a query before converting it to PDF. This guide explains you how using Node and the Bent library.",[17,1704],{"type":20,"children":3425,"toc":3447},[3426,3430,3434,3443],{"type":23,"tag":24,"props":3427,"children":3428},{},[3429],{"type":28,"value":1711},{"type":23,"tag":24,"props":3431,"children":3432},{},[3433],{"type":28,"value":1716},{"type":23,"tag":44,"props":3435,"children":3438},{"className":3436,"code":3437,"language":49,"meta":8},[47],"const bent = require('bent')\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    http_headers: {\n        'x-custom-header': 'custom-value',\n        Authorization: 'Bearer {token}'  // This allows you to authenticate PDFShift to your service in a custom way\n    }\n}\n\nconst getBuffer = bent('buffer')\nfs.writeFileSync('result.pdf', await getBuffer(response));\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[3439],{"type":23,"tag":36,"props":3440,"children":3441},{"__ignoreMap":8},[3442],{"type":28,"value":3437},{"type":23,"tag":24,"props":3444,"children":3445},{},[3446],{"type":28,"value":1730},{"title":8,"searchDepth":61,"depth":61,"links":3448},[],"content:guides:node:bent:send-custom-http-headers.md","guides/node/bent/send-custom-http-headers.md",{"_path":3452,"_dir":2005,"_draft":7,"_partial":7,"_locale":8,"title":1737,"description":3453,"language":11,"library":2007,"property":1739,"output":14,"related":3454,"default":7,"body":3455,"_type":63,"_id":3535,"_source":65,"_file":3536,"_extension":67},"/guides/node/bent/using-cookies","Learn how to add custom Cookies when requesting an URL to be converted in PDF with PDFShift's API. It allows you to pursue an active session for instance, that will authenticate the request as a specific user before converting the page to PDF. This guide explains you how using Node and the Bent library.",[16,1704],{"type":20,"children":3456,"toc":3533},[3457,3461,3471,3480,3490,3529],{"type":23,"tag":24,"props":3458,"children":3459},{},[3460],{"type":28,"value":1747},{"type":23,"tag":24,"props":3462,"children":3463},{},[3464,3465,3470],{"type":28,"value":1752},{"type":23,"tag":36,"props":3466,"children":3468},{"className":3467},[],[3469],{"type":28,"value":1739},{"type":28,"value":1759},{"type":23,"tag":44,"props":3472,"children":3475},{"className":3473,"code":3474,"language":49,"meta":8},[47],"const bent = require('bent')\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    // The \"cookies\" parameter expects a list of dictionnary that contains the name and the value of the cookies\n    cookies: [\n        { name: 'PHPSESSID', value: 'el4ukv0kqbvoirg7nkp4dncpk3' }\n    ]\n}\n\nconst getBuffer = bent('buffer')\nfs.writeFileSync('result.pdf', await getBuffer(response));\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[3476],{"type":23,"tag":36,"props":3477,"children":3478},{"__ignoreMap":8},[3479],{"type":28,"value":3474},{"type":23,"tag":24,"props":3481,"children":3482},{},[3483,3484,3489],{"type":28,"value":117},{"type":23,"tag":36,"props":3485,"children":3487},{"className":3486},[],[3488],{"type":28,"value":1739},{"type":28,"value":1779},{"type":23,"tag":126,"props":3491,"children":3492},{},[3493,3502,3511,3520],{"type":23,"tag":130,"props":3494,"children":3495},{},[3496,3501],{"type":23,"tag":36,"props":3497,"children":3499},{"className":3498},[],[3500],{"type":28,"value":1791},{"type":28,"value":1793},{"type":23,"tag":130,"props":3503,"children":3504},{},[3505,3510],{"type":23,"tag":36,"props":3506,"children":3508},{"className":3507},[],[3509],{"type":28,"value":1802},{"type":28,"value":1804},{"type":23,"tag":130,"props":3512,"children":3513},{},[3514,3519],{"type":23,"tag":36,"props":3515,"children":3517},{"className":3516},[],[3518],{"type":28,"value":1813},{"type":28,"value":1815},{"type":23,"tag":130,"props":3521,"children":3522},{},[3523,3528],{"type":23,"tag":36,"props":3524,"children":3526},{"className":3525},[],[3527],{"type":28,"value":1824},{"type":28,"value":1826},{"type":23,"tag":24,"props":3530,"children":3531},{},[3532],{"type":28,"value":1831},{"title":8,"searchDepth":61,"depth":61,"links":3534},[],"content:guides:node:bent:using-cookies.md","guides/node/bent/using-cookies.md",{"_path":3538,"_dir":2005,"_draft":7,"_partial":7,"_locale":8,"title":1838,"description":3539,"language":11,"library":2007,"property":1840,"output":14,"related":3540,"default":7,"body":3541,"_type":63,"_id":3677,"_source":65,"_file":3678,"_extension":67},"/guides/node/bent/waiting-for-a-custom-element-to-be-ready","Learn how to set up a custom javascript function that will waits for a specific condition to become true before allowing the conversion to happen. This is very interesting for waiting on charts to be generated, or custom fonts to be loaded. With PDFShift's API, this can easily be done using Node and the Bent library.",[1842,76],{"type":20,"children":3542,"toc":3675},[3543,3553,3563,3572,3582,3591,3595,3603,3631,3640,3644,3653],{"type":23,"tag":24,"props":3544,"children":3545},{},[3546,3547,3552],{"type":28,"value":117},{"type":23,"tag":36,"props":3548,"children":3550},{"className":3549},[],[3551],{"type":28,"value":1840},{"type":28,"value":1855},{"type":23,"tag":24,"props":3554,"children":3555},{},[3556,3557,3562],{"type":28,"value":1860},{"type":23,"tag":36,"props":3558,"children":3560},{"className":3559},[],[3561],{"type":28,"value":1840},{"type":28,"value":1867},{"type":23,"tag":24,"props":3564,"children":3565},{},[3566,3567,3571],{"type":28,"value":1872},{"type":23,"tag":106,"props":3568,"children":3569},{},[3570],{"type":28,"value":1877},{"type":28,"value":1879},{"type":23,"tag":24,"props":3573,"children":3574},{},[3575,3576,3581],{"type":28,"value":1884},{"type":23,"tag":36,"props":3577,"children":3579},{"className":3578},[],[3580],{"type":28,"value":1840},{"type":28,"value":1891},{"type":23,"tag":24,"props":3583,"children":3584},{},[3585,3586,3590],{"type":28,"value":1896},{"type":23,"tag":199,"props":3587,"children":3588},{},[3589],{"type":28,"value":1901},{"type":28,"value":183},{"type":23,"tag":24,"props":3592,"children":3593},{},[3594],{"type":28,"value":1907},{"type":23,"tag":44,"props":3596,"children":3598},{"className":3597,"code":1911,"language":49,"meta":8},[47],[3599],{"type":23,"tag":36,"props":3600,"children":3601},{"__ignoreMap":8},[3602],{"type":28,"value":1911},{"type":23,"tag":24,"props":3604,"children":3605},{},[3606,3607,3612,3613,3618,3619,3624,3625,3630],{"type":28,"value":1921},{"type":23,"tag":36,"props":3608,"children":3610},{"className":3609},[],[3611],{"type":28,"value":1840},{"type":28,"value":609},{"type":23,"tag":36,"props":3614,"children":3616},{"className":3615},[],[3617],{"type":28,"value":1933},{"type":28,"value":1935},{"type":23,"tag":36,"props":3620,"children":3622},{"className":3621},[],[3623],{"type":28,"value":1933},{"type":28,"value":1942},{"type":23,"tag":36,"props":3626,"children":3628},{"className":3627},[],[3629],{"type":28,"value":644},{"type":28,"value":1949},{"type":23,"tag":44,"props":3632,"children":3635},{"className":3633,"code":3634,"language":49,"meta":8},[47],"const bent = require('bent')\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    wait_for: 'isPageReady'\n}\n\nconst getBuffer = bent('buffer')\nfs.writeFileSync('result.pdf', await getBuffer(response));\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[3636],{"type":23,"tag":36,"props":3637,"children":3638},{"__ignoreMap":8},[3639],{"type":28,"value":3634},{"type":23,"tag":24,"props":3641,"children":3642},{},[3643],{"type":28,"value":1963},{"type":23,"tag":44,"props":3645,"children":3648},{"className":3646,"code":3647,"language":49,"meta":8},[47],"const bent = require('bent')\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    javascript: 'let isFontReady = false; document.fonts.ready.then(() => isFontReady = true); function isPageReady() { return isFontReady; }',\n    wait_for: 'isPageReady'\n}\n\nconst getBuffer = bent('buffer')\nfs.writeFileSync('result.pdf', await getBuffer(response));\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[3649],{"type":23,"tag":36,"props":3650,"children":3651},{"__ignoreMap":8},[3652],{"type":28,"value":3647},{"type":23,"tag":24,"props":3654,"children":3655},{},[3656,3657,3662,3663,3668,3669,3674],{"type":28,"value":1977},{"type":23,"tag":36,"props":3658,"children":3660},{"className":3659},[],[3661],{"type":28,"value":644},{"type":28,"value":1984},{"type":23,"tag":36,"props":3664,"children":3666},{"className":3665},[],[3667],{"type":28,"value":1933},{"type":28,"value":1991},{"type":23,"tag":36,"props":3670,"children":3672},{"className":3671},[],[3673],{"type":28,"value":1933},{"type":28,"value":1998},{"title":8,"searchDepth":61,"depth":61,"links":3676},[],"content:guides:node:bent:waiting-for-a-custom-element-to-be-ready.md","guides/node/bent/waiting-for-a-custom-element-to-be-ready.md",{"_path":3680,"_dir":3681,"_draft":7,"_partial":7,"_locale":8,"title":9,"description":3682,"language":11,"library":3683,"property":13,"output":14,"related":3684,"default":7,"body":3685,"_type":63,"_id":3717,"_source":65,"_file":3718,"_extension":67},"/guides/node/got/accessing-secured-pages","got","Learn how to access secured pages using Node and the Got library. This guide offers detailed steps with code samples in Node and the Got library, highlighting how you can acces page protected by basic authentication to convert them to PDF using PDFShift's API.","Got",[16,17],{"type":20,"children":3686,"toc":3715},[3687,3692,3702,3711],{"type":23,"tag":24,"props":3688,"children":3689},{},[3690],{"type":28,"value":3691},"In this guide, we'll show you how to access secured page (protected by basic authentication) using Node and the Got library to convert them to PDF using PDFShift's API.",{"type":23,"tag":24,"props":3693,"children":3694},{},[3695,3696,3701],{"type":28,"value":34},{"type":23,"tag":36,"props":3697,"children":3699},{"className":3698},[],[3700],{"type":28,"value":13},{"type":28,"value":42},{"type":23,"tag":44,"props":3703,"children":3706},{"className":3704,"code":3705,"language":49,"meta":8},[47],"const got = require('got');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napiKey = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    // You can set a basic authentication by passing the \"auth\" property which contains a username and password\n    auth: {\n        username: 'user',\n        password: 'password'\n    }\n}\n\nconst response = await got.post('https://api.pdfshift.io/v3/convert/pdf', {\n    headers: { 'X-API-Key': apiKey },\n    json: params,\n    responseType: 'buffer'\n});\n\n// Write the buffer as result.pdf\nfs.writeFileSync('result.pdf', await response.buffer());\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[3707],{"type":23,"tag":36,"props":3708,"children":3709},{"__ignoreMap":8},[3710],{"type":28,"value":3705},{"type":23,"tag":24,"props":3712,"children":3713},{},[3714],{"type":28,"value":59},{"title":8,"searchDepth":61,"depth":61,"links":3716},[],"content:guides:node:got:accessing-secured-pages.md","guides/node/got/accessing-secured-pages.md",{"_path":3720,"_dir":3681,"_draft":7,"_partial":7,"_locale":8,"title":70,"description":3721,"language":11,"library":3683,"property":72,"output":14,"related":3722,"default":7,"body":3723,"_type":63,"_id":3910,"_source":65,"_file":3911,"_extension":67},"/guides/node/got/adding-a-custom-header-or-footer","Discover how to add custom headers or footers to a PDF using Node and the Got library. This in-depth guide includes Node codes that you can easily follow and quickly generate documents with PDFShift's API.",[74,75,76,77],{"type":20,"children":3724,"toc":3908},[3725,3730,3751,3761,3815,3823,3827,3836,3846,3850,3904],{"type":23,"tag":24,"props":3726,"children":3727},{},[3728],{"type":28,"value":3729},"In this guide, we'll show you how to add custom headers or footers to a PDF using Node and the Got library.",{"type":23,"tag":24,"props":3731,"children":3732},{},[3733,3734,3739,3740,3745,3746,3750],{"type":28,"value":89},{"type":23,"tag":36,"props":3735,"children":3737},{"className":3736},[],[3738],{"type":28,"value":72},{"type":28,"value":96},{"type":23,"tag":36,"props":3741,"children":3743},{"className":3742},[],[3744],{"type":28,"value":102},{"type":28,"value":104},{"type":23,"tag":106,"props":3747,"children":3748},{},[3749],{"type":28,"value":110},{"type":28,"value":112},{"type":23,"tag":24,"props":3752,"children":3753},{},[3754,3755,3760],{"type":28,"value":117},{"type":23,"tag":36,"props":3756,"children":3758},{"className":3757},[],[3759],{"type":28,"value":72},{"type":28,"value":124},{"type":23,"tag":126,"props":3762,"children":3763},{},[3764,3773,3806],{"type":23,"tag":130,"props":3765,"children":3766},{},[3767,3772],{"type":23,"tag":36,"props":3768,"children":3770},{"className":3769},[],[3771],{"type":28,"value":138},{"type":28,"value":140},{"type":23,"tag":130,"props":3774,"children":3775},{},[3776,3781,3782,3787,3788,3793,3794,3799,3800,3805],{"type":23,"tag":36,"props":3777,"children":3779},{"className":3778},[],[3780],{"type":28,"value":149},{"type":28,"value":151},{"type":23,"tag":36,"props":3783,"children":3785},{"className":3784},[],[3786],{"type":28,"value":157},{"type":28,"value":159},{"type":23,"tag":36,"props":3789,"children":3791},{"className":3790},[],[3792],{"type":28,"value":165},{"type":28,"value":167},{"type":23,"tag":36,"props":3795,"children":3797},{"className":3796},[],[3798],{"type":28,"value":173},{"type":28,"value":175},{"type":23,"tag":36,"props":3801,"children":3803},{"className":3802},[],[3804],{"type":28,"value":181},{"type":28,"value":183},{"type":23,"tag":130,"props":3807,"children":3808},{},[3809,3814],{"type":23,"tag":36,"props":3810,"children":3812},{"className":3811},[],[3813],{"type":28,"value":192},{"type":28,"value":194},{"type":23,"tag":24,"props":3816,"children":3817},{},[3818,3822],{"type":23,"tag":199,"props":3819,"children":3820},{},[3821],{"type":28,"value":203},{"type":28,"value":205},{"type":23,"tag":24,"props":3824,"children":3825},{},[3826],{"type":28,"value":210},{"type":23,"tag":44,"props":3828,"children":3831},{"className":3829,"code":3830,"language":49,"meta":8},[47],"const got = require('got');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napiKey = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://en.wikipedia.org/wiki/PDF',\n    header: {\n        source: '\u003Cdiv>Page {{ page }} over a total of {{ total }}. Made on {{ date }}\u003C/div>',\n        height: 150,\n        start_at: 2\n    }\n}\n\nconst response = await got.post('https://api.pdfshift.io/v3/convert/pdf', {\n    headers: { 'X-API-Key': apiKey },\n    json: params,\n    responseType: 'buffer'\n});\n\n// Write the buffer as result.pdf\nfs.writeFileSync('result.pdf', await response.buffer());\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[3832],{"type":23,"tag":36,"props":3833,"children":3834},{"__ignoreMap":8},[3835],{"type":28,"value":3830},{"type":23,"tag":24,"props":3837,"children":3838},{},[3839,3840,3845],{"type":28,"value":117},{"type":23,"tag":36,"props":3841,"children":3843},{"className":3842},[],[3844],{"type":28,"value":138},{"type":28,"value":230},{"type":23,"tag":24,"props":3847,"children":3848},{},[3849],{"type":28,"value":235},{"type":23,"tag":126,"props":3851,"children":3852},{},[3853,3862,3871,3880,3889],{"type":23,"tag":130,"props":3854,"children":3855},{},[3856,3861],{"type":23,"tag":36,"props":3857,"children":3859},{"className":3858},[],[3860],{"type":28,"value":247},{"type":28,"value":249},{"type":23,"tag":130,"props":3863,"children":3864},{},[3865,3870],{"type":23,"tag":36,"props":3866,"children":3868},{"className":3867},[],[3869],{"type":28,"value":258},{"type":28,"value":260},{"type":23,"tag":130,"props":3872,"children":3873},{},[3874,3879],{"type":23,"tag":36,"props":3875,"children":3877},{"className":3876},[],[3878],{"type":28,"value":269},{"type":28,"value":271},{"type":23,"tag":130,"props":3881,"children":3882},{},[3883,3888],{"type":23,"tag":36,"props":3884,"children":3886},{"className":3885},[],[3887],{"type":28,"value":280},{"type":28,"value":282},{"type":23,"tag":130,"props":3890,"children":3891},{},[3892,3897,3898,3903],{"type":23,"tag":36,"props":3893,"children":3895},{"className":3894},[],[3896],{"type":28,"value":291},{"type":28,"value":293},{"type":23,"tag":36,"props":3899,"children":3901},{"className":3900},[],[3902],{"type":28,"value":299},{"type":28,"value":301},{"type":23,"tag":24,"props":3905,"children":3906},{},[3907],{"type":28,"value":306},{"title":8,"searchDepth":61,"depth":61,"links":3909},[],"content:guides:node:got:adding-a-custom-header-or-footer.md","guides/node/got/adding-a-custom-header-or-footer.md",{"_path":3913,"_dir":3681,"_draft":7,"_partial":7,"_locale":8,"title":313,"description":3914,"language":11,"library":3683,"property":315,"output":14,"related":3915,"default":7,"body":3916,"_type":63,"_id":4045,"_source":65,"_file":4046,"_extension":67},"/guides/node/got/adding-a-text-watermark","Learn how to add text watermarks to your generated PDF document using Node and the Got library. With this guide, you'll be able to add watermarks on top of your generated PDFs easily with a quick request to PDFShift's API.",[317,318],{"type":20,"children":3917,"toc":4043},[3918,3922,3932,3941,3945,4002,4006,4027,4031,4035],{"type":23,"tag":24,"props":3919,"children":3920},{},[3921],{"type":28,"value":325},{"type":23,"tag":24,"props":3923,"children":3924},{},[3925,3926,3931],{"type":28,"value":330},{"type":23,"tag":36,"props":3927,"children":3929},{"className":3928},[],[3930],{"type":28,"value":315},{"type":28,"value":337},{"type":23,"tag":44,"props":3933,"children":3936},{"className":3934,"code":3935,"language":49,"meta":8},[47],"const got = require('got');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napiKey = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    watermark: {\n        text: 'PROTECTED DOCUMENT',\n        offset_x: 'center',\n        offset_top: 'top'\n    }\n}\n\nconst response = await got.post('https://api.pdfshift.io/v3/convert/pdf', {\n    headers: { 'X-API-Key': apiKey },\n    json: params,\n    responseType: 'buffer'\n});\n\n// Write the buffer as result.pdf\nfs.writeFileSync('result.pdf', await response.buffer());\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[3937],{"type":23,"tag":36,"props":3938,"children":3939},{"__ignoreMap":8},[3940],{"type":28,"value":3935},{"type":23,"tag":24,"props":3942,"children":3943},{},[3944],{"type":28,"value":351},{"type":23,"tag":126,"props":3946,"children":3947},{},[3948,3957,3966,3975,3984,3993],{"type":23,"tag":130,"props":3949,"children":3950},{},[3951,3956],{"type":23,"tag":36,"props":3952,"children":3954},{"className":3953},[],[3955],{"type":28,"value":363},{"type":28,"value":365},{"type":23,"tag":130,"props":3958,"children":3959},{},[3960,3965],{"type":23,"tag":36,"props":3961,"children":3963},{"className":3962},[],[3964],{"type":28,"value":374},{"type":28,"value":376},{"type":23,"tag":130,"props":3967,"children":3968},{},[3969,3974],{"type":23,"tag":36,"props":3970,"children":3972},{"className":3971},[],[3973],{"type":28,"value":385},{"type":28,"value":387},{"type":23,"tag":130,"props":3976,"children":3977},{},[3978,3983],{"type":23,"tag":36,"props":3979,"children":3981},{"className":3980},[],[3982],{"type":28,"value":396},{"type":28,"value":398},{"type":23,"tag":130,"props":3985,"children":3986},{},[3987,3992],{"type":23,"tag":36,"props":3988,"children":3990},{"className":3989},[],[3991],{"type":28,"value":407},{"type":28,"value":409},{"type":23,"tag":130,"props":3994,"children":3995},{},[3996,4001],{"type":23,"tag":36,"props":3997,"children":3999},{"className":3998},[],[4000],{"type":28,"value":418},{"type":28,"value":420},{"type":23,"tag":24,"props":4003,"children":4004},{},[4005],{"type":28,"value":425},{"type":23,"tag":126,"props":4007,"children":4008},{},[4009,4018],{"type":23,"tag":130,"props":4010,"children":4011},{},[4012,4017],{"type":23,"tag":36,"props":4013,"children":4015},{"className":4014},[],[4016],{"type":28,"value":437},{"type":28,"value":439},{"type":23,"tag":130,"props":4019,"children":4020},{},[4021,4026],{"type":23,"tag":36,"props":4022,"children":4024},{"className":4023},[],[4025],{"type":28,"value":448},{"type":28,"value":450},{"type":23,"tag":24,"props":4028,"children":4029},{},[4030],{"type":28,"value":455},{"type":23,"tag":24,"props":4032,"children":4033},{},[4034],{"type":28,"value":460},{"type":23,"tag":44,"props":4036,"children":4038},{"className":4037,"code":464,"language":49,"meta":8},[47],[4039],{"type":23,"tag":36,"props":4040,"children":4041},{"__ignoreMap":8},[4042],{"type":28,"value":464},{"title":8,"searchDepth":61,"depth":61,"links":4044},[],"content:guides:node:got:adding-a-text-watermark.md","guides/node/got/adding-a-text-watermark.md",{"_path":4048,"_dir":3681,"_draft":7,"_partial":7,"_locale":8,"title":476,"description":4049,"language":11,"library":3683,"property":315,"output":14,"related":4050,"default":7,"body":4051,"_type":63,"_id":4144,"_source":65,"_file":4145,"_extension":67},"/guides/node/got/adding-an-image-watermark","Discover how to effortlessly add image watermarks to PDFs using Node and the Got library. Our guide shows you how to add images on top of your PDF to protect your document easily. This is easily done with a simple request to PDFShift's API.",[318,479],{"type":20,"children":4052,"toc":4142},[4053,4057,4067,4076,4080,4091,4101,4105,4126,4130,4134],{"type":23,"tag":24,"props":4054,"children":4055},{},[4056],{"type":28,"value":325},{"type":23,"tag":24,"props":4058,"children":4059},{},[4060,4061,4066],{"type":28,"value":330},{"type":23,"tag":36,"props":4062,"children":4064},{"className":4063},[],[4065],{"type":28,"value":315},{"type":28,"value":496},{"type":23,"tag":44,"props":4068,"children":4071},{"className":4069,"code":4070,"language":49,"meta":8},[47],"const got = require('got');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napiKey = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    watermark: {\n        image: 'https://placekitten.com/200/300',\n        offset_x: 'center',\n        offset_top: 'top'\n    }\n}\n\nconst response = await got.post('https://api.pdfshift.io/v3/convert/pdf', {\n    headers: { 'X-API-Key': apiKey },\n    json: params,\n    responseType: 'buffer'\n});\n\n// Write the buffer as result.pdf\nfs.writeFileSync('result.pdf', await response.buffer());\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[4072],{"type":23,"tag":36,"props":4073,"children":4074},{"__ignoreMap":8},[4075],{"type":28,"value":4070},{"type":23,"tag":24,"props":4077,"children":4078},{},[4079],{"type":28,"value":510},{"type":23,"tag":126,"props":4081,"children":4082},{},[4083,4087],{"type":23,"tag":130,"props":4084,"children":4085},{},[4086],{"type":28,"value":518},{"type":23,"tag":130,"props":4088,"children":4089},{},[4090],{"type":28,"value":523},{"type":23,"tag":24,"props":4092,"children":4093},{},[4094,4095,4100],{"type":28,"value":528},{"type":23,"tag":36,"props":4096,"children":4098},{"className":4097},[],[4099],{"type":28,"value":534},{"type":28,"value":536},{"type":23,"tag":24,"props":4102,"children":4103},{},[4104],{"type":28,"value":425},{"type":23,"tag":126,"props":4106,"children":4107},{},[4108,4117],{"type":23,"tag":130,"props":4109,"children":4110},{},[4111,4116],{"type":23,"tag":36,"props":4112,"children":4114},{"className":4113},[],[4115],{"type":28,"value":437},{"type":28,"value":439},{"type":23,"tag":130,"props":4118,"children":4119},{},[4120,4125],{"type":23,"tag":36,"props":4121,"children":4123},{"className":4122},[],[4124],{"type":28,"value":448},{"type":28,"value":450},{"type":23,"tag":24,"props":4127,"children":4128},{},[4129],{"type":28,"value":455},{"type":23,"tag":24,"props":4131,"children":4132},{},[4133],{"type":28,"value":460},{"type":23,"tag":44,"props":4135,"children":4137},{"className":4136,"code":464,"language":574,"meta":8},[573],[4138],{"type":23,"tag":36,"props":4139,"children":4140},{"__ignoreMap":8},[4141],{"type":28,"value":464},{"title":8,"searchDepth":61,"depth":61,"links":4143},[],"content:guides:node:got:adding-an-image-watermark.md","guides/node/got/adding-an-image-watermark.md",{"_path":4147,"_dir":3681,"_draft":7,"_partial":7,"_locale":8,"title":586,"description":4148,"language":11,"library":3683,"property":588,"output":14,"related":4149,"default":7,"body":4150,"_type":63,"_id":4199,"_source":65,"_file":4200,"_extension":67},"/guides/node/got/avoid-conversion-on-error","Learn how to avoid the conversion on error when loading the document using Node and the Got library and relies on the PDFShift's API.",[590],{"type":20,"children":4151,"toc":4197},[4152,4156,4172,4181],{"type":23,"tag":24,"props":4153,"children":4154},{},[4155],{"type":28,"value":597},{"type":23,"tag":24,"props":4157,"children":4158},{},[4159,4160,4165,4166,4171],{"type":28,"value":602},{"type":23,"tag":36,"props":4161,"children":4163},{"className":4162},[],[4164],{"type":28,"value":588},{"type":28,"value":609},{"type":23,"tag":36,"props":4167,"children":4169},{"className":4168},[],[4170],{"type":28,"value":615},{"type":28,"value":617},{"type":23,"tag":44,"props":4173,"children":4176},{"className":4174,"code":4175,"language":49,"meta":8},[47],"const got = require('got');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napiKey = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.httpstat.us/404',\n    raise_for_status: True\n}\n\nconst response = await got.post('https://api.pdfshift.io/v3/convert/pdf', {\n    headers: { 'X-API-Key': apiKey },\n    json: params,\n    responseType: 'buffer'\n});\n\n// Write the buffer as result.pdf\nfs.writeFileSync('result.pdf', await response.buffer());\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[4177],{"type":23,"tag":36,"props":4178,"children":4179},{"__ignoreMap":8},[4180],{"type":28,"value":4175},{"type":23,"tag":24,"props":4182,"children":4183},{},[4184,4185,4190,4191,4196],{"type":28,"value":631},{"type":23,"tag":36,"props":4186,"children":4188},{"className":4187},[],[4189],{"type":28,"value":588},{"type":28,"value":638},{"type":23,"tag":36,"props":4192,"children":4194},{"className":4193},[],[4195],{"type":28,"value":644},{"type":28,"value":646},{"title":8,"searchDepth":61,"depth":61,"links":4198},[],"content:guides:node:got:avoid-conversion-on-error.md","guides/node/got/avoid-conversion-on-error.md",{"_path":4202,"_dir":3681,"_draft":7,"_partial":7,"_locale":8,"title":653,"description":4203,"language":11,"library":3683,"property":138,"output":14,"related":4204,"default":7,"body":4205,"_type":63,"_id":4226,"_source":65,"_file":4227,"_extension":67},"/guides/node/got/convert-html-to-pdf-from-a-url","Learn how to easily convert HTML documents to PDF from a URL using Node and the Got library. This how-to guide offers clear Node code examples that show developers how to implement this using the PDFShift API.",[590,656],{"type":20,"children":4206,"toc":4224},[4207,4211,4220],{"type":23,"tag":24,"props":4208,"children":4209},{},[4210],{"type":28,"value":663},{"type":23,"tag":44,"props":4212,"children":4215},{"className":4213,"code":4214,"language":49,"meta":8},[47],"const got = require('got');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napiKey = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n}\n\nconst response = await got.post('https://api.pdfshift.io/v3/convert/pdf', {\n    headers: { 'X-API-Key': apiKey },\n    json: params,\n    responseType: 'buffer'\n});\n\n// Write the buffer as result.pdf\nfs.writeFileSync('result.pdf', await response.buffer());\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[4216],{"type":23,"tag":36,"props":4217,"children":4218},{"__ignoreMap":8},[4219],{"type":28,"value":4214},{"type":23,"tag":24,"props":4221,"children":4222},{},[4223],{"type":28,"value":677},{"title":8,"searchDepth":61,"depth":61,"links":4225},[],"content:guides:node:got:convert-html-to-pdf-from-a-url.md","guides/node/got/convert-html-to-pdf-from-a-url.md",{"_path":4229,"_dir":3681,"_draft":7,"_partial":7,"_locale":8,"title":684,"description":4230,"language":11,"library":3683,"output":14,"related":4231,"default":7,"body":4232,"_type":63,"_id":4305,"_source":65,"_file":4306,"_extension":67},"/guides/node/got/convert-html-to-pdf-from-raw-html","Learn how to to convert raw HTML document to PDF using Node and the Got library. Our guide will explain you how to quickly convert documents with PDFShift's API.",[687],{"type":20,"children":4233,"toc":4303},[4234,4239,4254,4270,4280,4284,4293],{"type":23,"tag":24,"props":4235,"children":4236},{},[4237],{"type":28,"value":4238},"In this guide, we'll show you how to convert an HTML document to PDF using Node and the Got library.\nProviding the HTML document as raw as a lot of great advantages :",{"type":23,"tag":126,"props":4240,"children":4241},{},[4242,4246,4250],{"type":23,"tag":130,"props":4243,"children":4244},{},[4245],{"type":28,"value":702},{"type":23,"tag":130,"props":4247,"children":4248},{},[4249],{"type":28,"value":707},{"type":23,"tag":130,"props":4251,"children":4252},{},[4253],{"type":28,"value":712},{"type":23,"tag":24,"props":4255,"children":4256},{},[4257,4258,4263,4264,4269],{"type":28,"value":717},{"type":23,"tag":36,"props":4259,"children":4261},{"className":4260},[],[4262],{"type":28,"value":723},{"type":28,"value":725},{"type":23,"tag":36,"props":4265,"children":4267},{"className":4266},[],[4268],{"type":28,"value":731},{"type":28,"value":733},{"type":23,"tag":24,"props":4271,"children":4272},{},[4273,4274,4279],{"type":28,"value":738},{"type":23,"tag":36,"props":4275,"children":4277},{"className":4276},[],[4278],{"type":28,"value":138},{"type":28,"value":745},{"type":23,"tag":24,"props":4281,"children":4282},{},[4283],{"type":28,"value":210},{"type":23,"tag":44,"props":4285,"children":4288},{"className":4286,"code":4287,"language":49,"meta":8},[47],"const got = require('got');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napiKey = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: '\u003Chtml>\u003Cbody>\u003Ch1>This will be a PDF document\u003C/h1>\u003Cp>This will generate a basic PDF to show how you can add raw HTML\u003C/body>\u003C/html>',\n}\n\nconst response = await got.post('https://api.pdfshift.io/v3/convert/pdf', {\n    headers: { 'X-API-Key': apiKey },\n    json: params,\n    responseType: 'buffer'\n});\n\n// Write the buffer as result.pdf\nfs.writeFileSync('result.pdf', await response.buffer());\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[4289],{"type":23,"tag":36,"props":4290,"children":4291},{"__ignoreMap":8},[4292],{"type":28,"value":4287},{"type":23,"tag":24,"props":4294,"children":4295},{},[4296,4297,4302],{"type":28,"value":763},{"type":23,"tag":36,"props":4298,"children":4300},{"className":4299},[],[4301],{"type":28,"value":138},{"type":28,"value":770},{"title":8,"searchDepth":61,"depth":61,"links":4304},[],"content:guides:node:got:convert-html-to-pdf-from-raw-html.md","guides/node/got/convert-html-to-pdf-from-raw-html.md",{"_path":4308,"_dir":3681,"_draft":7,"_partial":7,"_locale":8,"title":777,"description":4309,"language":11,"library":3683,"property":779,"output":14,"related":4310,"default":7,"body":4311,"_type":63,"_id":4351,"_source":65,"_file":4352,"_extension":67},"/guides/node/got/define-a-time-limit","Learn how to set a conversion time limit at PDFShift. This will allow you to define a maximum time for the conversion process to complete, and if the process takes longer than the defined time, the conversion will be aborted. This guides explains you how to achieve it using Node and the Got library.",[781],{"type":20,"children":4312,"toc":4349},[4313,4317,4321,4336,4345],{"type":23,"tag":24,"props":4314,"children":4315},{},[4316],{"type":28,"value":788},{"type":23,"tag":24,"props":4318,"children":4319},{},[4320],{"type":28,"value":793},{"type":23,"tag":24,"props":4322,"children":4323},{},[4324,4325,4330,4331,4335],{"type":28,"value":798},{"type":23,"tag":36,"props":4326,"children":4328},{"className":4327},[],[4329],{"type":28,"value":779},{"type":28,"value":805},{"type":23,"tag":199,"props":4332,"children":4333},{},[4334],{"type":28,"value":810},{"type":28,"value":812},{"type":23,"tag":44,"props":4337,"children":4340},{"className":4338,"code":4339,"language":49,"meta":8},[47],"const got = require('got');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napiKey = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    timeout: 10\n}\n\nconst response = await got.post('https://api.pdfshift.io/v3/convert/pdf', {\n    headers: { 'X-API-Key': apiKey },\n    json: params,\n    responseType: 'buffer'\n});\n\n// Write the buffer as result.pdf\nfs.writeFileSync('result.pdf', await response.buffer());\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[4341],{"type":23,"tag":36,"props":4342,"children":4343},{"__ignoreMap":8},[4344],{"type":28,"value":4339},{"type":23,"tag":24,"props":4346,"children":4347},{},[4348],{"type":28,"value":826},{"title":8,"searchDepth":61,"depth":61,"links":4350},[],"content:guides:node:got:define-a-time-limit.md","guides/node/got/define-a-time-limit.md",{"_path":4354,"_dir":3681,"_draft":7,"_partial":7,"_locale":8,"title":833,"description":4355,"language":11,"library":3683,"property":835,"output":14,"default":7,"body":4356,"_type":63,"_id":4433,"_source":65,"_file":4434,"_extension":67},"/guides/node/got/exporting-only-a-specific-set-of-pages","Learn how to export only a specific set of pages from a document using Node and the Got library. This guide offers detailed steps with code samples in Node and the Got library, highlighting how you can export only a specific set of pages from a document using PDFShift's API.",{"type":20,"children":4357,"toc":4431},[4358,4363,4373,4377,4381,4414,4418,4422],{"type":23,"tag":24,"props":4359,"children":4360},{},[4361],{"type":28,"value":4362},"In this guide, we'll show you how to export only a specific set of pages from a document using Node and the Got library to convert them to PDF using PDFShift's API.",{"type":23,"tag":24,"props":4364,"children":4365},{},[4366,4367,4372],{"type":28,"value":847},{"type":23,"tag":36,"props":4368,"children":4370},{"className":4369},[],[4371],{"type":28,"value":835},{"type":28,"value":42},{"type":23,"tag":24,"props":4374,"children":4375},{},[4376],{"type":28,"value":858},{"type":23,"tag":24,"props":4378,"children":4379},{},[4380],{"type":28,"value":863},{"type":23,"tag":126,"props":4382,"children":4383},{},[4384,4394,4404],{"type":23,"tag":130,"props":4385,"children":4386},{},[4387,4388,4393],{"type":28,"value":871},{"type":23,"tag":36,"props":4389,"children":4391},{"className":4390},[],[4392],{"type":28,"value":877},{"type":28,"value":879},{"type":23,"tag":130,"props":4395,"children":4396},{},[4397,4398,4403],{"type":28,"value":884},{"type":23,"tag":36,"props":4399,"children":4401},{"className":4400},[],[4402],{"type":28,"value":890},{"type":28,"value":892},{"type":23,"tag":130,"props":4405,"children":4406},{},[4407,4408,4413],{"type":28,"value":897},{"type":23,"tag":36,"props":4409,"children":4411},{"className":4410},[],[4412],{"type":28,"value":903},{"type":28,"value":905},{"type":23,"tag":24,"props":4415,"children":4416},{},[4417],{"type":28,"value":910},{"type":23,"tag":24,"props":4419,"children":4420},{},[4421],{"type":28,"value":210},{"type":23,"tag":44,"props":4423,"children":4426},{"className":4424,"code":4425,"language":49,"meta":8},[47],"const got = require('got');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napiKey = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://en.wikipedia.org/wiki/PDF',\n    pages: '2-4'\n}\n\nconst response = await got.post('https://api.pdfshift.io/v3/convert/pdf', {\n    headers: { 'X-API-Key': apiKey },\n    json: params,\n    responseType: 'buffer'\n});\n\n// Write the buffer as result.pdf\nfs.writeFileSync('result.pdf', await response.buffer());\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[4427],{"type":23,"tag":36,"props":4428,"children":4429},{"__ignoreMap":8},[4430],{"type":28,"value":4425},{"title":8,"searchDepth":61,"depth":61,"links":4432},[],"content:guides:node:got:exporting-only-a-specific-set-of-pages.md","guides/node/got/exporting-only-a-specific-set-of-pages.md",{"_path":4436,"_dir":3681,"_draft":7,"_partial":7,"_locale":8,"title":930,"description":4437,"language":11,"library":3683,"property":932,"output":14,"default":7,"body":4438,"_type":63,"_id":4541,"_source":65,"_file":4542,"_extension":67},"/guides/node/got/generate-a-document-with-full-height","Learn to generate full-height documents dynamically with our step-by-step guide. This will allow you to create documents with a dynamic height, based on the content of the document. This guide provides Node code samples using the Got library to help you generate full-height documents with PDFShift's API.",{"type":20,"children":4439,"toc":4539},[4440,4445,4461,4470,4474,4483,4499,4503,4511],{"type":23,"tag":24,"props":4441,"children":4442},{},[4443],{"type":28,"value":4444},"In this guide, we'll show you how to generate a document with full height dynamically using Node and the Got library to convert them to PDF using PDFShift's API.",{"type":23,"tag":24,"props":4446,"children":4447},{},[4448,4449,4454,4455,4460],{"type":28,"value":944},{"type":23,"tag":36,"props":4450,"children":4452},{"className":4451},[],[4453],{"type":28,"value":932},{"type":28,"value":951},{"type":23,"tag":36,"props":4456,"children":4458},{"className":4457},[],[4459],{"type":28,"value":957},{"type":28,"value":959},{"type":23,"tag":44,"props":4462,"children":4465},{"className":4463,"code":4464,"language":49,"meta":8},[47],"const got = require('got');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napiKey = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    format: '1280xauto'\n}\n\nconst response = await got.post('https://api.pdfshift.io/v3/convert/pdf', {\n    headers: { 'X-API-Key': apiKey },\n    json: params,\n    responseType: 'buffer'\n});\n\n// Write the buffer as result.pdf\nfs.writeFileSync('result.pdf', await response.buffer());\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[4466],{"type":23,"tag":36,"props":4467,"children":4468},{"__ignoreMap":8},[4469],{"type":28,"value":4464},{"type":23,"tag":24,"props":4471,"children":4472},{},[4473],{"type":28,"value":973},{"type":23,"tag":24,"props":4475,"children":4476},{},[4477,4478],{"type":28,"value":978},{"type":23,"tag":36,"props":4479,"children":4481},{"className":4480},[],[4482],{"type":28,"value":984},{"type":23,"tag":24,"props":4484,"children":4485},{},[4486,4487,4492,4493,4498],{"type":28,"value":989},{"type":23,"tag":36,"props":4488,"children":4490},{"className":4489},[],[4491],{"type":28,"value":995},{"type":28,"value":725},{"type":23,"tag":36,"props":4494,"children":4496},{"className":4495},[],[4497],{"type":28,"value":149},{"type":28,"value":1003},{"type":23,"tag":24,"props":4500,"children":4501},{},[4502],{"type":28,"value":1008},{"type":23,"tag":44,"props":4504,"children":4506},{"className":4505,"code":1012,"language":574,"meta":8},[573],[4507],{"type":23,"tag":36,"props":4508,"children":4509},{"__ignoreMap":8},[4510],{"type":28,"value":1012},{"type":23,"tag":24,"props":4512,"children":4513},{},[4514,4515,4520,4521,4526,4527,4532,4533,4538],{"type":28,"value":1022},{"type":23,"tag":36,"props":4516,"children":4518},{"className":4517},[],[4519],{"type":28,"value":957},{"type":28,"value":1029},{"type":23,"tag":36,"props":4522,"children":4524},{"className":4523},[],[4525],{"type":28,"value":1035},{"type":28,"value":1037},{"type":23,"tag":36,"props":4528,"children":4530},{"className":4529},[],[4531],{"type":28,"value":1043},{"type":28,"value":1045},{"type":23,"tag":36,"props":4534,"children":4536},{"className":4535},[],[4537],{"type":28,"value":1051},{"type":28,"value":1053},{"title":8,"searchDepth":61,"depth":61,"links":4540},[],"content:guides:node:got:generate-a-document-with-full-height.md","guides/node/got/generate-a-document-with-full-height.md",{"_path":4544,"_dir":3681,"_draft":7,"_partial":7,"_locale":8,"title":1060,"description":4545,"language":11,"library":3683,"property":1062,"output":14,"related":4546,"default":7,"body":4547,"_type":63,"_id":4578,"_source":65,"_file":4579,"_extension":67},"/guides/node/got/loading-css-from-a-string","Follow this guide to load custom CSS as a given string when converting an HTML document to PDF with PDFShift's API. This guide provides Node code samples with the Got library.",[1064,75,76,77],{"type":20,"children":4548,"toc":4576},[4549,4553,4557,4566],{"type":23,"tag":24,"props":4550,"children":4551},{},[4552],{"type":28,"value":1071},{"type":23,"tag":24,"props":4554,"children":4555},{},[4556],{"type":28,"value":1076},{"type":23,"tag":44,"props":4558,"children":4561},{"className":4559,"code":4560,"language":49,"meta":8},[47],"const got = require('got');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napiKey = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    css: 'body { background-color: #f00; }'\n}\n\nconst response = await got.post('https://api.pdfshift.io/v3/convert/pdf', {\n    headers: { 'X-API-Key': apiKey },\n    json: params,\n    responseType: 'buffer'\n});\n\n// Write the buffer as result.pdf\nfs.writeFileSync('result.pdf', await response.buffer());\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[4562],{"type":23,"tag":36,"props":4563,"children":4564},{"__ignoreMap":8},[4565],{"type":28,"value":4560},{"type":23,"tag":24,"props":4567,"children":4568},{},[4569,4570,4575],{"type":28,"value":117},{"type":23,"tag":36,"props":4571,"children":4573},{"className":4572},[],[4574],{"type":28,"value":1062},{"type":28,"value":1096},{"title":8,"searchDepth":61,"depth":61,"links":4577},[],"content:guides:node:got:loading-css-from-a-string.md","guides/node/got/loading-css-from-a-string.md",{"_path":4581,"_dir":3681,"_draft":7,"_partial":7,"_locale":8,"title":1103,"description":4582,"language":11,"library":3683,"property":1062,"output":14,"related":4583,"default":7,"body":4584,"_type":63,"_id":4619,"_source":65,"_file":4620,"_extension":67},"/guides/node/got/loading-css-from-a-url","This guides shows you how to add a custom CSS from an URL onto your document to customize the output of your generated PDF. Follow this guides to learn how to do it using Node and the Got library and see how it can quickly be implemented using the PDFShift's API.",[1064,74,76,77],{"type":20,"children":4585,"toc":4617},[4586,4590,4594,4598,4607],{"type":23,"tag":24,"props":4587,"children":4588},{},[4589],{"type":28,"value":1112},{"type":23,"tag":24,"props":4591,"children":4592},{},[4593],{"type":28,"value":1076},{"type":23,"tag":24,"props":4595,"children":4596},{},[4597],{"type":28,"value":1121},{"type":23,"tag":44,"props":4599,"children":4602},{"className":4600,"code":4601,"language":49,"meta":8},[47],"const got = require('got');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napiKey = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    css: \"https://www.example.com/public/style/print.css\"\n}\n\nconst response = await got.post('https://api.pdfshift.io/v3/convert/pdf', {\n    headers: { 'X-API-Key': apiKey },\n    json: params,\n    responseType: 'buffer'\n});\n\n// Write the buffer as result.pdf\nfs.writeFileSync('result.pdf', await response.buffer());\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[4603],{"type":23,"tag":36,"props":4604,"children":4605},{"__ignoreMap":8},[4606],{"type":28,"value":4601},{"type":23,"tag":24,"props":4608,"children":4609},{},[4610,4611,4616],{"type":28,"value":117},{"type":23,"tag":36,"props":4612,"children":4614},{"className":4613},[],[4615],{"type":28,"value":1062},{"type":28,"value":1096},{"title":8,"searchDepth":61,"depth":61,"links":4618},[],"content:guides:node:got:loading-css-from-a-url.md","guides/node/got/loading-css-from-a-url.md",{"_path":4622,"_dir":3681,"_draft":7,"_partial":7,"_locale":8,"title":1147,"description":4623,"language":11,"library":3683,"property":49,"output":14,"related":4624,"default":7,"body":4625,"_type":63,"_id":4656,"_source":65,"_file":4657,"_extension":67},"/guides/node/got/loading-javascript-from-a-string","Follow this guide to learn how to add custom javascript to your page to customize the output of your generated PDF. This allows you to modify elements on the page, add or remove content, etc. This guide uses Node and the Got library and relies on the PDFShift's API.",[1064,74,75,77],{"type":20,"children":4626,"toc":4654},[4627,4631,4635,4644],{"type":23,"tag":24,"props":4628,"children":4629},{},[4630],{"type":28,"value":1156},{"type":23,"tag":24,"props":4632,"children":4633},{},[4634],{"type":28,"value":1161},{"type":23,"tag":44,"props":4636,"children":4639},{"className":4637,"code":4638,"language":49,"meta":8},[47],"const got = require('got');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napiKey = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    javascript: 'document.querySelector(\"h1\").style.color = \"red\";'\n}\n\nconst response = await got.post('https://api.pdfshift.io/v3/convert/pdf', {\n    headers: { 'X-API-Key': apiKey },\n    json: params,\n    responseType: 'buffer'\n});\n\n// Write the buffer as result.pdf\nfs.writeFileSync('result.pdf', await response.buffer());\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[4640],{"type":23,"tag":36,"props":4641,"children":4642},{"__ignoreMap":8},[4643],{"type":28,"value":4638},{"type":23,"tag":24,"props":4645,"children":4646},{},[4647,4648,4653],{"type":28,"value":117},{"type":23,"tag":36,"props":4649,"children":4651},{"className":4650},[],[4652],{"type":28,"value":49},{"type":28,"value":1181},{"title":8,"searchDepth":61,"depth":61,"links":4655},[],"content:guides:node:got:loading-javascript-from-a-string.md","guides/node/got/loading-javascript-from-a-string.md",{"_path":4659,"_dir":3681,"_draft":7,"_partial":7,"_locale":8,"title":1188,"description":4660,"language":11,"library":3683,"property":49,"output":14,"related":4661,"default":7,"body":4662,"_type":63,"_id":4697,"_source":65,"_file":4698,"_extension":67},"/guides/node/got/loading-javascript-from-a-url","Follow this guide to add custom javascript to your page before converting it to PDF. Using a URL allows you to later be able to change the content of the javascript without having to update the query made to PDFShift. Learn how you can implement this using Node and the Got library to call the PDFShift's API.",[1064,74,75,76],{"type":20,"children":4663,"toc":4695},[4664,4668,4672,4676,4685],{"type":23,"tag":24,"props":4665,"children":4666},{},[4667],{"type":28,"value":1197},{"type":23,"tag":24,"props":4669,"children":4670},{},[4671],{"type":28,"value":1202},{"type":23,"tag":24,"props":4673,"children":4674},{},[4675],{"type":28,"value":1207},{"type":23,"tag":44,"props":4677,"children":4680},{"className":4678,"code":4679,"language":49,"meta":8},[47],"const got = require('got');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napiKey = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    javascript: 'https://www.example.com/custom.js'\n}\n\nconst response = await got.post('https://api.pdfshift.io/v3/convert/pdf', {\n    headers: { 'X-API-Key': apiKey },\n    json: params,\n    responseType: 'buffer'\n});\n\n// Write the buffer as result.pdf\nfs.writeFileSync('result.pdf', await response.buffer());\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[4681],{"type":23,"tag":36,"props":4682,"children":4683},{"__ignoreMap":8},[4684],{"type":28,"value":4679},{"type":23,"tag":24,"props":4686,"children":4687},{},[4688,4689,4694],{"type":28,"value":117},{"type":23,"tag":36,"props":4690,"children":4692},{"className":4691},[],[4693],{"type":28,"value":49},{"type":28,"value":1227},{"title":8,"searchDepth":61,"depth":61,"links":4696},[],"content:guides:node:got:loading-javascript-from-a-url.md","guides/node/got/loading-javascript-from-a-url.md",{"_path":4700,"_dir":3681,"_draft":7,"_partial":7,"_locale":8,"title":1234,"description":4701,"language":11,"library":3683,"property":1236,"output":14,"related":4702,"default":7,"body":4703,"_type":63,"_id":4842,"_source":65,"_file":4843,"_extension":67},"/guides/node/got/protecting-the-generated-pdf","Learn how to protect your generated PDF with encryption for owner and user, and for choosing who can modify, print and/or copy the generated PDF. This guides explains you to do it using Node and the Got library and relies on the PDFShift's API.",[317,479],{"type":20,"children":4704,"toc":4840},[4705,4710,4714,4724,4728,4737,4747,4757,4832],{"type":23,"tag":24,"props":4706,"children":4707},{},[4708],{"type":28,"value":4709},"In this guide, we'll show you how you can protect your generated PDF with encryption for owner and user, and for choosing who can modify, print and/or copy the generated PDF. This guides explains you to do it using Node and the Got library and relies on the PDFShift's API.",{"type":23,"tag":24,"props":4711,"children":4712},{},[4713],{"type":28,"value":1249},{"type":23,"tag":24,"props":4715,"children":4716},{},[4717,4718,4723],{"type":28,"value":1254},{"type":23,"tag":36,"props":4719,"children":4721},{"className":4720},[],[4722],{"type":28,"value":1236},{"type":28,"value":1261},{"type":23,"tag":24,"props":4725,"children":4726},{},[4727],{"type":28,"value":1266},{"type":23,"tag":44,"props":4729,"children":4732},{"className":4730,"code":4731,"language":49,"meta":8},[47],"const got = require('got');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napiKey = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    protection: {\n        owner_password: 'owner_password',\n        user_password: 'user_password',\n        no_print: True,\n        no_modify: True\n    }\n}\n\nconst response = await got.post('https://api.pdfshift.io/v3/convert/pdf', {\n    headers: { 'X-API-Key': apiKey },\n    json: params,\n    responseType: 'buffer'\n});\n\n// Write the buffer as result.pdf\nfs.writeFileSync('result.pdf', await response.buffer());\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[4733],{"type":23,"tag":36,"props":4734,"children":4735},{"__ignoreMap":8},[4736],{"type":28,"value":4731},{"type":23,"tag":24,"props":4738,"children":4739},{},[4740,4741,4746],{"type":28,"value":1280},{"type":23,"tag":36,"props":4742,"children":4744},{"className":4743},[],[4745],{"type":28,"value":1236},{"type":28,"value":1287},{"type":23,"tag":24,"props":4748,"children":4749},{},[4750,4751,4756],{"type":28,"value":117},{"type":23,"tag":36,"props":4752,"children":4754},{"className":4753},[],[4755],{"type":28,"value":1236},{"type":28,"value":1298},{"type":23,"tag":126,"props":4758,"children":4759},{},[4760,4769,4778,4787,4802,4817],{"type":23,"tag":130,"props":4761,"children":4762},{},[4763,4768],{"type":23,"tag":36,"props":4764,"children":4766},{"className":4765},[],[4767],{"type":28,"value":1310},{"type":28,"value":1312},{"type":23,"tag":130,"props":4770,"children":4771},{},[4772,4777],{"type":23,"tag":36,"props":4773,"children":4775},{"className":4774},[],[4776],{"type":28,"value":1321},{"type":28,"value":1323},{"type":23,"tag":130,"props":4779,"children":4780},{},[4781,4786],{"type":23,"tag":36,"props":4782,"children":4784},{"className":4783},[],[4785],{"type":28,"value":1332},{"type":28,"value":1334},{"type":23,"tag":130,"props":4788,"children":4789},{},[4790,4795,4796,4801],{"type":23,"tag":36,"props":4791,"children":4793},{"className":4792},[],[4794],{"type":28,"value":1343},{"type":28,"value":1345},{"type":23,"tag":36,"props":4797,"children":4799},{"className":4798},[],[4800],{"type":28,"value":615},{"type":28,"value":1352},{"type":23,"tag":130,"props":4803,"children":4804},{},[4805,4810,4811,4816],{"type":23,"tag":36,"props":4806,"children":4808},{"className":4807},[],[4809],{"type":28,"value":1361},{"type":28,"value":1345},{"type":23,"tag":36,"props":4812,"children":4814},{"className":4813},[],[4815],{"type":28,"value":615},{"type":28,"value":1369},{"type":23,"tag":130,"props":4818,"children":4819},{},[4820,4825,4826,4831],{"type":23,"tag":36,"props":4821,"children":4823},{"className":4822},[],[4824],{"type":28,"value":1378},{"type":28,"value":1345},{"type":23,"tag":36,"props":4827,"children":4829},{"className":4828},[],[4830],{"type":28,"value":615},{"type":28,"value":1386},{"type":23,"tag":24,"props":4833,"children":4834},{},[4835,4839],{"type":23,"tag":199,"props":4836,"children":4837},{},[4838],{"type":28,"value":1394},{"type":28,"value":1396},{"title":8,"searchDepth":61,"depth":61,"links":4841},[],"content:guides:node:got:protecting-the-generated-pdf.md","guides/node/got/protecting-the-generated-pdf.md",{"_path":4845,"_dir":3681,"_draft":7,"_partial":7,"_locale":8,"title":1403,"description":4846,"language":11,"library":3683,"property":1405,"output":14,"related":4847,"default":7,"body":4848,"_type":63,"_id":4925,"_source":65,"_file":4926,"_extension":67},"/guides/node/got/receive-a-webhook-event","Receive a notification via a POST request on your server once the conversion was done. This allows you to trigger a massive amount of conversion without having to wait on their results, and get notified once they are done. This guides will show you how to receive webhook events in Node and the Got library to call the PDFShift's API.",[1407,1408],{"type":20,"children":4849,"toc":4923},[4850,4854,4858,4862,4871,4875,4879,4883,4891,4895,4903,4907,4911,4919],{"type":23,"tag":24,"props":4851,"children":4852},{},[4853],{"type":28,"value":1415},{"type":23,"tag":24,"props":4855,"children":4856},{},[4857],{"type":28,"value":1420},{"type":23,"tag":24,"props":4859,"children":4860},{},[4861],{"type":28,"value":1266},{"type":23,"tag":44,"props":4863,"children":4866},{"className":4864,"code":4865,"language":49,"meta":8},[47],"const got = require('got');\n\n// You can get an API key at https://pdfshift.io\napiKey = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    webhook: 'https://enyygzdj8jy9b.x.pipedream.net/'\n}\n\nconst response = await got.post('https://api.pdfshift.io/v3/convert/pdf', {\n    headers: { 'X-API-Key': apiKey },\n    json: params,\n    responseType: 'json'\n});\n\nconsole.log('The PDF document was generated and you will receive an event on your webhook once it is done.');\n",[4867],{"type":23,"tag":36,"props":4868,"children":4869},{"__ignoreMap":8},[4870],{"type":28,"value":4865},{"type":23,"tag":24,"props":4872,"children":4873},{},[4874],{"type":28,"value":1438},{"type":23,"tag":24,"props":4876,"children":4877},{},[4878],{"type":28,"value":1443},{"type":23,"tag":24,"props":4880,"children":4881},{},[4882],{"type":28,"value":1448},{"type":23,"tag":44,"props":4884,"children":4886},{"className":4885,"code":1452,"language":574,"meta":8},[573],[4887],{"type":23,"tag":36,"props":4888,"children":4889},{"__ignoreMap":8},[4890],{"type":28,"value":1452},{"type":23,"tag":24,"props":4892,"children":4893},{},[4894],{"type":28,"value":1462},{"type":23,"tag":44,"props":4896,"children":4898},{"className":4897,"code":1466,"language":574,"meta":8},[573],[4899],{"type":23,"tag":36,"props":4900,"children":4901},{"__ignoreMap":8},[4902],{"type":28,"value":1466},{"type":23,"tag":24,"props":4904,"children":4905},{},[4906],{"type":28,"value":1476},{"type":23,"tag":24,"props":4908,"children":4909},{},[4910],{"type":28,"value":1481},{"type":23,"tag":44,"props":4912,"children":4914},{"className":4913,"code":8,"language":574,"meta":8},[573],[4915],{"type":23,"tag":36,"props":4916,"children":4917},{"__ignoreMap":8},[4918],{"type":28,"value":8},{"type":23,"tag":24,"props":4920,"children":4921},{},[4922],{"type":28,"value":1494},{"title":8,"searchDepth":61,"depth":61,"links":4924},[],"content:guides:node:got:receive-a-webhook-event.md","guides/node/got/receive-a-webhook-event.md",{"_path":4928,"_dir":3681,"_draft":7,"_partial":7,"_locale":8,"title":1501,"description":4929,"language":11,"library":3683,"property":1503,"output":14,"related":4930,"default":7,"body":4931,"_type":63,"_id":5001,"_source":65,"_file":5002,"_extension":67},"/guides/node/got/save-your-pdf-online-and-get-back-a-url","This guides shows you how can generate a PDF document from HTML and get back an URL instead of the raw PDF. This allows you to share the link directly to your users or redirect them to that page. Learn how you can achieve it using Node and the Got library to call PDFShift's API.",[1408,1505],{"type":20,"children":4932,"toc":4999},[4933,4937,4947,4956,4971,4975,4983,4991],{"type":23,"tag":24,"props":4934,"children":4935},{},[4936],{"type":28,"value":1512},{"type":23,"tag":24,"props":4938,"children":4939},{},[4940,4941,4946],{"type":28,"value":1517},{"type":23,"tag":36,"props":4942,"children":4944},{"className":4943},[],[4945],{"type":28,"value":1503},{"type":28,"value":1524},{"type":23,"tag":44,"props":4948,"children":4951},{"className":4949,"code":4950,"language":49,"meta":8},[47],"const got = require('got');\n\n// You can get an API key at https://pdfshift.io\napiKey = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    'filename': 'example.pdf'\n}\n\nconst response = await got.post('https://api.pdfshift.io/v3/convert/pdf', {\n    headers: { 'X-API-Key': apiKey },\n    json: params,\n    responseType: 'json'\n});\n\nconsole.log('The PDF document was generated and is available online via the url in the response');\n",[4952],{"type":23,"tag":36,"props":4953,"children":4954},{"__ignoreMap":8},[4955],{"type":28,"value":4950},{"type":23,"tag":24,"props":4957,"children":4958},{},[4959,4960,4965,4966,4970],{"type":28,"value":1538},{"type":23,"tag":36,"props":4961,"children":4963},{"className":4962},[],[4964],{"type":28,"value":1503},{"type":28,"value":1545},{"type":23,"tag":199,"props":4967,"children":4968},{},[4969],{"type":28,"value":1550},{"type":28,"value":1552},{"type":23,"tag":24,"props":4972,"children":4973},{},[4974],{"type":28,"value":1557},{"type":23,"tag":44,"props":4976,"children":4978},{"className":4977,"code":1561,"language":574,"meta":8},[573],[4979],{"type":23,"tag":36,"props":4980,"children":4981},{"__ignoreMap":8},[4982],{"type":28,"value":1561},{"type":23,"tag":24,"props":4984,"children":4985},{},[4986,4990],{"type":23,"tag":199,"props":4987,"children":4988},{},[4989],{"type":28,"value":203},{"type":28,"value":1575},{"type":23,"tag":24,"props":4992,"children":4993},{},[4994,4998],{"type":23,"tag":199,"props":4995,"children":4996},{},[4997],{"type":28,"value":203},{"type":28,"value":1584},{"title":8,"searchDepth":61,"depth":61,"links":5000},[],"content:guides:node:got:save-your-pdf-online-and-get-back-a-url.md","guides/node/got/save-your-pdf-online-and-get-back-a-url.md",{"_path":5004,"_dir":3681,"_draft":7,"_partial":7,"_locale":8,"title":1591,"description":5005,"language":11,"library":3683,"property":1593,"output":14,"related":5006,"default":7,"body":5007,"_type":63,"_id":5094,"_source":65,"_file":5095,"_extension":67},"/guides/node/got/save-your-pdf-to-your-amazon-s3-bucket","This guides shows you how can generate a PDF document from HTML with PDFShift's API and save it to your own Amazon S3 bucket. This allows you to generate document and automate actions once the document has been created on your bucket. This guides explains you how to do it using Node and the Got library.",[1407,1505],{"type":20,"children":5008,"toc":5092},[5009,5013,5017,5021,5029,5039,5048,5058,5066,5070,5078,5082],{"type":23,"tag":24,"props":5010,"children":5011},{},[5012],{"type":28,"value":1601},{"type":23,"tag":24,"props":5014,"children":5015},{},[5016],{"type":28,"value":1606},{"type":23,"tag":24,"props":5018,"children":5019},{},[5020],{"type":28,"value":1611},{"type":23,"tag":44,"props":5022,"children":5024},{"className":5023,"code":1615,"language":574,"meta":8},[573],[5025],{"type":23,"tag":36,"props":5026,"children":5027},{"__ignoreMap":8},[5028],{"type":28,"value":1615},{"type":23,"tag":24,"props":5030,"children":5031},{},[5032,5033,5038],{"type":28,"value":1625},{"type":23,"tag":36,"props":5034,"children":5036},{"className":5035},[],[5037],{"type":28,"value":1593},{"type":28,"value":1632},{"type":23,"tag":44,"props":5040,"children":5043},{"className":5041,"code":5042,"language":49,"meta":8},[47],"const got = require('got');\n\n// You can get an API key at https://pdfshift.io\napiKey = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    s3_destination: 's3://DOC-EXAMPLE-BUCKET/test/example.pdf'\n}\n\nconst response = await got.post('https://api.pdfshift.io/v3/convert/pdf', {\n    headers: { 'X-API-Key': apiKey },\n    json: params,\n    responseType: 'json'\n});\n\nconsole.log('The PDF document was generated and saved to your S3 Bucket');\n",[5044],{"type":23,"tag":36,"props":5045,"children":5046},{"__ignoreMap":8},[5047],{"type":28,"value":5042},{"type":23,"tag":24,"props":5049,"children":5050},{},[5051,5052,5057],{"type":28,"value":1646},{"type":23,"tag":36,"props":5053,"children":5055},{"className":5054},[],[5056],{"type":28,"value":1593},{"type":28,"value":1653},{"type":23,"tag":44,"props":5059,"children":5061},{"className":5060,"code":1657,"language":574,"meta":8},[573],[5062],{"type":23,"tag":36,"props":5063,"children":5064},{"__ignoreMap":8},[5065],{"type":28,"value":1657},{"type":23,"tag":24,"props":5067,"children":5068},{},[5069],{"type":28,"value":1667},{"type":23,"tag":44,"props":5071,"children":5073},{"className":5072,"code":1671,"language":574,"meta":8},[573],[5074],{"type":23,"tag":36,"props":5075,"children":5076},{"__ignoreMap":8},[5077],{"type":28,"value":1671},{"type":23,"tag":24,"props":5079,"children":5080},{},[5081],{"type":28,"value":1681},{"type":23,"tag":24,"props":5083,"children":5084},{},[5085,5086,5091],{"type":28,"value":1686},{"type":23,"tag":36,"props":5087,"children":5089},{"className":5088},[],[5090],{"type":28,"value":1405},{"type":28,"value":1693},{"title":8,"searchDepth":61,"depth":61,"links":5093},[],"content:guides:node:got:save-your-pdf-to-your-amazon-s3-bucket.md","guides/node/got/save-your-pdf-to-your-amazon-s3-bucket.md",{"_path":5097,"_dir":3681,"_draft":7,"_partial":7,"_locale":8,"title":1700,"description":5098,"language":11,"library":3683,"property":1702,"output":14,"related":5099,"default":7,"body":5100,"_type":63,"_id":5125,"_source":65,"_file":5126,"_extension":67},"/guides/node/got/send-custom-http-headers","Learn how to add custom HTTP headers when requesting an URL to be converted in PDF with PDFShift's API. It allows you to add specific headers that your backend can check against to authenticate a query before converting it to PDF. This guide explains you how using Node and the Got library.",[17,1704],{"type":20,"children":5101,"toc":5123},[5102,5106,5110,5119],{"type":23,"tag":24,"props":5103,"children":5104},{},[5105],{"type":28,"value":1711},{"type":23,"tag":24,"props":5107,"children":5108},{},[5109],{"type":28,"value":1716},{"type":23,"tag":44,"props":5111,"children":5114},{"className":5112,"code":5113,"language":49,"meta":8},[47],"const got = require('got');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napiKey = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    http_headers: {\n        'x-custom-header': 'custom-value',\n        Authorization: 'Bearer {token}'  // This allows you to authenticate PDFShift to your service in a custom way\n    }\n}\n\nconst response = await got.post('https://api.pdfshift.io/v3/convert/pdf', {\n    headers: { 'X-API-Key': apiKey },\n    json: params,\n    responseType: 'buffer'\n});\n\n// Write the buffer as result.pdf\nfs.writeFileSync('result.pdf', await response.buffer());\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[5115],{"type":23,"tag":36,"props":5116,"children":5117},{"__ignoreMap":8},[5118],{"type":28,"value":5113},{"type":23,"tag":24,"props":5120,"children":5121},{},[5122],{"type":28,"value":1730},{"title":8,"searchDepth":61,"depth":61,"links":5124},[],"content:guides:node:got:send-custom-http-headers.md","guides/node/got/send-custom-http-headers.md",{"_path":5128,"_dir":3681,"_draft":7,"_partial":7,"_locale":8,"title":1737,"description":5129,"language":11,"library":3683,"property":1739,"output":14,"related":5130,"default":7,"body":5131,"_type":63,"_id":5211,"_source":65,"_file":5212,"_extension":67},"/guides/node/got/using-cookies","Learn how to add custom Cookies when requesting an URL to be converted in PDF with PDFShift's API. It allows you to pursue an active session for instance, that will authenticate the request as a specific user before converting the page to PDF. This guide explains you how using Node and the Got library.",[16,1704],{"type":20,"children":5132,"toc":5209},[5133,5137,5147,5156,5166,5205],{"type":23,"tag":24,"props":5134,"children":5135},{},[5136],{"type":28,"value":1747},{"type":23,"tag":24,"props":5138,"children":5139},{},[5140,5141,5146],{"type":28,"value":1752},{"type":23,"tag":36,"props":5142,"children":5144},{"className":5143},[],[5145],{"type":28,"value":1739},{"type":28,"value":1759},{"type":23,"tag":44,"props":5148,"children":5151},{"className":5149,"code":5150,"language":49,"meta":8},[47],"const got = require('got');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napiKey = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    // The \"cookies\" parameter expects a list of dictionnary that contains the name and the value of the cookies\n    cookies: [\n        { name: 'PHPSESSID', value: 'el4ukv0kqbvoirg7nkp4dncpk3' }\n    ]\n}\n\nconst response = await got.post('https://api.pdfshift.io/v3/convert/pdf', {\n    headers: { 'X-API-Key': apiKey },\n    json: params,\n    responseType: 'buffer'\n});\n\n// Write the buffer as result.pdf\nfs.writeFileSync('result.pdf', await response.buffer());\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[5152],{"type":23,"tag":36,"props":5153,"children":5154},{"__ignoreMap":8},[5155],{"type":28,"value":5150},{"type":23,"tag":24,"props":5157,"children":5158},{},[5159,5160,5165],{"type":28,"value":117},{"type":23,"tag":36,"props":5161,"children":5163},{"className":5162},[],[5164],{"type":28,"value":1739},{"type":28,"value":1779},{"type":23,"tag":126,"props":5167,"children":5168},{},[5169,5178,5187,5196],{"type":23,"tag":130,"props":5170,"children":5171},{},[5172,5177],{"type":23,"tag":36,"props":5173,"children":5175},{"className":5174},[],[5176],{"type":28,"value":1791},{"type":28,"value":1793},{"type":23,"tag":130,"props":5179,"children":5180},{},[5181,5186],{"type":23,"tag":36,"props":5182,"children":5184},{"className":5183},[],[5185],{"type":28,"value":1802},{"type":28,"value":1804},{"type":23,"tag":130,"props":5188,"children":5189},{},[5190,5195],{"type":23,"tag":36,"props":5191,"children":5193},{"className":5192},[],[5194],{"type":28,"value":1813},{"type":28,"value":1815},{"type":23,"tag":130,"props":5197,"children":5198},{},[5199,5204],{"type":23,"tag":36,"props":5200,"children":5202},{"className":5201},[],[5203],{"type":28,"value":1824},{"type":28,"value":1826},{"type":23,"tag":24,"props":5206,"children":5207},{},[5208],{"type":28,"value":1831},{"title":8,"searchDepth":61,"depth":61,"links":5210},[],"content:guides:node:got:using-cookies.md","guides/node/got/using-cookies.md",{"_path":5214,"_dir":3681,"_draft":7,"_partial":7,"_locale":8,"title":1838,"description":5215,"language":11,"library":3683,"property":1840,"output":14,"related":5216,"default":7,"body":5217,"_type":63,"_id":5353,"_source":65,"_file":5354,"_extension":67},"/guides/node/got/waiting-for-a-custom-element-to-be-ready","Learn how to set up a custom javascript function that will waits for a specific condition to become true before allowing the conversion to happen. This is very interesting for waiting on charts to be generated, or custom fonts to be loaded. With PDFShift's API, this can easily be done using Node and the Got library.",[1842,76],{"type":20,"children":5218,"toc":5351},[5219,5229,5239,5248,5258,5267,5271,5279,5307,5316,5320,5329],{"type":23,"tag":24,"props":5220,"children":5221},{},[5222,5223,5228],{"type":28,"value":117},{"type":23,"tag":36,"props":5224,"children":5226},{"className":5225},[],[5227],{"type":28,"value":1840},{"type":28,"value":1855},{"type":23,"tag":24,"props":5230,"children":5231},{},[5232,5233,5238],{"type":28,"value":1860},{"type":23,"tag":36,"props":5234,"children":5236},{"className":5235},[],[5237],{"type":28,"value":1840},{"type":28,"value":1867},{"type":23,"tag":24,"props":5240,"children":5241},{},[5242,5243,5247],{"type":28,"value":1872},{"type":23,"tag":106,"props":5244,"children":5245},{},[5246],{"type":28,"value":1877},{"type":28,"value":1879},{"type":23,"tag":24,"props":5249,"children":5250},{},[5251,5252,5257],{"type":28,"value":1884},{"type":23,"tag":36,"props":5253,"children":5255},{"className":5254},[],[5256],{"type":28,"value":1840},{"type":28,"value":1891},{"type":23,"tag":24,"props":5259,"children":5260},{},[5261,5262,5266],{"type":28,"value":1896},{"type":23,"tag":199,"props":5263,"children":5264},{},[5265],{"type":28,"value":1901},{"type":28,"value":183},{"type":23,"tag":24,"props":5268,"children":5269},{},[5270],{"type":28,"value":1907},{"type":23,"tag":44,"props":5272,"children":5274},{"className":5273,"code":1911,"language":49,"meta":8},[47],[5275],{"type":23,"tag":36,"props":5276,"children":5277},{"__ignoreMap":8},[5278],{"type":28,"value":1911},{"type":23,"tag":24,"props":5280,"children":5281},{},[5282,5283,5288,5289,5294,5295,5300,5301,5306],{"type":28,"value":1921},{"type":23,"tag":36,"props":5284,"children":5286},{"className":5285},[],[5287],{"type":28,"value":1840},{"type":28,"value":609},{"type":23,"tag":36,"props":5290,"children":5292},{"className":5291},[],[5293],{"type":28,"value":1933},{"type":28,"value":1935},{"type":23,"tag":36,"props":5296,"children":5298},{"className":5297},[],[5299],{"type":28,"value":1933},{"type":28,"value":1942},{"type":23,"tag":36,"props":5302,"children":5304},{"className":5303},[],[5305],{"type":28,"value":644},{"type":28,"value":1949},{"type":23,"tag":44,"props":5308,"children":5311},{"className":5309,"code":5310,"language":49,"meta":8},[47],"const got = require('got');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napiKey = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    wait_for: 'isPageReady'\n}\n\nconst response = await got.post('https://api.pdfshift.io/v3/convert/pdf', {\n    headers: { 'X-API-Key': apiKey },\n    json: params,\n    responseType: 'buffer'\n});\n\n// Write the buffer as result.pdf\nfs.writeFileSync('result.pdf', await response.buffer());\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[5312],{"type":23,"tag":36,"props":5313,"children":5314},{"__ignoreMap":8},[5315],{"type":28,"value":5310},{"type":23,"tag":24,"props":5317,"children":5318},{},[5319],{"type":28,"value":1963},{"type":23,"tag":44,"props":5321,"children":5324},{"className":5322,"code":5323,"language":49,"meta":8},[47],"const got = require('got');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napiKey = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    javascript: 'let isFontReady = false; document.fonts.ready.then(() => isFontReady = true); function isPageReady() { return isFontReady; }',\n    wait_for: 'isPageReady'\n}\n\nconst response = await got.post('https://api.pdfshift.io/v3/convert/pdf', {\n    headers: { 'X-API-Key': apiKey },\n    json: params,\n    responseType: 'buffer'\n});\n\n// Write the buffer as result.pdf\nfs.writeFileSync('result.pdf', await response.buffer());\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[5325],{"type":23,"tag":36,"props":5326,"children":5327},{"__ignoreMap":8},[5328],{"type":28,"value":5323},{"type":23,"tag":24,"props":5330,"children":5331},{},[5332,5333,5338,5339,5344,5345,5350],{"type":28,"value":1977},{"type":23,"tag":36,"props":5334,"children":5336},{"className":5335},[],[5337],{"type":28,"value":644},{"type":28,"value":1984},{"type":23,"tag":36,"props":5340,"children":5342},{"className":5341},[],[5343],{"type":28,"value":1933},{"type":28,"value":1991},{"type":23,"tag":36,"props":5346,"children":5348},{"className":5347},[],[5349],{"type":28,"value":1933},{"type":28,"value":1998},{"title":8,"searchDepth":61,"depth":61,"links":5352},[],"content:guides:node:got:waiting-for-a-custom-element-to-be-ready.md","guides/node/got/waiting-for-a-custom-element-to-be-ready.md",{"_path":5356,"_dir":5357,"_draft":7,"_partial":7,"_locale":8,"title":9,"description":5358,"language":11,"library":5359,"property":13,"output":14,"related":5360,"default":18,"body":5361,"_type":63,"_id":5393,"_source":65,"_file":5394,"_extension":67},"/guides/node/needle/accessing-secured-pages","needle","Learn how to access secured pages using Node and the Needle library. This guide offers detailed steps with code samples in Node and the Needle library, highlighting how you can acces page protected by basic authentication to convert them to PDF using PDFShift's API.","Needle",[16,17],{"type":20,"children":5362,"toc":5391},[5363,5368,5378,5387],{"type":23,"tag":24,"props":5364,"children":5365},{},[5366],{"type":28,"value":5367},"In this guide, we'll show you how to access secured page (protected by basic authentication) using Node and the Needle library to convert them to PDF using PDFShift's API.",{"type":23,"tag":24,"props":5369,"children":5370},{},[5371,5372,5377],{"type":28,"value":34},{"type":23,"tag":36,"props":5373,"children":5375},{"className":5374},[],[5376],{"type":28,"value":13},{"type":28,"value":42},{"type":23,"tag":44,"props":5379,"children":5382},{"className":5380,"code":5381,"language":49,"meta":8},[47],"const needle = require('needle');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    // You can set a basic authentication by passing the \"auth\" property which contains a username and password\n    auth: {\n        username: 'user',\n        password: 'password'\n    }\n}\n\nneedle.post(\n    'https://api.pdfshift.io/v3/convert/pdf',\n    params,\n    {\n        headers: { 'X-API-Key': apiKey },\n        json: params,\n    },\n    function(err, resp) {\n        if (err) throw err;\n\n        // Write the response body to a local file\n        fs.writeFileSync('result.pdf', resp.body, 'binary');\n\n        console.log('The PDF document was generated and saved to result.pdf');\n    }\n)\n",[5383],{"type":23,"tag":36,"props":5384,"children":5385},{"__ignoreMap":8},[5386],{"type":28,"value":5381},{"type":23,"tag":24,"props":5388,"children":5389},{},[5390],{"type":28,"value":59},{"title":8,"searchDepth":61,"depth":61,"links":5392},[],"content:guides:node:needle:accessing-secured-pages.md","guides/node/needle/accessing-secured-pages.md",{"_path":5396,"_dir":5357,"_draft":7,"_partial":7,"_locale":8,"title":70,"description":5397,"language":11,"library":5359,"property":72,"output":14,"related":5398,"default":18,"body":5399,"_type":63,"_id":5586,"_source":65,"_file":5587,"_extension":67},"/guides/node/needle/adding-a-custom-header-or-footer","Discover how to add custom headers or footers to a PDF using Node and the Needle library. This in-depth guide includes Node codes that you can easily follow and quickly generate documents with PDFShift's API.",[74,75,76,77],{"type":20,"children":5400,"toc":5584},[5401,5406,5427,5437,5491,5499,5503,5512,5522,5526,5580],{"type":23,"tag":24,"props":5402,"children":5403},{},[5404],{"type":28,"value":5405},"In this guide, we'll show you how to add custom headers or footers to a PDF using Node and the Needle library.",{"type":23,"tag":24,"props":5407,"children":5408},{},[5409,5410,5415,5416,5421,5422,5426],{"type":28,"value":89},{"type":23,"tag":36,"props":5411,"children":5413},{"className":5412},[],[5414],{"type":28,"value":72},{"type":28,"value":96},{"type":23,"tag":36,"props":5417,"children":5419},{"className":5418},[],[5420],{"type":28,"value":102},{"type":28,"value":104},{"type":23,"tag":106,"props":5423,"children":5424},{},[5425],{"type":28,"value":110},{"type":28,"value":112},{"type":23,"tag":24,"props":5428,"children":5429},{},[5430,5431,5436],{"type":28,"value":117},{"type":23,"tag":36,"props":5432,"children":5434},{"className":5433},[],[5435],{"type":28,"value":72},{"type":28,"value":124},{"type":23,"tag":126,"props":5438,"children":5439},{},[5440,5449,5482],{"type":23,"tag":130,"props":5441,"children":5442},{},[5443,5448],{"type":23,"tag":36,"props":5444,"children":5446},{"className":5445},[],[5447],{"type":28,"value":138},{"type":28,"value":140},{"type":23,"tag":130,"props":5450,"children":5451},{},[5452,5457,5458,5463,5464,5469,5470,5475,5476,5481],{"type":23,"tag":36,"props":5453,"children":5455},{"className":5454},[],[5456],{"type":28,"value":149},{"type":28,"value":151},{"type":23,"tag":36,"props":5459,"children":5461},{"className":5460},[],[5462],{"type":28,"value":157},{"type":28,"value":159},{"type":23,"tag":36,"props":5465,"children":5467},{"className":5466},[],[5468],{"type":28,"value":165},{"type":28,"value":167},{"type":23,"tag":36,"props":5471,"children":5473},{"className":5472},[],[5474],{"type":28,"value":173},{"type":28,"value":175},{"type":23,"tag":36,"props":5477,"children":5479},{"className":5478},[],[5480],{"type":28,"value":181},{"type":28,"value":183},{"type":23,"tag":130,"props":5483,"children":5484},{},[5485,5490],{"type":23,"tag":36,"props":5486,"children":5488},{"className":5487},[],[5489],{"type":28,"value":192},{"type":28,"value":194},{"type":23,"tag":24,"props":5492,"children":5493},{},[5494,5498],{"type":23,"tag":199,"props":5495,"children":5496},{},[5497],{"type":28,"value":203},{"type":28,"value":205},{"type":23,"tag":24,"props":5500,"children":5501},{},[5502],{"type":28,"value":210},{"type":23,"tag":44,"props":5504,"children":5507},{"className":5505,"code":5506,"language":49,"meta":8},[47],"const needle = require('needle');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://en.wikipedia.org/wiki/PDF',\n    header: {\n        source: '\u003Cdiv>Page {{ page }} over a total of {{ total }}. Made on {{ date }}\u003C/div>',\n        height: 150,\n        start_at: 2\n    }\n}\n\nneedle.post(\n    'https://api.pdfshift.io/v3/convert/pdf',\n    params,\n    {\n        headers: { 'X-API-Key': apiKey },\n        json: params,\n    },\n    function(err, resp) {\n        if (err) throw err;\n\n        // Write the response body to a local file\n        fs.writeFileSync('result.pdf', resp.body, 'binary');\n\n        console.log('The PDF document was generated and saved to result.pdf');\n    }\n)\n",[5508],{"type":23,"tag":36,"props":5509,"children":5510},{"__ignoreMap":8},[5511],{"type":28,"value":5506},{"type":23,"tag":24,"props":5513,"children":5514},{},[5515,5516,5521],{"type":28,"value":117},{"type":23,"tag":36,"props":5517,"children":5519},{"className":5518},[],[5520],{"type":28,"value":138},{"type":28,"value":230},{"type":23,"tag":24,"props":5523,"children":5524},{},[5525],{"type":28,"value":235},{"type":23,"tag":126,"props":5527,"children":5528},{},[5529,5538,5547,5556,5565],{"type":23,"tag":130,"props":5530,"children":5531},{},[5532,5537],{"type":23,"tag":36,"props":5533,"children":5535},{"className":5534},[],[5536],{"type":28,"value":247},{"type":28,"value":249},{"type":23,"tag":130,"props":5539,"children":5540},{},[5541,5546],{"type":23,"tag":36,"props":5542,"children":5544},{"className":5543},[],[5545],{"type":28,"value":258},{"type":28,"value":260},{"type":23,"tag":130,"props":5548,"children":5549},{},[5550,5555],{"type":23,"tag":36,"props":5551,"children":5553},{"className":5552},[],[5554],{"type":28,"value":269},{"type":28,"value":271},{"type":23,"tag":130,"props":5557,"children":5558},{},[5559,5564],{"type":23,"tag":36,"props":5560,"children":5562},{"className":5561},[],[5563],{"type":28,"value":280},{"type":28,"value":282},{"type":23,"tag":130,"props":5566,"children":5567},{},[5568,5573,5574,5579],{"type":23,"tag":36,"props":5569,"children":5571},{"className":5570},[],[5572],{"type":28,"value":291},{"type":28,"value":293},{"type":23,"tag":36,"props":5575,"children":5577},{"className":5576},[],[5578],{"type":28,"value":299},{"type":28,"value":301},{"type":23,"tag":24,"props":5581,"children":5582},{},[5583],{"type":28,"value":306},{"title":8,"searchDepth":61,"depth":61,"links":5585},[],"content:guides:node:needle:adding-a-custom-header-or-footer.md","guides/node/needle/adding-a-custom-header-or-footer.md",{"_path":5589,"_dir":5357,"_draft":7,"_partial":7,"_locale":8,"title":313,"description":5590,"language":11,"library":5359,"property":315,"output":14,"related":5591,"default":18,"body":5592,"_type":63,"_id":5721,"_source":65,"_file":5722,"_extension":67},"/guides/node/needle/adding-a-text-watermark","Learn how to add text watermarks to your generated PDF document using Node and the Needle library. With this guide, you'll be able to add watermarks on top of your generated PDFs easily with a quick request to PDFShift's API.",[317,318],{"type":20,"children":5593,"toc":5719},[5594,5598,5608,5617,5621,5678,5682,5703,5707,5711],{"type":23,"tag":24,"props":5595,"children":5596},{},[5597],{"type":28,"value":325},{"type":23,"tag":24,"props":5599,"children":5600},{},[5601,5602,5607],{"type":28,"value":330},{"type":23,"tag":36,"props":5603,"children":5605},{"className":5604},[],[5606],{"type":28,"value":315},{"type":28,"value":337},{"type":23,"tag":44,"props":5609,"children":5612},{"className":5610,"code":5611,"language":49,"meta":8},[47],"const needle = require('needle');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    watermark: {\n        text: 'PROTECTED DOCUMENT',\n        offset_x: 'center',\n        offset_top: 'top'\n    }\n}\n\nneedle.post(\n    'https://api.pdfshift.io/v3/convert/pdf',\n    params,\n    {\n        headers: { 'X-API-Key': apiKey },\n        json: params,\n    },\n    function(err, resp) {\n        if (err) throw err;\n\n        // Write the response body to a local file\n        fs.writeFileSync('result.pdf', resp.body, 'binary');\n\n        console.log('The PDF document was generated and saved to result.pdf');\n    }\n)\n",[5613],{"type":23,"tag":36,"props":5614,"children":5615},{"__ignoreMap":8},[5616],{"type":28,"value":5611},{"type":23,"tag":24,"props":5618,"children":5619},{},[5620],{"type":28,"value":351},{"type":23,"tag":126,"props":5622,"children":5623},{},[5624,5633,5642,5651,5660,5669],{"type":23,"tag":130,"props":5625,"children":5626},{},[5627,5632],{"type":23,"tag":36,"props":5628,"children":5630},{"className":5629},[],[5631],{"type":28,"value":363},{"type":28,"value":365},{"type":23,"tag":130,"props":5634,"children":5635},{},[5636,5641],{"type":23,"tag":36,"props":5637,"children":5639},{"className":5638},[],[5640],{"type":28,"value":374},{"type":28,"value":376},{"type":23,"tag":130,"props":5643,"children":5644},{},[5645,5650],{"type":23,"tag":36,"props":5646,"children":5648},{"className":5647},[],[5649],{"type":28,"value":385},{"type":28,"value":387},{"type":23,"tag":130,"props":5652,"children":5653},{},[5654,5659],{"type":23,"tag":36,"props":5655,"children":5657},{"className":5656},[],[5658],{"type":28,"value":396},{"type":28,"value":398},{"type":23,"tag":130,"props":5661,"children":5662},{},[5663,5668],{"type":23,"tag":36,"props":5664,"children":5666},{"className":5665},[],[5667],{"type":28,"value":407},{"type":28,"value":409},{"type":23,"tag":130,"props":5670,"children":5671},{},[5672,5677],{"type":23,"tag":36,"props":5673,"children":5675},{"className":5674},[],[5676],{"type":28,"value":418},{"type":28,"value":420},{"type":23,"tag":24,"props":5679,"children":5680},{},[5681],{"type":28,"value":425},{"type":23,"tag":126,"props":5683,"children":5684},{},[5685,5694],{"type":23,"tag":130,"props":5686,"children":5687},{},[5688,5693],{"type":23,"tag":36,"props":5689,"children":5691},{"className":5690},[],[5692],{"type":28,"value":437},{"type":28,"value":439},{"type":23,"tag":130,"props":5695,"children":5696},{},[5697,5702],{"type":23,"tag":36,"props":5698,"children":5700},{"className":5699},[],[5701],{"type":28,"value":448},{"type":28,"value":450},{"type":23,"tag":24,"props":5704,"children":5705},{},[5706],{"type":28,"value":455},{"type":23,"tag":24,"props":5708,"children":5709},{},[5710],{"type":28,"value":460},{"type":23,"tag":44,"props":5712,"children":5714},{"className":5713,"code":464,"language":49,"meta":8},[47],[5715],{"type":23,"tag":36,"props":5716,"children":5717},{"__ignoreMap":8},[5718],{"type":28,"value":464},{"title":8,"searchDepth":61,"depth":61,"links":5720},[],"content:guides:node:needle:adding-a-text-watermark.md","guides/node/needle/adding-a-text-watermark.md",{"_path":5724,"_dir":5357,"_draft":7,"_partial":7,"_locale":8,"title":476,"description":5725,"language":11,"library":5359,"property":315,"output":14,"related":5726,"default":18,"body":5727,"_type":63,"_id":5820,"_source":65,"_file":5821,"_extension":67},"/guides/node/needle/adding-an-image-watermark","Discover how to effortlessly add image watermarks to PDFs using Node and the Needle library. Our guide shows you how to add images on top of your PDF to protect your document easily. This is easily done with a simple request to PDFShift's API.",[318,479],{"type":20,"children":5728,"toc":5818},[5729,5733,5743,5752,5756,5767,5777,5781,5802,5806,5810],{"type":23,"tag":24,"props":5730,"children":5731},{},[5732],{"type":28,"value":325},{"type":23,"tag":24,"props":5734,"children":5735},{},[5736,5737,5742],{"type":28,"value":330},{"type":23,"tag":36,"props":5738,"children":5740},{"className":5739},[],[5741],{"type":28,"value":315},{"type":28,"value":496},{"type":23,"tag":44,"props":5744,"children":5747},{"className":5745,"code":5746,"language":49,"meta":8},[47],"const needle = require('needle');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    watermark: {\n        image: 'https://placekitten.com/200/300',\n        offset_x: 'center',\n        offset_top: 'top'\n    }\n}\n\nneedle.post(\n    'https://api.pdfshift.io/v3/convert/pdf',\n    params,\n    {\n        headers: { 'X-API-Key': apiKey },\n        json: params,\n    },\n    function(err, resp) {\n        if (err) throw err;\n\n        // Write the response body to a local file\n        fs.writeFileSync('result.pdf', resp.body, 'binary');\n\n        console.log('The PDF document was generated and saved to result.pdf');\n    }\n)\n",[5748],{"type":23,"tag":36,"props":5749,"children":5750},{"__ignoreMap":8},[5751],{"type":28,"value":5746},{"type":23,"tag":24,"props":5753,"children":5754},{},[5755],{"type":28,"value":510},{"type":23,"tag":126,"props":5757,"children":5758},{},[5759,5763],{"type":23,"tag":130,"props":5760,"children":5761},{},[5762],{"type":28,"value":518},{"type":23,"tag":130,"props":5764,"children":5765},{},[5766],{"type":28,"value":523},{"type":23,"tag":24,"props":5768,"children":5769},{},[5770,5771,5776],{"type":28,"value":528},{"type":23,"tag":36,"props":5772,"children":5774},{"className":5773},[],[5775],{"type":28,"value":534},{"type":28,"value":536},{"type":23,"tag":24,"props":5778,"children":5779},{},[5780],{"type":28,"value":425},{"type":23,"tag":126,"props":5782,"children":5783},{},[5784,5793],{"type":23,"tag":130,"props":5785,"children":5786},{},[5787,5792],{"type":23,"tag":36,"props":5788,"children":5790},{"className":5789},[],[5791],{"type":28,"value":437},{"type":28,"value":439},{"type":23,"tag":130,"props":5794,"children":5795},{},[5796,5801],{"type":23,"tag":36,"props":5797,"children":5799},{"className":5798},[],[5800],{"type":28,"value":448},{"type":28,"value":450},{"type":23,"tag":24,"props":5803,"children":5804},{},[5805],{"type":28,"value":455},{"type":23,"tag":24,"props":5807,"children":5808},{},[5809],{"type":28,"value":460},{"type":23,"tag":44,"props":5811,"children":5813},{"className":5812,"code":464,"language":574,"meta":8},[573],[5814],{"type":23,"tag":36,"props":5815,"children":5816},{"__ignoreMap":8},[5817],{"type":28,"value":464},{"title":8,"searchDepth":61,"depth":61,"links":5819},[],"content:guides:node:needle:adding-an-image-watermark.md","guides/node/needle/adding-an-image-watermark.md",{"_path":5823,"_dir":5357,"_draft":7,"_partial":7,"_locale":8,"title":586,"description":5824,"language":11,"library":5359,"property":588,"output":14,"related":5825,"default":18,"body":5826,"_type":63,"_id":5875,"_source":65,"_file":5876,"_extension":67},"/guides/node/needle/avoid-conversion-on-error","Learn how to avoid the conversion on error when loading the document using Node and the Needle library and relies on the PDFShift's API.",[590],{"type":20,"children":5827,"toc":5873},[5828,5832,5848,5857],{"type":23,"tag":24,"props":5829,"children":5830},{},[5831],{"type":28,"value":597},{"type":23,"tag":24,"props":5833,"children":5834},{},[5835,5836,5841,5842,5847],{"type":28,"value":602},{"type":23,"tag":36,"props":5837,"children":5839},{"className":5838},[],[5840],{"type":28,"value":588},{"type":28,"value":609},{"type":23,"tag":36,"props":5843,"children":5845},{"className":5844},[],[5846],{"type":28,"value":615},{"type":28,"value":617},{"type":23,"tag":44,"props":5849,"children":5852},{"className":5850,"code":5851,"language":49,"meta":8},[47],"const needle = require('needle');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.httpstat.us/404',\n    raise_for_status: True\n}\n\nneedle.post(\n    'https://api.pdfshift.io/v3/convert/pdf',\n    params,\n    {\n        headers: { 'X-API-Key': apiKey },\n        json: params,\n    },\n    function(err, resp) {\n        if (err) throw err;\n\n        // Write the response body to a local file\n        fs.writeFileSync('result.pdf', resp.body, 'binary');\n\n        console.log('The PDF document was generated and saved to result.pdf');\n    }\n)\n",[5853],{"type":23,"tag":36,"props":5854,"children":5855},{"__ignoreMap":8},[5856],{"type":28,"value":5851},{"type":23,"tag":24,"props":5858,"children":5859},{},[5860,5861,5866,5867,5872],{"type":28,"value":631},{"type":23,"tag":36,"props":5862,"children":5864},{"className":5863},[],[5865],{"type":28,"value":588},{"type":28,"value":638},{"type":23,"tag":36,"props":5868,"children":5870},{"className":5869},[],[5871],{"type":28,"value":644},{"type":28,"value":646},{"title":8,"searchDepth":61,"depth":61,"links":5874},[],"content:guides:node:needle:avoid-conversion-on-error.md","guides/node/needle/avoid-conversion-on-error.md",{"_path":5878,"_dir":5357,"_draft":7,"_partial":7,"_locale":8,"title":653,"description":5879,"language":11,"library":5359,"property":138,"output":14,"related":5880,"default":18,"body":5881,"_type":63,"_id":5902,"_source":65,"_file":5903,"_extension":67},"/guides/node/needle/convert-html-to-pdf-from-a-url","Learn how to easily convert HTML documents to PDF from a URL using Node and the Needle library. This how-to guide offers clear Node code examples that show developers how to implement this using the PDFShift API.",[590,656],{"type":20,"children":5882,"toc":5900},[5883,5887,5896],{"type":23,"tag":24,"props":5884,"children":5885},{},[5886],{"type":28,"value":663},{"type":23,"tag":44,"props":5888,"children":5891},{"className":5889,"code":5890,"language":49,"meta":8},[47],"const needle = require('needle');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n}\n\nneedle.post(\n    'https://api.pdfshift.io/v3/convert/pdf',\n    params,\n    {\n        headers: { 'X-API-Key': apiKey },\n        json: params,\n    },\n    function(err, resp) {\n        if (err) throw err;\n\n        // Write the response body to a local file\n        fs.writeFileSync('result.pdf', resp.body, 'binary');\n\n        console.log('The PDF document was generated and saved to result.pdf');\n    }\n)\n",[5892],{"type":23,"tag":36,"props":5893,"children":5894},{"__ignoreMap":8},[5895],{"type":28,"value":5890},{"type":23,"tag":24,"props":5897,"children":5898},{},[5899],{"type":28,"value":677},{"title":8,"searchDepth":61,"depth":61,"links":5901},[],"content:guides:node:needle:convert-html-to-pdf-from-a-url.md","guides/node/needle/convert-html-to-pdf-from-a-url.md",{"_path":5905,"_dir":5357,"_draft":7,"_partial":7,"_locale":8,"title":684,"description":5906,"language":11,"library":5359,"output":14,"related":5907,"default":18,"body":5908,"_type":63,"_id":5981,"_source":65,"_file":5982,"_extension":67},"/guides/node/needle/convert-html-to-pdf-from-raw-html","Learn how to to convert raw HTML document to PDF using Node and the Needle library. Our guide will explain you how to quickly convert documents with PDFShift's API.",[687],{"type":20,"children":5909,"toc":5979},[5910,5915,5930,5946,5956,5960,5969],{"type":23,"tag":24,"props":5911,"children":5912},{},[5913],{"type":28,"value":5914},"In this guide, we'll show you how to convert an HTML document to PDF using Node and the Needle library.\nProviding the HTML document as raw as a lot of great advantages :",{"type":23,"tag":126,"props":5916,"children":5917},{},[5918,5922,5926],{"type":23,"tag":130,"props":5919,"children":5920},{},[5921],{"type":28,"value":702},{"type":23,"tag":130,"props":5923,"children":5924},{},[5925],{"type":28,"value":707},{"type":23,"tag":130,"props":5927,"children":5928},{},[5929],{"type":28,"value":712},{"type":23,"tag":24,"props":5931,"children":5932},{},[5933,5934,5939,5940,5945],{"type":28,"value":717},{"type":23,"tag":36,"props":5935,"children":5937},{"className":5936},[],[5938],{"type":28,"value":723},{"type":28,"value":725},{"type":23,"tag":36,"props":5941,"children":5943},{"className":5942},[],[5944],{"type":28,"value":731},{"type":28,"value":733},{"type":23,"tag":24,"props":5947,"children":5948},{},[5949,5950,5955],{"type":28,"value":738},{"type":23,"tag":36,"props":5951,"children":5953},{"className":5952},[],[5954],{"type":28,"value":138},{"type":28,"value":745},{"type":23,"tag":24,"props":5957,"children":5958},{},[5959],{"type":28,"value":210},{"type":23,"tag":44,"props":5961,"children":5964},{"className":5962,"code":5963,"language":49,"meta":8},[47],"const needle = require('needle');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: '\u003Chtml>\u003Cbody>\u003Ch1>This will be a PDF document\u003C/h1>\u003Cp>This will generate a basic PDF to show how you can add raw HTML\u003C/body>\u003C/html>',\n}\n\nneedle.post(\n    'https://api.pdfshift.io/v3/convert/pdf',\n    params,\n    {\n        headers: { 'X-API-Key': apiKey },\n        json: params,\n    },\n    function(err, resp) {\n        if (err) throw err;\n\n        // Write the response body to a local file\n        fs.writeFileSync('result.pdf', resp.body, 'binary');\n\n        console.log('The PDF document was generated and saved to result.pdf');\n    }\n)\n",[5965],{"type":23,"tag":36,"props":5966,"children":5967},{"__ignoreMap":8},[5968],{"type":28,"value":5963},{"type":23,"tag":24,"props":5970,"children":5971},{},[5972,5973,5978],{"type":28,"value":763},{"type":23,"tag":36,"props":5974,"children":5976},{"className":5975},[],[5977],{"type":28,"value":138},{"type":28,"value":770},{"title":8,"searchDepth":61,"depth":61,"links":5980},[],"content:guides:node:needle:convert-html-to-pdf-from-raw-html.md","guides/node/needle/convert-html-to-pdf-from-raw-html.md",{"_path":5984,"_dir":5357,"_draft":7,"_partial":7,"_locale":8,"title":777,"description":5985,"language":11,"library":5359,"property":779,"output":14,"related":5986,"default":18,"body":5987,"_type":63,"_id":6027,"_source":65,"_file":6028,"_extension":67},"/guides/node/needle/define-a-time-limit","Learn how to set a conversion time limit at PDFShift. This will allow you to define a maximum time for the conversion process to complete, and if the process takes longer than the defined time, the conversion will be aborted. This guides explains you how to achieve it using Node and the Needle library.",[781],{"type":20,"children":5988,"toc":6025},[5989,5993,5997,6012,6021],{"type":23,"tag":24,"props":5990,"children":5991},{},[5992],{"type":28,"value":788},{"type":23,"tag":24,"props":5994,"children":5995},{},[5996],{"type":28,"value":793},{"type":23,"tag":24,"props":5998,"children":5999},{},[6000,6001,6006,6007,6011],{"type":28,"value":798},{"type":23,"tag":36,"props":6002,"children":6004},{"className":6003},[],[6005],{"type":28,"value":779},{"type":28,"value":805},{"type":23,"tag":199,"props":6008,"children":6009},{},[6010],{"type":28,"value":810},{"type":28,"value":812},{"type":23,"tag":44,"props":6013,"children":6016},{"className":6014,"code":6015,"language":49,"meta":8},[47],"const needle = require('needle');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    timeout: 10\n}\n\nneedle.post(\n    'https://api.pdfshift.io/v3/convert/pdf',\n    params,\n    {\n        headers: { 'X-API-Key': apiKey },\n        json: params,\n    },\n    function(err, resp) {\n        if (err) throw err;\n\n        // Write the response body to a local file\n        fs.writeFileSync('result.pdf', resp.body, 'binary');\n\n        console.log('The PDF document was generated and saved to result.pdf');\n    }\n)\n",[6017],{"type":23,"tag":36,"props":6018,"children":6019},{"__ignoreMap":8},[6020],{"type":28,"value":6015},{"type":23,"tag":24,"props":6022,"children":6023},{},[6024],{"type":28,"value":826},{"title":8,"searchDepth":61,"depth":61,"links":6026},[],"content:guides:node:needle:define-a-time-limit.md","guides/node/needle/define-a-time-limit.md",{"_path":6030,"_dir":5357,"_draft":7,"_partial":7,"_locale":8,"title":833,"description":6031,"language":11,"library":5359,"property":835,"output":14,"default":18,"body":6032,"_type":63,"_id":6109,"_source":65,"_file":6110,"_extension":67},"/guides/node/needle/exporting-only-a-specific-set-of-pages","Learn how to export only a specific set of pages from a document using Node and the Needle library. This guide offers detailed steps with code samples in Node and the Needle library, highlighting how you can export only a specific set of pages from a document using PDFShift's API.",{"type":20,"children":6033,"toc":6107},[6034,6039,6049,6053,6057,6090,6094,6098],{"type":23,"tag":24,"props":6035,"children":6036},{},[6037],{"type":28,"value":6038},"In this guide, we'll show you how to export only a specific set of pages from a document using Node and the Needle library to convert them to PDF using PDFShift's API.",{"type":23,"tag":24,"props":6040,"children":6041},{},[6042,6043,6048],{"type":28,"value":847},{"type":23,"tag":36,"props":6044,"children":6046},{"className":6045},[],[6047],{"type":28,"value":835},{"type":28,"value":42},{"type":23,"tag":24,"props":6050,"children":6051},{},[6052],{"type":28,"value":858},{"type":23,"tag":24,"props":6054,"children":6055},{},[6056],{"type":28,"value":863},{"type":23,"tag":126,"props":6058,"children":6059},{},[6060,6070,6080],{"type":23,"tag":130,"props":6061,"children":6062},{},[6063,6064,6069],{"type":28,"value":871},{"type":23,"tag":36,"props":6065,"children":6067},{"className":6066},[],[6068],{"type":28,"value":877},{"type":28,"value":879},{"type":23,"tag":130,"props":6071,"children":6072},{},[6073,6074,6079],{"type":28,"value":884},{"type":23,"tag":36,"props":6075,"children":6077},{"className":6076},[],[6078],{"type":28,"value":890},{"type":28,"value":892},{"type":23,"tag":130,"props":6081,"children":6082},{},[6083,6084,6089],{"type":28,"value":897},{"type":23,"tag":36,"props":6085,"children":6087},{"className":6086},[],[6088],{"type":28,"value":903},{"type":28,"value":905},{"type":23,"tag":24,"props":6091,"children":6092},{},[6093],{"type":28,"value":910},{"type":23,"tag":24,"props":6095,"children":6096},{},[6097],{"type":28,"value":210},{"type":23,"tag":44,"props":6099,"children":6102},{"className":6100,"code":6101,"language":49,"meta":8},[47],"const needle = require('needle');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://en.wikipedia.org/wiki/PDF',\n    pages: '2-4'\n}\n\nneedle.post(\n    'https://api.pdfshift.io/v3/convert/pdf',\n    params,\n    {\n        headers: { 'X-API-Key': apiKey },\n        json: params,\n    },\n    function(err, resp) {\n        if (err) throw err;\n\n        // Write the response body to a local file\n        fs.writeFileSync('result.pdf', resp.body, 'binary');\n\n        console.log('The PDF document was generated and saved to result.pdf');\n    }\n)\n",[6103],{"type":23,"tag":36,"props":6104,"children":6105},{"__ignoreMap":8},[6106],{"type":28,"value":6101},{"title":8,"searchDepth":61,"depth":61,"links":6108},[],"content:guides:node:needle:exporting-only-a-specific-set-of-pages.md","guides/node/needle/exporting-only-a-specific-set-of-pages.md",{"_path":6112,"_dir":5357,"_draft":7,"_partial":7,"_locale":8,"title":930,"description":6113,"language":11,"library":5359,"property":932,"output":14,"default":18,"body":6114,"_type":63,"_id":6217,"_source":65,"_file":6218,"_extension":67},"/guides/node/needle/generate-a-document-with-full-height","Learn to generate full-height documents dynamically with our step-by-step guide. This will allow you to create documents with a dynamic height, based on the content of the document. This guide provides Node code samples using the Needle library to help you generate full-height documents with PDFShift's API.",{"type":20,"children":6115,"toc":6215},[6116,6121,6137,6146,6150,6159,6175,6179,6187],{"type":23,"tag":24,"props":6117,"children":6118},{},[6119],{"type":28,"value":6120},"In this guide, we'll show you how to generate a document with full height dynamically using Node and the Needle library to convert them to PDF using PDFShift's API.",{"type":23,"tag":24,"props":6122,"children":6123},{},[6124,6125,6130,6131,6136],{"type":28,"value":944},{"type":23,"tag":36,"props":6126,"children":6128},{"className":6127},[],[6129],{"type":28,"value":932},{"type":28,"value":951},{"type":23,"tag":36,"props":6132,"children":6134},{"className":6133},[],[6135],{"type":28,"value":957},{"type":28,"value":959},{"type":23,"tag":44,"props":6138,"children":6141},{"className":6139,"code":6140,"language":49,"meta":8},[47],"const needle = require('needle');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    format: '1280xauto'\n}\n\nneedle.post(\n    'https://api.pdfshift.io/v3/convert/pdf',\n    params,\n    {\n        headers: { 'X-API-Key': apiKey },\n        json: params,\n    },\n    function(err, resp) {\n        if (err) throw err;\n\n        // Write the response body to a local file\n        fs.writeFileSync('result.pdf', resp.body, 'binary');\n\n        console.log('The PDF document was generated and saved to result.pdf');\n    }\n)\n",[6142],{"type":23,"tag":36,"props":6143,"children":6144},{"__ignoreMap":8},[6145],{"type":28,"value":6140},{"type":23,"tag":24,"props":6147,"children":6148},{},[6149],{"type":28,"value":973},{"type":23,"tag":24,"props":6151,"children":6152},{},[6153,6154],{"type":28,"value":978},{"type":23,"tag":36,"props":6155,"children":6157},{"className":6156},[],[6158],{"type":28,"value":984},{"type":23,"tag":24,"props":6160,"children":6161},{},[6162,6163,6168,6169,6174],{"type":28,"value":989},{"type":23,"tag":36,"props":6164,"children":6166},{"className":6165},[],[6167],{"type":28,"value":995},{"type":28,"value":725},{"type":23,"tag":36,"props":6170,"children":6172},{"className":6171},[],[6173],{"type":28,"value":149},{"type":28,"value":1003},{"type":23,"tag":24,"props":6176,"children":6177},{},[6178],{"type":28,"value":1008},{"type":23,"tag":44,"props":6180,"children":6182},{"className":6181,"code":1012,"language":574,"meta":8},[573],[6183],{"type":23,"tag":36,"props":6184,"children":6185},{"__ignoreMap":8},[6186],{"type":28,"value":1012},{"type":23,"tag":24,"props":6188,"children":6189},{},[6190,6191,6196,6197,6202,6203,6208,6209,6214],{"type":28,"value":1022},{"type":23,"tag":36,"props":6192,"children":6194},{"className":6193},[],[6195],{"type":28,"value":957},{"type":28,"value":1029},{"type":23,"tag":36,"props":6198,"children":6200},{"className":6199},[],[6201],{"type":28,"value":1035},{"type":28,"value":1037},{"type":23,"tag":36,"props":6204,"children":6206},{"className":6205},[],[6207],{"type":28,"value":1043},{"type":28,"value":1045},{"type":23,"tag":36,"props":6210,"children":6212},{"className":6211},[],[6213],{"type":28,"value":1051},{"type":28,"value":1053},{"title":8,"searchDepth":61,"depth":61,"links":6216},[],"content:guides:node:needle:generate-a-document-with-full-height.md","guides/node/needle/generate-a-document-with-full-height.md",{"_path":6220,"_dir":5357,"_draft":7,"_partial":7,"_locale":8,"title":1060,"description":6221,"language":11,"library":5359,"property":1062,"output":14,"related":6222,"default":18,"body":6223,"_type":63,"_id":6254,"_source":65,"_file":6255,"_extension":67},"/guides/node/needle/loading-css-from-a-string","Follow this guide to load custom CSS as a given string when converting an HTML document to PDF with PDFShift's API. This guide provides Node code samples with the Needle library.",[1064,75,76,77],{"type":20,"children":6224,"toc":6252},[6225,6229,6233,6242],{"type":23,"tag":24,"props":6226,"children":6227},{},[6228],{"type":28,"value":1071},{"type":23,"tag":24,"props":6230,"children":6231},{},[6232],{"type":28,"value":1076},{"type":23,"tag":44,"props":6234,"children":6237},{"className":6235,"code":6236,"language":49,"meta":8},[47],"const needle = require('needle');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    css: 'body { background-color: #f00; }'\n}\n\nneedle.post(\n    'https://api.pdfshift.io/v3/convert/pdf',\n    params,\n    {\n        headers: { 'X-API-Key': apiKey },\n        json: params,\n    },\n    function(err, resp) {\n        if (err) throw err;\n\n        // Write the response body to a local file\n        fs.writeFileSync('result.pdf', resp.body, 'binary');\n\n        console.log('The PDF document was generated and saved to result.pdf');\n    }\n)\n",[6238],{"type":23,"tag":36,"props":6239,"children":6240},{"__ignoreMap":8},[6241],{"type":28,"value":6236},{"type":23,"tag":24,"props":6243,"children":6244},{},[6245,6246,6251],{"type":28,"value":117},{"type":23,"tag":36,"props":6247,"children":6249},{"className":6248},[],[6250],{"type":28,"value":1062},{"type":28,"value":1096},{"title":8,"searchDepth":61,"depth":61,"links":6253},[],"content:guides:node:needle:loading-css-from-a-string.md","guides/node/needle/loading-css-from-a-string.md",{"_path":6257,"_dir":5357,"_draft":7,"_partial":7,"_locale":8,"title":1103,"description":6258,"language":11,"library":5359,"property":1062,"output":14,"related":6259,"default":18,"body":6260,"_type":63,"_id":6295,"_source":65,"_file":6296,"_extension":67},"/guides/node/needle/loading-css-from-a-url","This guides shows you how to add a custom CSS from an URL onto your document to customize the output of your generated PDF. Follow this guides to learn how to do it using Node and the Needle library and see how it can quickly be implemented using the PDFShift's API.",[1064,74,76,77],{"type":20,"children":6261,"toc":6293},[6262,6266,6270,6274,6283],{"type":23,"tag":24,"props":6263,"children":6264},{},[6265],{"type":28,"value":1112},{"type":23,"tag":24,"props":6267,"children":6268},{},[6269],{"type":28,"value":1076},{"type":23,"tag":24,"props":6271,"children":6272},{},[6273],{"type":28,"value":1121},{"type":23,"tag":44,"props":6275,"children":6278},{"className":6276,"code":6277,"language":49,"meta":8},[47],"const needle = require('needle');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    css: \"https://www.example.com/public/style/print.css\"\n}\n\nneedle.post(\n    'https://api.pdfshift.io/v3/convert/pdf',\n    params,\n    {\n        headers: { 'X-API-Key': apiKey },\n        json: params,\n    },\n    function(err, resp) {\n        if (err) throw err;\n\n        // Write the response body to a local file\n        fs.writeFileSync('result.pdf', resp.body, 'binary');\n\n        console.log('The PDF document was generated and saved to result.pdf');\n    }\n)\n",[6279],{"type":23,"tag":36,"props":6280,"children":6281},{"__ignoreMap":8},[6282],{"type":28,"value":6277},{"type":23,"tag":24,"props":6284,"children":6285},{},[6286,6287,6292],{"type":28,"value":117},{"type":23,"tag":36,"props":6288,"children":6290},{"className":6289},[],[6291],{"type":28,"value":1062},{"type":28,"value":1096},{"title":8,"searchDepth":61,"depth":61,"links":6294},[],"content:guides:node:needle:loading-css-from-a-url.md","guides/node/needle/loading-css-from-a-url.md",{"_path":6298,"_dir":5357,"_draft":7,"_partial":7,"_locale":8,"title":1147,"description":6299,"language":11,"library":5359,"property":49,"output":14,"related":6300,"default":18,"body":6301,"_type":63,"_id":6332,"_source":65,"_file":6333,"_extension":67},"/guides/node/needle/loading-javascript-from-a-string","Follow this guide to learn how to add custom javascript to your page to customize the output of your generated PDF. This allows you to modify elements on the page, add or remove content, etc. This guide uses Node and the Needle library and relies on the PDFShift's API.",[1064,74,75,77],{"type":20,"children":6302,"toc":6330},[6303,6307,6311,6320],{"type":23,"tag":24,"props":6304,"children":6305},{},[6306],{"type":28,"value":1156},{"type":23,"tag":24,"props":6308,"children":6309},{},[6310],{"type":28,"value":1161},{"type":23,"tag":44,"props":6312,"children":6315},{"className":6313,"code":6314,"language":49,"meta":8},[47],"const needle = require('needle');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    javascript: 'document.querySelector(\"h1\").style.color = \"red\";'\n}\n\nneedle.post(\n    'https://api.pdfshift.io/v3/convert/pdf',\n    params,\n    {\n        headers: { 'X-API-Key': apiKey },\n        json: params,\n    },\n    function(err, resp) {\n        if (err) throw err;\n\n        // Write the response body to a local file\n        fs.writeFileSync('result.pdf', resp.body, 'binary');\n\n        console.log('The PDF document was generated and saved to result.pdf');\n    }\n)\n",[6316],{"type":23,"tag":36,"props":6317,"children":6318},{"__ignoreMap":8},[6319],{"type":28,"value":6314},{"type":23,"tag":24,"props":6321,"children":6322},{},[6323,6324,6329],{"type":28,"value":117},{"type":23,"tag":36,"props":6325,"children":6327},{"className":6326},[],[6328],{"type":28,"value":49},{"type":28,"value":1181},{"title":8,"searchDepth":61,"depth":61,"links":6331},[],"content:guides:node:needle:loading-javascript-from-a-string.md","guides/node/needle/loading-javascript-from-a-string.md",{"_path":6335,"_dir":5357,"_draft":7,"_partial":7,"_locale":8,"title":1188,"description":6336,"language":11,"library":5359,"property":49,"output":14,"related":6337,"default":18,"body":6338,"_type":63,"_id":6373,"_source":65,"_file":6374,"_extension":67},"/guides/node/needle/loading-javascript-from-a-url","Follow this guide to add custom javascript to your page before converting it to PDF. Using a URL allows you to later be able to change the content of the javascript without having to update the query made to PDFShift. Learn how you can implement this using Node and the Needle library to call the PDFShift's API.",[1064,74,75,76],{"type":20,"children":6339,"toc":6371},[6340,6344,6348,6352,6361],{"type":23,"tag":24,"props":6341,"children":6342},{},[6343],{"type":28,"value":1197},{"type":23,"tag":24,"props":6345,"children":6346},{},[6347],{"type":28,"value":1202},{"type":23,"tag":24,"props":6349,"children":6350},{},[6351],{"type":28,"value":1207},{"type":23,"tag":44,"props":6353,"children":6356},{"className":6354,"code":6355,"language":49,"meta":8},[47],"const needle = require('needle');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    javascript: 'https://www.example.com/custom.js'\n}\n\nneedle.post(\n    'https://api.pdfshift.io/v3/convert/pdf',\n    params,\n    {\n        headers: { 'X-API-Key': apiKey },\n        json: params,\n    },\n    function(err, resp) {\n        if (err) throw err;\n\n        // Write the response body to a local file\n        fs.writeFileSync('result.pdf', resp.body, 'binary');\n\n        console.log('The PDF document was generated and saved to result.pdf');\n    }\n)\n",[6357],{"type":23,"tag":36,"props":6358,"children":6359},{"__ignoreMap":8},[6360],{"type":28,"value":6355},{"type":23,"tag":24,"props":6362,"children":6363},{},[6364,6365,6370],{"type":28,"value":117},{"type":23,"tag":36,"props":6366,"children":6368},{"className":6367},[],[6369],{"type":28,"value":49},{"type":28,"value":1227},{"title":8,"searchDepth":61,"depth":61,"links":6372},[],"content:guides:node:needle:loading-javascript-from-a-url.md","guides/node/needle/loading-javascript-from-a-url.md",{"_path":6376,"_dir":5357,"_draft":7,"_partial":7,"_locale":8,"title":1234,"description":6377,"language":11,"library":5359,"property":1236,"output":14,"related":6378,"default":18,"body":6379,"_type":63,"_id":6518,"_source":65,"_file":6519,"_extension":67},"/guides/node/needle/protecting-the-generated-pdf","Learn how to protect your generated PDF with encryption for owner and user, and for choosing who can modify, print and/or copy the generated PDF. This guides explains you to do it using Node and the Needle library and relies on the PDFShift's API.",[317,479],{"type":20,"children":6380,"toc":6516},[6381,6386,6390,6400,6404,6413,6423,6433,6508],{"type":23,"tag":24,"props":6382,"children":6383},{},[6384],{"type":28,"value":6385},"In this guide, we'll show you how you can protect your generated PDF with encryption for owner and user, and for choosing who can modify, print and/or copy the generated PDF. This guides explains you to do it using Node and the Needle library and relies on the PDFShift's API.",{"type":23,"tag":24,"props":6387,"children":6388},{},[6389],{"type":28,"value":1249},{"type":23,"tag":24,"props":6391,"children":6392},{},[6393,6394,6399],{"type":28,"value":1254},{"type":23,"tag":36,"props":6395,"children":6397},{"className":6396},[],[6398],{"type":28,"value":1236},{"type":28,"value":1261},{"type":23,"tag":24,"props":6401,"children":6402},{},[6403],{"type":28,"value":1266},{"type":23,"tag":44,"props":6405,"children":6408},{"className":6406,"code":6407,"language":49,"meta":8},[47],"const needle = require('needle');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    protection: {\n        owner_password: 'owner_password',\n        user_password: 'user_password',\n        no_print: True,\n        no_modify: True\n    }\n}\n\nneedle.post(\n    'https://api.pdfshift.io/v3/convert/pdf',\n    params,\n    {\n        headers: { 'X-API-Key': apiKey },\n        json: params,\n    },\n    function(err, resp) {\n        if (err) throw err;\n\n        // Write the response body to a local file\n        fs.writeFileSync('result.pdf', resp.body, 'binary');\n\n        console.log('The PDF document was generated and saved to result.pdf');\n    }\n)\n",[6409],{"type":23,"tag":36,"props":6410,"children":6411},{"__ignoreMap":8},[6412],{"type":28,"value":6407},{"type":23,"tag":24,"props":6414,"children":6415},{},[6416,6417,6422],{"type":28,"value":1280},{"type":23,"tag":36,"props":6418,"children":6420},{"className":6419},[],[6421],{"type":28,"value":1236},{"type":28,"value":1287},{"type":23,"tag":24,"props":6424,"children":6425},{},[6426,6427,6432],{"type":28,"value":117},{"type":23,"tag":36,"props":6428,"children":6430},{"className":6429},[],[6431],{"type":28,"value":1236},{"type":28,"value":1298},{"type":23,"tag":126,"props":6434,"children":6435},{},[6436,6445,6454,6463,6478,6493],{"type":23,"tag":130,"props":6437,"children":6438},{},[6439,6444],{"type":23,"tag":36,"props":6440,"children":6442},{"className":6441},[],[6443],{"type":28,"value":1310},{"type":28,"value":1312},{"type":23,"tag":130,"props":6446,"children":6447},{},[6448,6453],{"type":23,"tag":36,"props":6449,"children":6451},{"className":6450},[],[6452],{"type":28,"value":1321},{"type":28,"value":1323},{"type":23,"tag":130,"props":6455,"children":6456},{},[6457,6462],{"type":23,"tag":36,"props":6458,"children":6460},{"className":6459},[],[6461],{"type":28,"value":1332},{"type":28,"value":1334},{"type":23,"tag":130,"props":6464,"children":6465},{},[6466,6471,6472,6477],{"type":23,"tag":36,"props":6467,"children":6469},{"className":6468},[],[6470],{"type":28,"value":1343},{"type":28,"value":1345},{"type":23,"tag":36,"props":6473,"children":6475},{"className":6474},[],[6476],{"type":28,"value":615},{"type":28,"value":1352},{"type":23,"tag":130,"props":6479,"children":6480},{},[6481,6486,6487,6492],{"type":23,"tag":36,"props":6482,"children":6484},{"className":6483},[],[6485],{"type":28,"value":1361},{"type":28,"value":1345},{"type":23,"tag":36,"props":6488,"children":6490},{"className":6489},[],[6491],{"type":28,"value":615},{"type":28,"value":1369},{"type":23,"tag":130,"props":6494,"children":6495},{},[6496,6501,6502,6507],{"type":23,"tag":36,"props":6497,"children":6499},{"className":6498},[],[6500],{"type":28,"value":1378},{"type":28,"value":1345},{"type":23,"tag":36,"props":6503,"children":6505},{"className":6504},[],[6506],{"type":28,"value":615},{"type":28,"value":1386},{"type":23,"tag":24,"props":6509,"children":6510},{},[6511,6515],{"type":23,"tag":199,"props":6512,"children":6513},{},[6514],{"type":28,"value":1394},{"type":28,"value":1396},{"title":8,"searchDepth":61,"depth":61,"links":6517},[],"content:guides:node:needle:protecting-the-generated-pdf.md","guides/node/needle/protecting-the-generated-pdf.md",{"_path":6521,"_dir":5357,"_draft":7,"_partial":7,"_locale":8,"title":1403,"description":6522,"language":11,"library":5359,"property":1405,"output":14,"related":6523,"default":18,"body":6524,"_type":63,"_id":6601,"_source":65,"_file":6602,"_extension":67},"/guides/node/needle/receive-a-webhook-event","Receive a notification via a POST request on your server once the conversion was done. This allows you to trigger a massive amount of conversion without having to wait on their results, and get notified once they are done. This guides will show you how to receive webhook events in Node and the Needle library to call the PDFShift's API.",[1407,1408],{"type":20,"children":6525,"toc":6599},[6526,6530,6534,6538,6547,6551,6555,6559,6567,6571,6579,6583,6587,6595],{"type":23,"tag":24,"props":6527,"children":6528},{},[6529],{"type":28,"value":1415},{"type":23,"tag":24,"props":6531,"children":6532},{},[6533],{"type":28,"value":1420},{"type":23,"tag":24,"props":6535,"children":6536},{},[6537],{"type":28,"value":1266},{"type":23,"tag":44,"props":6539,"children":6542},{"className":6540,"code":6541,"language":49,"meta":8},[47],"const needle = require('needle');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    webhook: 'https://enyygzdj8jy9b.x.pipedream.net/'\n}\n\nneedle.post(\n    'https://api.pdfshift.io/v3/convert/pdf',\n    params,\n    {\n        headers: { 'X-API-Key': apiKey },\n        json: params,\n    },\n    function(err, resp) {\n        if (err) throw err;\n        console.log('The PDF document was generated and you will receive an event on your webhook once it is done.');\n    }\n)\n",[6543],{"type":23,"tag":36,"props":6544,"children":6545},{"__ignoreMap":8},[6546],{"type":28,"value":6541},{"type":23,"tag":24,"props":6548,"children":6549},{},[6550],{"type":28,"value":1438},{"type":23,"tag":24,"props":6552,"children":6553},{},[6554],{"type":28,"value":1443},{"type":23,"tag":24,"props":6556,"children":6557},{},[6558],{"type":28,"value":1448},{"type":23,"tag":44,"props":6560,"children":6562},{"className":6561,"code":1452,"language":574,"meta":8},[573],[6563],{"type":23,"tag":36,"props":6564,"children":6565},{"__ignoreMap":8},[6566],{"type":28,"value":1452},{"type":23,"tag":24,"props":6568,"children":6569},{},[6570],{"type":28,"value":1462},{"type":23,"tag":44,"props":6572,"children":6574},{"className":6573,"code":1466,"language":574,"meta":8},[573],[6575],{"type":23,"tag":36,"props":6576,"children":6577},{"__ignoreMap":8},[6578],{"type":28,"value":1466},{"type":23,"tag":24,"props":6580,"children":6581},{},[6582],{"type":28,"value":1476},{"type":23,"tag":24,"props":6584,"children":6585},{},[6586],{"type":28,"value":1481},{"type":23,"tag":44,"props":6588,"children":6590},{"className":6589,"code":8,"language":574,"meta":8},[573],[6591],{"type":23,"tag":36,"props":6592,"children":6593},{"__ignoreMap":8},[6594],{"type":28,"value":8},{"type":23,"tag":24,"props":6596,"children":6597},{},[6598],{"type":28,"value":1494},{"title":8,"searchDepth":61,"depth":61,"links":6600},[],"content:guides:node:needle:receive-a-webhook-event.md","guides/node/needle/receive-a-webhook-event.md",{"_path":6604,"_dir":5357,"_draft":7,"_partial":7,"_locale":8,"title":1501,"description":6605,"language":11,"library":5359,"property":1503,"output":14,"related":6606,"default":18,"body":6607,"_type":63,"_id":6677,"_source":65,"_file":6678,"_extension":67},"/guides/node/needle/save-your-pdf-online-and-get-back-a-url","This guides shows you how can generate a PDF document from HTML and get back an URL instead of the raw PDF. This allows you to share the link directly to your users or redirect them to that page. Learn how you can achieve it using Node and the Needle library to call PDFShift's API.",[1408,1505],{"type":20,"children":6608,"toc":6675},[6609,6613,6623,6632,6647,6651,6659,6667],{"type":23,"tag":24,"props":6610,"children":6611},{},[6612],{"type":28,"value":1512},{"type":23,"tag":24,"props":6614,"children":6615},{},[6616,6617,6622],{"type":28,"value":1517},{"type":23,"tag":36,"props":6618,"children":6620},{"className":6619},[],[6621],{"type":28,"value":1503},{"type":28,"value":1524},{"type":23,"tag":44,"props":6624,"children":6627},{"className":6625,"code":6626,"language":49,"meta":8},[47],"const needle = require('needle');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    'filename': 'example.pdf'\n}\n\nneedle.post(\n    'https://api.pdfshift.io/v3/convert/pdf',\n    params,\n    {\n        headers: { 'X-API-Key': apiKey },\n        json: params,\n    },\n    function(err, resp) {\n        if (err) throw err;\n        console.log('The PDF document was generated and is available online via the url in the response');\n    }\n)\n",[6628],{"type":23,"tag":36,"props":6629,"children":6630},{"__ignoreMap":8},[6631],{"type":28,"value":6626},{"type":23,"tag":24,"props":6633,"children":6634},{},[6635,6636,6641,6642,6646],{"type":28,"value":1538},{"type":23,"tag":36,"props":6637,"children":6639},{"className":6638},[],[6640],{"type":28,"value":1503},{"type":28,"value":1545},{"type":23,"tag":199,"props":6643,"children":6644},{},[6645],{"type":28,"value":1550},{"type":28,"value":1552},{"type":23,"tag":24,"props":6648,"children":6649},{},[6650],{"type":28,"value":1557},{"type":23,"tag":44,"props":6652,"children":6654},{"className":6653,"code":1561,"language":574,"meta":8},[573],[6655],{"type":23,"tag":36,"props":6656,"children":6657},{"__ignoreMap":8},[6658],{"type":28,"value":1561},{"type":23,"tag":24,"props":6660,"children":6661},{},[6662,6666],{"type":23,"tag":199,"props":6663,"children":6664},{},[6665],{"type":28,"value":203},{"type":28,"value":1575},{"type":23,"tag":24,"props":6668,"children":6669},{},[6670,6674],{"type":23,"tag":199,"props":6671,"children":6672},{},[6673],{"type":28,"value":203},{"type":28,"value":1584},{"title":8,"searchDepth":61,"depth":61,"links":6676},[],"content:guides:node:needle:save-your-pdf-online-and-get-back-a-url.md","guides/node/needle/save-your-pdf-online-and-get-back-a-url.md",{"_path":6680,"_dir":5357,"_draft":7,"_partial":7,"_locale":8,"title":1591,"description":6681,"language":11,"library":5359,"property":1593,"output":14,"related":6682,"default":18,"body":6683,"_type":63,"_id":6770,"_source":65,"_file":6771,"_extension":67},"/guides/node/needle/save-your-pdf-to-your-amazon-s3-bucket","This guides shows you how can generate a PDF document from HTML with PDFShift's API and save it to your own Amazon S3 bucket. This allows you to generate document and automate actions once the document has been created on your bucket. This guides explains you how to do it using Node and the Needle library.",[1407,1505],{"type":20,"children":6684,"toc":6768},[6685,6689,6693,6697,6705,6715,6724,6734,6742,6746,6754,6758],{"type":23,"tag":24,"props":6686,"children":6687},{},[6688],{"type":28,"value":1601},{"type":23,"tag":24,"props":6690,"children":6691},{},[6692],{"type":28,"value":1606},{"type":23,"tag":24,"props":6694,"children":6695},{},[6696],{"type":28,"value":1611},{"type":23,"tag":44,"props":6698,"children":6700},{"className":6699,"code":1615,"language":574,"meta":8},[573],[6701],{"type":23,"tag":36,"props":6702,"children":6703},{"__ignoreMap":8},[6704],{"type":28,"value":1615},{"type":23,"tag":24,"props":6706,"children":6707},{},[6708,6709,6714],{"type":28,"value":1625},{"type":23,"tag":36,"props":6710,"children":6712},{"className":6711},[],[6713],{"type":28,"value":1593},{"type":28,"value":1632},{"type":23,"tag":44,"props":6716,"children":6719},{"className":6717,"code":6718,"language":49,"meta":8},[47],"const needle = require('needle');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    s3_destination: 's3://DOC-EXAMPLE-BUCKET/test/example.pdf'\n}\n\nneedle.post(\n    'https://api.pdfshift.io/v3/convert/pdf',\n    params,\n    {\n        headers: { 'X-API-Key': apiKey },\n        json: params,\n    },\n    function(err, resp) {\n        if (err) throw err;\n        console.log('The PDF document was generated and saved to your S3 Bucket');\n    }\n)\n",[6720],{"type":23,"tag":36,"props":6721,"children":6722},{"__ignoreMap":8},[6723],{"type":28,"value":6718},{"type":23,"tag":24,"props":6725,"children":6726},{},[6727,6728,6733],{"type":28,"value":1646},{"type":23,"tag":36,"props":6729,"children":6731},{"className":6730},[],[6732],{"type":28,"value":1593},{"type":28,"value":1653},{"type":23,"tag":44,"props":6735,"children":6737},{"className":6736,"code":1657,"language":574,"meta":8},[573],[6738],{"type":23,"tag":36,"props":6739,"children":6740},{"__ignoreMap":8},[6741],{"type":28,"value":1657},{"type":23,"tag":24,"props":6743,"children":6744},{},[6745],{"type":28,"value":1667},{"type":23,"tag":44,"props":6747,"children":6749},{"className":6748,"code":1671,"language":574,"meta":8},[573],[6750],{"type":23,"tag":36,"props":6751,"children":6752},{"__ignoreMap":8},[6753],{"type":28,"value":1671},{"type":23,"tag":24,"props":6755,"children":6756},{},[6757],{"type":28,"value":1681},{"type":23,"tag":24,"props":6759,"children":6760},{},[6761,6762,6767],{"type":28,"value":1686},{"type":23,"tag":36,"props":6763,"children":6765},{"className":6764},[],[6766],{"type":28,"value":1405},{"type":28,"value":1693},{"title":8,"searchDepth":61,"depth":61,"links":6769},[],"content:guides:node:needle:save-your-pdf-to-your-amazon-s3-bucket.md","guides/node/needle/save-your-pdf-to-your-amazon-s3-bucket.md",{"_path":6773,"_dir":5357,"_draft":7,"_partial":7,"_locale":8,"title":1700,"description":6774,"language":11,"library":5359,"property":1702,"output":14,"related":6775,"default":18,"body":6776,"_type":63,"_id":6801,"_source":65,"_file":6802,"_extension":67},"/guides/node/needle/send-custom-http-headers","Learn how to add custom HTTP headers when requesting an URL to be converted in PDF with PDFShift's API. It allows you to add specific headers that your backend can check against to authenticate a query before converting it to PDF. This guide explains you how using Node and the Needle library.",[17,1704],{"type":20,"children":6777,"toc":6799},[6778,6782,6786,6795],{"type":23,"tag":24,"props":6779,"children":6780},{},[6781],{"type":28,"value":1711},{"type":23,"tag":24,"props":6783,"children":6784},{},[6785],{"type":28,"value":1716},{"type":23,"tag":44,"props":6787,"children":6790},{"className":6788,"code":6789,"language":49,"meta":8},[47],"const needle = require('needle');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    http_headers: {\n        'x-custom-header': 'custom-value',\n        Authorization: 'Bearer {token}'  // This allows you to authenticate PDFShift to your service in a custom way\n    }\n}\n\nneedle.post(\n    'https://api.pdfshift.io/v3/convert/pdf',\n    params,\n    {\n        headers: { 'X-API-Key': apiKey },\n        json: params,\n    },\n    function(err, resp) {\n        if (err) throw err;\n\n        // Write the response body to a local file\n        fs.writeFileSync('result.pdf', resp.body, 'binary');\n\n        console.log('The PDF document was generated and saved to result.pdf');\n    }\n)\n",[6791],{"type":23,"tag":36,"props":6792,"children":6793},{"__ignoreMap":8},[6794],{"type":28,"value":6789},{"type":23,"tag":24,"props":6796,"children":6797},{},[6798],{"type":28,"value":1730},{"title":8,"searchDepth":61,"depth":61,"links":6800},[],"content:guides:node:needle:send-custom-http-headers.md","guides/node/needle/send-custom-http-headers.md",{"_path":6804,"_dir":5357,"_draft":7,"_partial":7,"_locale":8,"title":1737,"description":6805,"language":11,"library":5359,"property":1739,"output":14,"related":6806,"default":18,"body":6807,"_type":63,"_id":6887,"_source":65,"_file":6888,"_extension":67},"/guides/node/needle/using-cookies","Learn how to add custom Cookies when requesting an URL to be converted in PDF with PDFShift's API. It allows you to pursue an active session for instance, that will authenticate the request as a specific user before converting the page to PDF. This guide explains you how using Node and the Needle library.",[16,1704],{"type":20,"children":6808,"toc":6885},[6809,6813,6823,6832,6842,6881],{"type":23,"tag":24,"props":6810,"children":6811},{},[6812],{"type":28,"value":1747},{"type":23,"tag":24,"props":6814,"children":6815},{},[6816,6817,6822],{"type":28,"value":1752},{"type":23,"tag":36,"props":6818,"children":6820},{"className":6819},[],[6821],{"type":28,"value":1739},{"type":28,"value":1759},{"type":23,"tag":44,"props":6824,"children":6827},{"className":6825,"code":6826,"language":49,"meta":8},[47],"const needle = require('needle');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    // The \"cookies\" parameter expects a list of dictionnary that contains the name and the value of the cookies\n    cookies: [\n        { name: 'PHPSESSID', value: 'el4ukv0kqbvoirg7nkp4dncpk3' }\n    ]\n}\n\nneedle.post(\n    'https://api.pdfshift.io/v3/convert/pdf',\n    params,\n    {\n        headers: { 'X-API-Key': apiKey },\n        json: params,\n    },\n    function(err, resp) {\n        if (err) throw err;\n\n        // Write the response body to a local file\n        fs.writeFileSync('result.pdf', resp.body, 'binary');\n\n        console.log('The PDF document was generated and saved to result.pdf');\n    }\n)\n",[6828],{"type":23,"tag":36,"props":6829,"children":6830},{"__ignoreMap":8},[6831],{"type":28,"value":6826},{"type":23,"tag":24,"props":6833,"children":6834},{},[6835,6836,6841],{"type":28,"value":117},{"type":23,"tag":36,"props":6837,"children":6839},{"className":6838},[],[6840],{"type":28,"value":1739},{"type":28,"value":1779},{"type":23,"tag":126,"props":6843,"children":6844},{},[6845,6854,6863,6872],{"type":23,"tag":130,"props":6846,"children":6847},{},[6848,6853],{"type":23,"tag":36,"props":6849,"children":6851},{"className":6850},[],[6852],{"type":28,"value":1791},{"type":28,"value":1793},{"type":23,"tag":130,"props":6855,"children":6856},{},[6857,6862],{"type":23,"tag":36,"props":6858,"children":6860},{"className":6859},[],[6861],{"type":28,"value":1802},{"type":28,"value":1804},{"type":23,"tag":130,"props":6864,"children":6865},{},[6866,6871],{"type":23,"tag":36,"props":6867,"children":6869},{"className":6868},[],[6870],{"type":28,"value":1813},{"type":28,"value":1815},{"type":23,"tag":130,"props":6873,"children":6874},{},[6875,6880],{"type":23,"tag":36,"props":6876,"children":6878},{"className":6877},[],[6879],{"type":28,"value":1824},{"type":28,"value":1826},{"type":23,"tag":24,"props":6882,"children":6883},{},[6884],{"type":28,"value":1831},{"title":8,"searchDepth":61,"depth":61,"links":6886},[],"content:guides:node:needle:using-cookies.md","guides/node/needle/using-cookies.md",{"_path":6890,"_dir":5357,"_draft":7,"_partial":7,"_locale":8,"title":1838,"description":6891,"language":11,"library":5359,"property":1840,"output":14,"related":6892,"default":18,"body":6893,"_type":63,"_id":7029,"_source":65,"_file":7030,"_extension":67},"/guides/node/needle/waiting-for-a-custom-element-to-be-ready","Learn how to set up a custom javascript function that will waits for a specific condition to become true before allowing the conversion to happen. This is very interesting for waiting on charts to be generated, or custom fonts to be loaded. With PDFShift's API, this can easily be done using Node and the Needle library.",[1842,76],{"type":20,"children":6894,"toc":7027},[6895,6905,6915,6924,6934,6943,6947,6955,6983,6992,6996,7005],{"type":23,"tag":24,"props":6896,"children":6897},{},[6898,6899,6904],{"type":28,"value":117},{"type":23,"tag":36,"props":6900,"children":6902},{"className":6901},[],[6903],{"type":28,"value":1840},{"type":28,"value":1855},{"type":23,"tag":24,"props":6906,"children":6907},{},[6908,6909,6914],{"type":28,"value":1860},{"type":23,"tag":36,"props":6910,"children":6912},{"className":6911},[],[6913],{"type":28,"value":1840},{"type":28,"value":1867},{"type":23,"tag":24,"props":6916,"children":6917},{},[6918,6919,6923],{"type":28,"value":1872},{"type":23,"tag":106,"props":6920,"children":6921},{},[6922],{"type":28,"value":1877},{"type":28,"value":1879},{"type":23,"tag":24,"props":6925,"children":6926},{},[6927,6928,6933],{"type":28,"value":1884},{"type":23,"tag":36,"props":6929,"children":6931},{"className":6930},[],[6932],{"type":28,"value":1840},{"type":28,"value":1891},{"type":23,"tag":24,"props":6935,"children":6936},{},[6937,6938,6942],{"type":28,"value":1896},{"type":23,"tag":199,"props":6939,"children":6940},{},[6941],{"type":28,"value":1901},{"type":28,"value":183},{"type":23,"tag":24,"props":6944,"children":6945},{},[6946],{"type":28,"value":1907},{"type":23,"tag":44,"props":6948,"children":6950},{"className":6949,"code":1911,"language":49,"meta":8},[47],[6951],{"type":23,"tag":36,"props":6952,"children":6953},{"__ignoreMap":8},[6954],{"type":28,"value":1911},{"type":23,"tag":24,"props":6956,"children":6957},{},[6958,6959,6964,6965,6970,6971,6976,6977,6982],{"type":28,"value":1921},{"type":23,"tag":36,"props":6960,"children":6962},{"className":6961},[],[6963],{"type":28,"value":1840},{"type":28,"value":609},{"type":23,"tag":36,"props":6966,"children":6968},{"className":6967},[],[6969],{"type":28,"value":1933},{"type":28,"value":1935},{"type":23,"tag":36,"props":6972,"children":6974},{"className":6973},[],[6975],{"type":28,"value":1933},{"type":28,"value":1942},{"type":23,"tag":36,"props":6978,"children":6980},{"className":6979},[],[6981],{"type":28,"value":644},{"type":28,"value":1949},{"type":23,"tag":44,"props":6984,"children":6987},{"className":6985,"code":6986,"language":49,"meta":8},[47],"const needle = require('needle');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    wait_for: 'isPageReady'\n}\n\nneedle.post(\n    'https://api.pdfshift.io/v3/convert/pdf',\n    params,\n    {\n        headers: { 'X-API-Key': apiKey },\n        json: params,\n    },\n    function(err, resp) {\n        if (err) throw err;\n\n        // Write the response body to a local file\n        fs.writeFileSync('result.pdf', resp.body, 'binary');\n\n        console.log('The PDF document was generated and saved to result.pdf');\n    }\n)\n",[6988],{"type":23,"tag":36,"props":6989,"children":6990},{"__ignoreMap":8},[6991],{"type":28,"value":6986},{"type":23,"tag":24,"props":6993,"children":6994},{},[6995],{"type":28,"value":1963},{"type":23,"tag":44,"props":6997,"children":7000},{"className":6998,"code":6999,"language":49,"meta":8},[47],"const needle = require('needle');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    javascript: 'let isFontReady = false; document.fonts.ready.then(() => isFontReady = true); function isPageReady() { return isFontReady; }',\n    wait_for: 'isPageReady'\n}\n\nneedle.post(\n    'https://api.pdfshift.io/v3/convert/pdf',\n    params,\n    {\n        headers: { 'X-API-Key': apiKey },\n        json: params,\n    },\n    function(err, resp) {\n        if (err) throw err;\n\n        // Write the response body to a local file\n        fs.writeFileSync('result.pdf', resp.body, 'binary');\n\n        console.log('The PDF document was generated and saved to result.pdf');\n    }\n)\n",[7001],{"type":23,"tag":36,"props":7002,"children":7003},{"__ignoreMap":8},[7004],{"type":28,"value":6999},{"type":23,"tag":24,"props":7006,"children":7007},{},[7008,7009,7014,7015,7020,7021,7026],{"type":28,"value":1977},{"type":23,"tag":36,"props":7010,"children":7012},{"className":7011},[],[7013],{"type":28,"value":644},{"type":28,"value":1984},{"type":23,"tag":36,"props":7016,"children":7018},{"className":7017},[],[7019],{"type":28,"value":1933},{"type":28,"value":1991},{"type":23,"tag":36,"props":7022,"children":7024},{"className":7023},[],[7025],{"type":28,"value":1933},{"type":28,"value":1998},{"title":8,"searchDepth":61,"depth":61,"links":7028},[],"content:guides:node:needle:waiting-for-a-custom-element-to-be-ready.md","guides/node/needle/waiting-for-a-custom-element-to-be-ready.md",{"_path":7032,"_dir":7033,"_draft":7,"_partial":7,"_locale":8,"title":9,"description":7034,"language":11,"library":7035,"property":13,"output":14,"related":7036,"default":7,"body":7037,"_type":63,"_id":7069,"_source":65,"_file":7070,"_extension":67},"/guides/node/node-fetch/accessing-secured-pages","node-fetch","Learn how to access secured pages using Node and the NodeFetch library. This guide offers detailed steps with code samples in Node and the NodeFetch library, highlighting how you can acces page protected by basic authentication to convert them to PDF using PDFShift's API.","NodeFetch",[16,17],{"type":20,"children":7038,"toc":7067},[7039,7044,7054,7063],{"type":23,"tag":24,"props":7040,"children":7041},{},[7042],{"type":28,"value":7043},"In this guide, we'll show you how to access secured page (protected by basic authentication) using Node and the NodeFetch library to convert them to PDF using PDFShift's API.",{"type":23,"tag":24,"props":7045,"children":7046},{},[7047,7048,7053],{"type":28,"value":34},{"type":23,"tag":36,"props":7049,"children":7051},{"className":7050},[],[7052],{"type":28,"value":13},{"type":28,"value":42},{"type":23,"tag":44,"props":7055,"children":7058},{"className":7056,"code":7057,"language":49,"meta":8},[47],"const fetch = require('node-fetch');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    // You can set a basic authentication by passing the \"auth\" property which contains a username and password\n    auth: {\n        username: 'user',\n        password: 'password'\n    }\n}\n\nconst response = await fetch('https://api.pdfshift.io/v3/convert/pdf', {\n    method: 'post',\n    headers: {\n        'X-API-Key': api_key,\n        'Content-Type': 'application/json'\n    },\n    body: JSON.stringify(params)\n});\n\nif (!response.ok) {\n    throw new Error(`HTTP error! status: ${response.status}`);\n}\n\nfs.writeFileSync('result.pdf', response.buffer());\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[7059],{"type":23,"tag":36,"props":7060,"children":7061},{"__ignoreMap":8},[7062],{"type":28,"value":7057},{"type":23,"tag":24,"props":7064,"children":7065},{},[7066],{"type":28,"value":59},{"title":8,"searchDepth":61,"depth":61,"links":7068},[],"content:guides:node:node-fetch:accessing-secured-pages.md","guides/node/node-fetch/accessing-secured-pages.md",{"_path":7072,"_dir":7033,"_draft":7,"_partial":7,"_locale":8,"title":70,"description":7073,"language":11,"library":7035,"property":72,"output":14,"related":7074,"default":7,"body":7075,"_type":63,"_id":7262,"_source":65,"_file":7263,"_extension":67},"/guides/node/node-fetch/adding-a-custom-header-or-footer","Discover how to add custom headers or footers to a PDF using Node and the NodeFetch library. This in-depth guide includes Node codes that you can easily follow and quickly generate documents with PDFShift's API.",[74,75,76,77],{"type":20,"children":7076,"toc":7260},[7077,7082,7103,7113,7167,7175,7179,7188,7198,7202,7256],{"type":23,"tag":24,"props":7078,"children":7079},{},[7080],{"type":28,"value":7081},"In this guide, we'll show you how to add custom headers or footers to a PDF using Node and the NodeFetch library.",{"type":23,"tag":24,"props":7083,"children":7084},{},[7085,7086,7091,7092,7097,7098,7102],{"type":28,"value":89},{"type":23,"tag":36,"props":7087,"children":7089},{"className":7088},[],[7090],{"type":28,"value":72},{"type":28,"value":96},{"type":23,"tag":36,"props":7093,"children":7095},{"className":7094},[],[7096],{"type":28,"value":102},{"type":28,"value":104},{"type":23,"tag":106,"props":7099,"children":7100},{},[7101],{"type":28,"value":110},{"type":28,"value":112},{"type":23,"tag":24,"props":7104,"children":7105},{},[7106,7107,7112],{"type":28,"value":117},{"type":23,"tag":36,"props":7108,"children":7110},{"className":7109},[],[7111],{"type":28,"value":72},{"type":28,"value":124},{"type":23,"tag":126,"props":7114,"children":7115},{},[7116,7125,7158],{"type":23,"tag":130,"props":7117,"children":7118},{},[7119,7124],{"type":23,"tag":36,"props":7120,"children":7122},{"className":7121},[],[7123],{"type":28,"value":138},{"type":28,"value":140},{"type":23,"tag":130,"props":7126,"children":7127},{},[7128,7133,7134,7139,7140,7145,7146,7151,7152,7157],{"type":23,"tag":36,"props":7129,"children":7131},{"className":7130},[],[7132],{"type":28,"value":149},{"type":28,"value":151},{"type":23,"tag":36,"props":7135,"children":7137},{"className":7136},[],[7138],{"type":28,"value":157},{"type":28,"value":159},{"type":23,"tag":36,"props":7141,"children":7143},{"className":7142},[],[7144],{"type":28,"value":165},{"type":28,"value":167},{"type":23,"tag":36,"props":7147,"children":7149},{"className":7148},[],[7150],{"type":28,"value":173},{"type":28,"value":175},{"type":23,"tag":36,"props":7153,"children":7155},{"className":7154},[],[7156],{"type":28,"value":181},{"type":28,"value":183},{"type":23,"tag":130,"props":7159,"children":7160},{},[7161,7166],{"type":23,"tag":36,"props":7162,"children":7164},{"className":7163},[],[7165],{"type":28,"value":192},{"type":28,"value":194},{"type":23,"tag":24,"props":7168,"children":7169},{},[7170,7174],{"type":23,"tag":199,"props":7171,"children":7172},{},[7173],{"type":28,"value":203},{"type":28,"value":205},{"type":23,"tag":24,"props":7176,"children":7177},{},[7178],{"type":28,"value":210},{"type":23,"tag":44,"props":7180,"children":7183},{"className":7181,"code":7182,"language":49,"meta":8},[47],"const fetch = require('node-fetch');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://en.wikipedia.org/wiki/PDF',\n    header: {\n        source: '\u003Cdiv>Page {{ page }} over a total of {{ total }}. Made on {{ date }}\u003C/div>',\n        height: 150,\n        start_at: 2\n    }\n}\n\nconst response = await fetch('https://api.pdfshift.io/v3/convert/pdf', {\n    method: 'post',\n    headers: {\n        'X-API-Key': api_key,\n        'Content-Type': 'application/json'\n    },\n    body: JSON.stringify(params)\n});\n\nif (!response.ok) {\n    throw new Error(`HTTP error! status: ${response.status}`);\n}\n\nfs.writeFileSync('result.pdf', response.buffer());\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[7184],{"type":23,"tag":36,"props":7185,"children":7186},{"__ignoreMap":8},[7187],{"type":28,"value":7182},{"type":23,"tag":24,"props":7189,"children":7190},{},[7191,7192,7197],{"type":28,"value":117},{"type":23,"tag":36,"props":7193,"children":7195},{"className":7194},[],[7196],{"type":28,"value":138},{"type":28,"value":230},{"type":23,"tag":24,"props":7199,"children":7200},{},[7201],{"type":28,"value":235},{"type":23,"tag":126,"props":7203,"children":7204},{},[7205,7214,7223,7232,7241],{"type":23,"tag":130,"props":7206,"children":7207},{},[7208,7213],{"type":23,"tag":36,"props":7209,"children":7211},{"className":7210},[],[7212],{"type":28,"value":247},{"type":28,"value":249},{"type":23,"tag":130,"props":7215,"children":7216},{},[7217,7222],{"type":23,"tag":36,"props":7218,"children":7220},{"className":7219},[],[7221],{"type":28,"value":258},{"type":28,"value":260},{"type":23,"tag":130,"props":7224,"children":7225},{},[7226,7231],{"type":23,"tag":36,"props":7227,"children":7229},{"className":7228},[],[7230],{"type":28,"value":269},{"type":28,"value":271},{"type":23,"tag":130,"props":7233,"children":7234},{},[7235,7240],{"type":23,"tag":36,"props":7236,"children":7238},{"className":7237},[],[7239],{"type":28,"value":280},{"type":28,"value":282},{"type":23,"tag":130,"props":7242,"children":7243},{},[7244,7249,7250,7255],{"type":23,"tag":36,"props":7245,"children":7247},{"className":7246},[],[7248],{"type":28,"value":291},{"type":28,"value":293},{"type":23,"tag":36,"props":7251,"children":7253},{"className":7252},[],[7254],{"type":28,"value":299},{"type":28,"value":301},{"type":23,"tag":24,"props":7257,"children":7258},{},[7259],{"type":28,"value":306},{"title":8,"searchDepth":61,"depth":61,"links":7261},[],"content:guides:node:node-fetch:adding-a-custom-header-or-footer.md","guides/node/node-fetch/adding-a-custom-header-or-footer.md",{"_path":7265,"_dir":7033,"_draft":7,"_partial":7,"_locale":8,"title":313,"description":7266,"language":11,"library":7035,"property":315,"output":14,"related":7267,"default":7,"body":7268,"_type":63,"_id":7397,"_source":65,"_file":7398,"_extension":67},"/guides/node/node-fetch/adding-a-text-watermark","Learn how to add text watermarks to your generated PDF document using Node and the NodeFetch library. With this guide, you'll be able to add watermarks on top of your generated PDFs easily with a quick request to PDFShift's API.",[317,318],{"type":20,"children":7269,"toc":7395},[7270,7274,7284,7293,7297,7354,7358,7379,7383,7387],{"type":23,"tag":24,"props":7271,"children":7272},{},[7273],{"type":28,"value":325},{"type":23,"tag":24,"props":7275,"children":7276},{},[7277,7278,7283],{"type":28,"value":330},{"type":23,"tag":36,"props":7279,"children":7281},{"className":7280},[],[7282],{"type":28,"value":315},{"type":28,"value":337},{"type":23,"tag":44,"props":7285,"children":7288},{"className":7286,"code":7287,"language":49,"meta":8},[47],"const fetch = require('node-fetch');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    watermark: {\n        text: 'PROTECTED DOCUMENT',\n        offset_x: 'center',\n        offset_top: 'top'\n    }\n}\n\nconst response = await fetch('https://api.pdfshift.io/v3/convert/pdf', {\n    method: 'post',\n    headers: {\n        'X-API-Key': api_key,\n        'Content-Type': 'application/json'\n    },\n    body: JSON.stringify(params)\n});\n\nif (!response.ok) {\n    throw new Error(`HTTP error! status: ${response.status}`);\n}\n\nfs.writeFileSync('result.pdf', response.buffer());\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[7289],{"type":23,"tag":36,"props":7290,"children":7291},{"__ignoreMap":8},[7292],{"type":28,"value":7287},{"type":23,"tag":24,"props":7294,"children":7295},{},[7296],{"type":28,"value":351},{"type":23,"tag":126,"props":7298,"children":7299},{},[7300,7309,7318,7327,7336,7345],{"type":23,"tag":130,"props":7301,"children":7302},{},[7303,7308],{"type":23,"tag":36,"props":7304,"children":7306},{"className":7305},[],[7307],{"type":28,"value":363},{"type":28,"value":365},{"type":23,"tag":130,"props":7310,"children":7311},{},[7312,7317],{"type":23,"tag":36,"props":7313,"children":7315},{"className":7314},[],[7316],{"type":28,"value":374},{"type":28,"value":376},{"type":23,"tag":130,"props":7319,"children":7320},{},[7321,7326],{"type":23,"tag":36,"props":7322,"children":7324},{"className":7323},[],[7325],{"type":28,"value":385},{"type":28,"value":387},{"type":23,"tag":130,"props":7328,"children":7329},{},[7330,7335],{"type":23,"tag":36,"props":7331,"children":7333},{"className":7332},[],[7334],{"type":28,"value":396},{"type":28,"value":398},{"type":23,"tag":130,"props":7337,"children":7338},{},[7339,7344],{"type":23,"tag":36,"props":7340,"children":7342},{"className":7341},[],[7343],{"type":28,"value":407},{"type":28,"value":409},{"type":23,"tag":130,"props":7346,"children":7347},{},[7348,7353],{"type":23,"tag":36,"props":7349,"children":7351},{"className":7350},[],[7352],{"type":28,"value":418},{"type":28,"value":420},{"type":23,"tag":24,"props":7355,"children":7356},{},[7357],{"type":28,"value":425},{"type":23,"tag":126,"props":7359,"children":7360},{},[7361,7370],{"type":23,"tag":130,"props":7362,"children":7363},{},[7364,7369],{"type":23,"tag":36,"props":7365,"children":7367},{"className":7366},[],[7368],{"type":28,"value":437},{"type":28,"value":439},{"type":23,"tag":130,"props":7371,"children":7372},{},[7373,7378],{"type":23,"tag":36,"props":7374,"children":7376},{"className":7375},[],[7377],{"type":28,"value":448},{"type":28,"value":450},{"type":23,"tag":24,"props":7380,"children":7381},{},[7382],{"type":28,"value":455},{"type":23,"tag":24,"props":7384,"children":7385},{},[7386],{"type":28,"value":460},{"type":23,"tag":44,"props":7388,"children":7390},{"className":7389,"code":464,"language":49,"meta":8},[47],[7391],{"type":23,"tag":36,"props":7392,"children":7393},{"__ignoreMap":8},[7394],{"type":28,"value":464},{"title":8,"searchDepth":61,"depth":61,"links":7396},[],"content:guides:node:node-fetch:adding-a-text-watermark.md","guides/node/node-fetch/adding-a-text-watermark.md",{"_path":7400,"_dir":7033,"_draft":7,"_partial":7,"_locale":8,"title":476,"description":7401,"language":11,"library":7035,"property":315,"output":14,"related":7402,"default":7,"body":7403,"_type":63,"_id":7496,"_source":65,"_file":7497,"_extension":67},"/guides/node/node-fetch/adding-an-image-watermark","Discover how to effortlessly add image watermarks to PDFs using Node and the NodeFetch library. Our guide shows you how to add images on top of your PDF to protect your document easily. This is easily done with a simple request to PDFShift's API.",[318,479],{"type":20,"children":7404,"toc":7494},[7405,7409,7419,7428,7432,7443,7453,7457,7478,7482,7486],{"type":23,"tag":24,"props":7406,"children":7407},{},[7408],{"type":28,"value":325},{"type":23,"tag":24,"props":7410,"children":7411},{},[7412,7413,7418],{"type":28,"value":330},{"type":23,"tag":36,"props":7414,"children":7416},{"className":7415},[],[7417],{"type":28,"value":315},{"type":28,"value":496},{"type":23,"tag":44,"props":7420,"children":7423},{"className":7421,"code":7422,"language":49,"meta":8},[47],"const fetch = require('node-fetch');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    watermark: {\n        image: 'https://placekitten.com/200/300',\n        offset_x: 'center',\n        offset_top: 'top'\n    }\n}\n\nconst response = await fetch('https://api.pdfshift.io/v3/convert/pdf', {\n    method: 'post',\n    headers: {\n        'X-API-Key': api_key,\n        'Content-Type': 'application/json'\n    },\n    body: JSON.stringify(params)\n});\n\nif (!response.ok) {\n    throw new Error(`HTTP error! status: ${response.status}`);\n}\n\nfs.writeFileSync('result.pdf', response.buffer());\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[7424],{"type":23,"tag":36,"props":7425,"children":7426},{"__ignoreMap":8},[7427],{"type":28,"value":7422},{"type":23,"tag":24,"props":7429,"children":7430},{},[7431],{"type":28,"value":510},{"type":23,"tag":126,"props":7433,"children":7434},{},[7435,7439],{"type":23,"tag":130,"props":7436,"children":7437},{},[7438],{"type":28,"value":518},{"type":23,"tag":130,"props":7440,"children":7441},{},[7442],{"type":28,"value":523},{"type":23,"tag":24,"props":7444,"children":7445},{},[7446,7447,7452],{"type":28,"value":528},{"type":23,"tag":36,"props":7448,"children":7450},{"className":7449},[],[7451],{"type":28,"value":534},{"type":28,"value":536},{"type":23,"tag":24,"props":7454,"children":7455},{},[7456],{"type":28,"value":425},{"type":23,"tag":126,"props":7458,"children":7459},{},[7460,7469],{"type":23,"tag":130,"props":7461,"children":7462},{},[7463,7468],{"type":23,"tag":36,"props":7464,"children":7466},{"className":7465},[],[7467],{"type":28,"value":437},{"type":28,"value":439},{"type":23,"tag":130,"props":7470,"children":7471},{},[7472,7477],{"type":23,"tag":36,"props":7473,"children":7475},{"className":7474},[],[7476],{"type":28,"value":448},{"type":28,"value":450},{"type":23,"tag":24,"props":7479,"children":7480},{},[7481],{"type":28,"value":455},{"type":23,"tag":24,"props":7483,"children":7484},{},[7485],{"type":28,"value":460},{"type":23,"tag":44,"props":7487,"children":7489},{"className":7488,"code":464,"language":574,"meta":8},[573],[7490],{"type":23,"tag":36,"props":7491,"children":7492},{"__ignoreMap":8},[7493],{"type":28,"value":464},{"title":8,"searchDepth":61,"depth":61,"links":7495},[],"content:guides:node:node-fetch:adding-an-image-watermark.md","guides/node/node-fetch/adding-an-image-watermark.md",{"_path":7499,"_dir":7033,"_draft":7,"_partial":7,"_locale":8,"title":586,"description":7500,"language":11,"library":7035,"property":588,"output":14,"related":7501,"default":7,"body":7502,"_type":63,"_id":7551,"_source":65,"_file":7552,"_extension":67},"/guides/node/node-fetch/avoid-conversion-on-error","Learn how to avoid the conversion on error when loading the document using Node and the NodeFetch library and relies on the PDFShift's API.",[590],{"type":20,"children":7503,"toc":7549},[7504,7508,7524,7533],{"type":23,"tag":24,"props":7505,"children":7506},{},[7507],{"type":28,"value":597},{"type":23,"tag":24,"props":7509,"children":7510},{},[7511,7512,7517,7518,7523],{"type":28,"value":602},{"type":23,"tag":36,"props":7513,"children":7515},{"className":7514},[],[7516],{"type":28,"value":588},{"type":28,"value":609},{"type":23,"tag":36,"props":7519,"children":7521},{"className":7520},[],[7522],{"type":28,"value":615},{"type":28,"value":617},{"type":23,"tag":44,"props":7525,"children":7528},{"className":7526,"code":7527,"language":49,"meta":8},[47],"const fetch = require('node-fetch');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.httpstat.us/404',\n    raise_for_status: True\n}\n\nconst response = await fetch('https://api.pdfshift.io/v3/convert/pdf', {\n    method: 'post',\n    headers: {\n        'X-API-Key': api_key,\n        'Content-Type': 'application/json'\n    },\n    body: JSON.stringify(params)\n});\n\nif (!response.ok) {\n    throw new Error(`HTTP error! status: ${response.status}`);\n}\n\nfs.writeFileSync('result.pdf', response.buffer());\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[7529],{"type":23,"tag":36,"props":7530,"children":7531},{"__ignoreMap":8},[7532],{"type":28,"value":7527},{"type":23,"tag":24,"props":7534,"children":7535},{},[7536,7537,7542,7543,7548],{"type":28,"value":631},{"type":23,"tag":36,"props":7538,"children":7540},{"className":7539},[],[7541],{"type":28,"value":588},{"type":28,"value":638},{"type":23,"tag":36,"props":7544,"children":7546},{"className":7545},[],[7547],{"type":28,"value":644},{"type":28,"value":646},{"title":8,"searchDepth":61,"depth":61,"links":7550},[],"content:guides:node:node-fetch:avoid-conversion-on-error.md","guides/node/node-fetch/avoid-conversion-on-error.md",{"_path":7554,"_dir":7033,"_draft":7,"_partial":7,"_locale":8,"title":653,"description":7555,"language":11,"library":7035,"property":138,"output":14,"related":7556,"default":7,"body":7557,"_type":63,"_id":7578,"_source":65,"_file":7579,"_extension":67},"/guides/node/node-fetch/convert-html-to-pdf-from-a-url","Learn how to easily convert HTML documents to PDF from a URL using Node and the NodeFetch library. This how-to guide offers clear Node code examples that show developers how to implement this using the PDFShift API.",[590,656],{"type":20,"children":7558,"toc":7576},[7559,7563,7572],{"type":23,"tag":24,"props":7560,"children":7561},{},[7562],{"type":28,"value":663},{"type":23,"tag":44,"props":7564,"children":7567},{"className":7565,"code":7566,"language":49,"meta":8},[47],"const fetch = require('node-fetch');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n}\n\nconst response = await fetch('https://api.pdfshift.io/v3/convert/pdf', {\n    method: 'post',\n    headers: {\n        'X-API-Key': api_key,\n        'Content-Type': 'application/json'\n    },\n    body: JSON.stringify(params)\n});\n\nif (!response.ok) {\n    throw new Error(`HTTP error! status: ${response.status}`);\n}\n\nfs.writeFileSync('result.pdf', response.buffer());\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[7568],{"type":23,"tag":36,"props":7569,"children":7570},{"__ignoreMap":8},[7571],{"type":28,"value":7566},{"type":23,"tag":24,"props":7573,"children":7574},{},[7575],{"type":28,"value":677},{"title":8,"searchDepth":61,"depth":61,"links":7577},[],"content:guides:node:node-fetch:convert-html-to-pdf-from-a-url.md","guides/node/node-fetch/convert-html-to-pdf-from-a-url.md",{"_path":7581,"_dir":7033,"_draft":7,"_partial":7,"_locale":8,"title":684,"description":7582,"language":11,"library":7035,"output":14,"related":7583,"default":7,"body":7584,"_type":63,"_id":7657,"_source":65,"_file":7658,"_extension":67},"/guides/node/node-fetch/convert-html-to-pdf-from-raw-html","Learn how to to convert raw HTML document to PDF using Node and the NodeFetch library. Our guide will explain you how to quickly convert documents with PDFShift's API.",[687],{"type":20,"children":7585,"toc":7655},[7586,7591,7606,7622,7632,7636,7645],{"type":23,"tag":24,"props":7587,"children":7588},{},[7589],{"type":28,"value":7590},"In this guide, we'll show you how to convert an HTML document to PDF using Node and the NodeFetch library.\nProviding the HTML document as raw as a lot of great advantages :",{"type":23,"tag":126,"props":7592,"children":7593},{},[7594,7598,7602],{"type":23,"tag":130,"props":7595,"children":7596},{},[7597],{"type":28,"value":702},{"type":23,"tag":130,"props":7599,"children":7600},{},[7601],{"type":28,"value":707},{"type":23,"tag":130,"props":7603,"children":7604},{},[7605],{"type":28,"value":712},{"type":23,"tag":24,"props":7607,"children":7608},{},[7609,7610,7615,7616,7621],{"type":28,"value":717},{"type":23,"tag":36,"props":7611,"children":7613},{"className":7612},[],[7614],{"type":28,"value":723},{"type":28,"value":725},{"type":23,"tag":36,"props":7617,"children":7619},{"className":7618},[],[7620],{"type":28,"value":731},{"type":28,"value":733},{"type":23,"tag":24,"props":7623,"children":7624},{},[7625,7626,7631],{"type":28,"value":738},{"type":23,"tag":36,"props":7627,"children":7629},{"className":7628},[],[7630],{"type":28,"value":138},{"type":28,"value":745},{"type":23,"tag":24,"props":7633,"children":7634},{},[7635],{"type":28,"value":210},{"type":23,"tag":44,"props":7637,"children":7640},{"className":7638,"code":7639,"language":49,"meta":8},[47],"const fetch = require('node-fetch');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: '\u003Chtml>\u003Cbody>\u003Ch1>This will be a PDF document\u003C/h1>\u003Cp>This will generate a basic PDF to show how you can add raw HTML\u003C/body>\u003C/html>',\n}\n\nconst response = await fetch('https://api.pdfshift.io/v3/convert/pdf', {\n    method: 'post',\n    headers: {\n        'X-API-Key': api_key,\n        'Content-Type': 'application/json'\n    },\n    body: JSON.stringify(params)\n});\n\nif (!response.ok) {\n    throw new Error(`HTTP error! status: ${response.status}`);\n}\n\nfs.writeFileSync('result.pdf', response.buffer());\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[7641],{"type":23,"tag":36,"props":7642,"children":7643},{"__ignoreMap":8},[7644],{"type":28,"value":7639},{"type":23,"tag":24,"props":7646,"children":7647},{},[7648,7649,7654],{"type":28,"value":763},{"type":23,"tag":36,"props":7650,"children":7652},{"className":7651},[],[7653],{"type":28,"value":138},{"type":28,"value":770},{"title":8,"searchDepth":61,"depth":61,"links":7656},[],"content:guides:node:node-fetch:convert-html-to-pdf-from-raw-html.md","guides/node/node-fetch/convert-html-to-pdf-from-raw-html.md",{"_path":7660,"_dir":7033,"_draft":7,"_partial":7,"_locale":8,"title":777,"description":7661,"language":11,"library":7035,"property":779,"output":14,"related":7662,"default":7,"body":7663,"_type":63,"_id":7703,"_source":65,"_file":7704,"_extension":67},"/guides/node/node-fetch/define-a-time-limit","Learn how to set a conversion time limit at PDFShift. This will allow you to define a maximum time for the conversion process to complete, and if the process takes longer than the defined time, the conversion will be aborted. This guides explains you how to achieve it using Node and the NodeFetch library.",[781],{"type":20,"children":7664,"toc":7701},[7665,7669,7673,7688,7697],{"type":23,"tag":24,"props":7666,"children":7667},{},[7668],{"type":28,"value":788},{"type":23,"tag":24,"props":7670,"children":7671},{},[7672],{"type":28,"value":793},{"type":23,"tag":24,"props":7674,"children":7675},{},[7676,7677,7682,7683,7687],{"type":28,"value":798},{"type":23,"tag":36,"props":7678,"children":7680},{"className":7679},[],[7681],{"type":28,"value":779},{"type":28,"value":805},{"type":23,"tag":199,"props":7684,"children":7685},{},[7686],{"type":28,"value":810},{"type":28,"value":812},{"type":23,"tag":44,"props":7689,"children":7692},{"className":7690,"code":7691,"language":49,"meta":8},[47],"const fetch = require('node-fetch');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    timeout: 10\n}\n\nconst response = await fetch('https://api.pdfshift.io/v3/convert/pdf', {\n    method: 'post',\n    headers: {\n        'X-API-Key': api_key,\n        'Content-Type': 'application/json'\n    },\n    body: JSON.stringify(params)\n});\n\nif (!response.ok) {\n    throw new Error(`HTTP error! status: ${response.status}`);\n}\n\nfs.writeFileSync('result.pdf', response.buffer());\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[7693],{"type":23,"tag":36,"props":7694,"children":7695},{"__ignoreMap":8},[7696],{"type":28,"value":7691},{"type":23,"tag":24,"props":7698,"children":7699},{},[7700],{"type":28,"value":826},{"title":8,"searchDepth":61,"depth":61,"links":7702},[],"content:guides:node:node-fetch:define-a-time-limit.md","guides/node/node-fetch/define-a-time-limit.md",{"_path":7706,"_dir":7033,"_draft":7,"_partial":7,"_locale":8,"title":833,"description":7707,"language":11,"library":7035,"property":835,"output":14,"default":7,"body":7708,"_type":63,"_id":7785,"_source":65,"_file":7786,"_extension":67},"/guides/node/node-fetch/exporting-only-a-specific-set-of-pages","Learn how to export only a specific set of pages from a document using Node and the NodeFetch library. This guide offers detailed steps with code samples in Node and the NodeFetch library, highlighting how you can export only a specific set of pages from a document using PDFShift's API.",{"type":20,"children":7709,"toc":7783},[7710,7715,7725,7729,7733,7766,7770,7774],{"type":23,"tag":24,"props":7711,"children":7712},{},[7713],{"type":28,"value":7714},"In this guide, we'll show you how to export only a specific set of pages from a document using Node and the NodeFetch library to convert them to PDF using PDFShift's API.",{"type":23,"tag":24,"props":7716,"children":7717},{},[7718,7719,7724],{"type":28,"value":847},{"type":23,"tag":36,"props":7720,"children":7722},{"className":7721},[],[7723],{"type":28,"value":835},{"type":28,"value":42},{"type":23,"tag":24,"props":7726,"children":7727},{},[7728],{"type":28,"value":858},{"type":23,"tag":24,"props":7730,"children":7731},{},[7732],{"type":28,"value":863},{"type":23,"tag":126,"props":7734,"children":7735},{},[7736,7746,7756],{"type":23,"tag":130,"props":7737,"children":7738},{},[7739,7740,7745],{"type":28,"value":871},{"type":23,"tag":36,"props":7741,"children":7743},{"className":7742},[],[7744],{"type":28,"value":877},{"type":28,"value":879},{"type":23,"tag":130,"props":7747,"children":7748},{},[7749,7750,7755],{"type":28,"value":884},{"type":23,"tag":36,"props":7751,"children":7753},{"className":7752},[],[7754],{"type":28,"value":890},{"type":28,"value":892},{"type":23,"tag":130,"props":7757,"children":7758},{},[7759,7760,7765],{"type":28,"value":897},{"type":23,"tag":36,"props":7761,"children":7763},{"className":7762},[],[7764],{"type":28,"value":903},{"type":28,"value":905},{"type":23,"tag":24,"props":7767,"children":7768},{},[7769],{"type":28,"value":910},{"type":23,"tag":24,"props":7771,"children":7772},{},[7773],{"type":28,"value":210},{"type":23,"tag":44,"props":7775,"children":7778},{"className":7776,"code":7777,"language":49,"meta":8},[47],"const fetch = require('node-fetch');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://en.wikipedia.org/wiki/PDF',\n    pages: '2-4'\n}\n\nconst response = await fetch('https://api.pdfshift.io/v3/convert/pdf', {\n    method: 'post',\n    headers: {\n        'X-API-Key': api_key,\n        'Content-Type': 'application/json'\n    },\n    body: JSON.stringify(params)\n});\n\nif (!response.ok) {\n    throw new Error(`HTTP error! status: ${response.status}`);\n}\n\nfs.writeFileSync('result.pdf', response.buffer());\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[7779],{"type":23,"tag":36,"props":7780,"children":7781},{"__ignoreMap":8},[7782],{"type":28,"value":7777},{"title":8,"searchDepth":61,"depth":61,"links":7784},[],"content:guides:node:node-fetch:exporting-only-a-specific-set-of-pages.md","guides/node/node-fetch/exporting-only-a-specific-set-of-pages.md",{"_path":7788,"_dir":7033,"_draft":7,"_partial":7,"_locale":8,"title":930,"description":7789,"language":11,"library":7035,"property":932,"output":14,"default":7,"body":7790,"_type":63,"_id":7893,"_source":65,"_file":7894,"_extension":67},"/guides/node/node-fetch/generate-a-document-with-full-height","Learn to generate full-height documents dynamically with our step-by-step guide. This will allow you to create documents with a dynamic height, based on the content of the document. This guide provides Node code samples using the NodeFetch library to help you generate full-height documents with PDFShift's API.",{"type":20,"children":7791,"toc":7891},[7792,7797,7813,7822,7826,7835,7851,7855,7863],{"type":23,"tag":24,"props":7793,"children":7794},{},[7795],{"type":28,"value":7796},"In this guide, we'll show you how to generate a document with full height dynamically using Node and the NodeFetch library to convert them to PDF using PDFShift's API.",{"type":23,"tag":24,"props":7798,"children":7799},{},[7800,7801,7806,7807,7812],{"type":28,"value":944},{"type":23,"tag":36,"props":7802,"children":7804},{"className":7803},[],[7805],{"type":28,"value":932},{"type":28,"value":951},{"type":23,"tag":36,"props":7808,"children":7810},{"className":7809},[],[7811],{"type":28,"value":957},{"type":28,"value":959},{"type":23,"tag":44,"props":7814,"children":7817},{"className":7815,"code":7816,"language":49,"meta":8},[47],"const fetch = require('node-fetch');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    format: '1280xauto'\n}\n\nconst response = await fetch('https://api.pdfshift.io/v3/convert/pdf', {\n    method: 'post',\n    headers: {\n        'X-API-Key': api_key,\n        'Content-Type': 'application/json'\n    },\n    body: JSON.stringify(params)\n});\n\nif (!response.ok) {\n    throw new Error(`HTTP error! status: ${response.status}`);\n}\n\nfs.writeFileSync('result.pdf', response.buffer());\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[7818],{"type":23,"tag":36,"props":7819,"children":7820},{"__ignoreMap":8},[7821],{"type":28,"value":7816},{"type":23,"tag":24,"props":7823,"children":7824},{},[7825],{"type":28,"value":973},{"type":23,"tag":24,"props":7827,"children":7828},{},[7829,7830],{"type":28,"value":978},{"type":23,"tag":36,"props":7831,"children":7833},{"className":7832},[],[7834],{"type":28,"value":984},{"type":23,"tag":24,"props":7836,"children":7837},{},[7838,7839,7844,7845,7850],{"type":28,"value":989},{"type":23,"tag":36,"props":7840,"children":7842},{"className":7841},[],[7843],{"type":28,"value":995},{"type":28,"value":725},{"type":23,"tag":36,"props":7846,"children":7848},{"className":7847},[],[7849],{"type":28,"value":149},{"type":28,"value":1003},{"type":23,"tag":24,"props":7852,"children":7853},{},[7854],{"type":28,"value":1008},{"type":23,"tag":44,"props":7856,"children":7858},{"className":7857,"code":1012,"language":574,"meta":8},[573],[7859],{"type":23,"tag":36,"props":7860,"children":7861},{"__ignoreMap":8},[7862],{"type":28,"value":1012},{"type":23,"tag":24,"props":7864,"children":7865},{},[7866,7867,7872,7873,7878,7879,7884,7885,7890],{"type":28,"value":1022},{"type":23,"tag":36,"props":7868,"children":7870},{"className":7869},[],[7871],{"type":28,"value":957},{"type":28,"value":1029},{"type":23,"tag":36,"props":7874,"children":7876},{"className":7875},[],[7877],{"type":28,"value":1035},{"type":28,"value":1037},{"type":23,"tag":36,"props":7880,"children":7882},{"className":7881},[],[7883],{"type":28,"value":1043},{"type":28,"value":1045},{"type":23,"tag":36,"props":7886,"children":7888},{"className":7887},[],[7889],{"type":28,"value":1051},{"type":28,"value":1053},{"title":8,"searchDepth":61,"depth":61,"links":7892},[],"content:guides:node:node-fetch:generate-a-document-with-full-height.md","guides/node/node-fetch/generate-a-document-with-full-height.md",{"_path":7896,"_dir":7033,"_draft":7,"_partial":7,"_locale":8,"title":1060,"description":7897,"language":11,"library":7035,"property":1062,"output":14,"related":7898,"default":7,"body":7899,"_type":63,"_id":7930,"_source":65,"_file":7931,"_extension":67},"/guides/node/node-fetch/loading-css-from-a-string","Follow this guide to load custom CSS as a given string when converting an HTML document to PDF with PDFShift's API. This guide provides Node code samples with the NodeFetch library.",[1064,75,76,77],{"type":20,"children":7900,"toc":7928},[7901,7905,7909,7918],{"type":23,"tag":24,"props":7902,"children":7903},{},[7904],{"type":28,"value":1071},{"type":23,"tag":24,"props":7906,"children":7907},{},[7908],{"type":28,"value":1076},{"type":23,"tag":44,"props":7910,"children":7913},{"className":7911,"code":7912,"language":49,"meta":8},[47],"const fetch = require('node-fetch');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    css: 'body { background-color: #f00; }'\n}\n\nconst response = await fetch('https://api.pdfshift.io/v3/convert/pdf', {\n    method: 'post',\n    headers: {\n        'X-API-Key': api_key,\n        'Content-Type': 'application/json'\n    },\n    body: JSON.stringify(params)\n});\n\nif (!response.ok) {\n    throw new Error(`HTTP error! status: ${response.status}`);\n}\n\nfs.writeFileSync('result.pdf', response.buffer());\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[7914],{"type":23,"tag":36,"props":7915,"children":7916},{"__ignoreMap":8},[7917],{"type":28,"value":7912},{"type":23,"tag":24,"props":7919,"children":7920},{},[7921,7922,7927],{"type":28,"value":117},{"type":23,"tag":36,"props":7923,"children":7925},{"className":7924},[],[7926],{"type":28,"value":1062},{"type":28,"value":1096},{"title":8,"searchDepth":61,"depth":61,"links":7929},[],"content:guides:node:node-fetch:loading-css-from-a-string.md","guides/node/node-fetch/loading-css-from-a-string.md",{"_path":7933,"_dir":7033,"_draft":7,"_partial":7,"_locale":8,"title":1103,"description":7934,"language":11,"library":7035,"property":1062,"output":14,"related":7935,"default":7,"body":7936,"_type":63,"_id":7971,"_source":65,"_file":7972,"_extension":67},"/guides/node/node-fetch/loading-css-from-a-url","This guides shows you how to add a custom CSS from an URL onto your document to customize the output of your generated PDF. Follow this guides to learn how to do it using Node and the NodeFetch library and see how it can quickly be implemented using the PDFShift's API.",[1064,74,76,77],{"type":20,"children":7937,"toc":7969},[7938,7942,7946,7950,7959],{"type":23,"tag":24,"props":7939,"children":7940},{},[7941],{"type":28,"value":1112},{"type":23,"tag":24,"props":7943,"children":7944},{},[7945],{"type":28,"value":1076},{"type":23,"tag":24,"props":7947,"children":7948},{},[7949],{"type":28,"value":1121},{"type":23,"tag":44,"props":7951,"children":7954},{"className":7952,"code":7953,"language":49,"meta":8},[47],"const fetch = require('node-fetch');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    css: \"https://www.example.com/public/style/print.css\"\n}\n\nconst response = await fetch('https://api.pdfshift.io/v3/convert/pdf', {\n    method: 'post',\n    headers: {\n        'X-API-Key': api_key,\n        'Content-Type': 'application/json'\n    },\n    body: JSON.stringify(params)\n});\n\nif (!response.ok) {\n    throw new Error(`HTTP error! status: ${response.status}`);\n}\n\nfs.writeFileSync('result.pdf', response.buffer());\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[7955],{"type":23,"tag":36,"props":7956,"children":7957},{"__ignoreMap":8},[7958],{"type":28,"value":7953},{"type":23,"tag":24,"props":7960,"children":7961},{},[7962,7963,7968],{"type":28,"value":117},{"type":23,"tag":36,"props":7964,"children":7966},{"className":7965},[],[7967],{"type":28,"value":1062},{"type":28,"value":1096},{"title":8,"searchDepth":61,"depth":61,"links":7970},[],"content:guides:node:node-fetch:loading-css-from-a-url.md","guides/node/node-fetch/loading-css-from-a-url.md",{"_path":7974,"_dir":7033,"_draft":7,"_partial":7,"_locale":8,"title":1147,"description":7975,"language":11,"library":7035,"property":49,"output":14,"related":7976,"default":7,"body":7977,"_type":63,"_id":8008,"_source":65,"_file":8009,"_extension":67},"/guides/node/node-fetch/loading-javascript-from-a-string","Follow this guide to learn how to add custom javascript to your page to customize the output of your generated PDF. This allows you to modify elements on the page, add or remove content, etc. This guide uses Node and the NodeFetch library and relies on the PDFShift's API.",[1064,74,75,77],{"type":20,"children":7978,"toc":8006},[7979,7983,7987,7996],{"type":23,"tag":24,"props":7980,"children":7981},{},[7982],{"type":28,"value":1156},{"type":23,"tag":24,"props":7984,"children":7985},{},[7986],{"type":28,"value":1161},{"type":23,"tag":44,"props":7988,"children":7991},{"className":7989,"code":7990,"language":49,"meta":8},[47],"const fetch = require('node-fetch');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    javascript: 'document.querySelector(\"h1\").style.color = \"red\";'\n}\n\nconst response = await fetch('https://api.pdfshift.io/v3/convert/pdf', {\n    method: 'post',\n    headers: {\n        'X-API-Key': api_key,\n        'Content-Type': 'application/json'\n    },\n    body: JSON.stringify(params)\n});\n\nif (!response.ok) {\n    throw new Error(`HTTP error! status: ${response.status}`);\n}\n\nfs.writeFileSync('result.pdf', response.buffer());\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[7992],{"type":23,"tag":36,"props":7993,"children":7994},{"__ignoreMap":8},[7995],{"type":28,"value":7990},{"type":23,"tag":24,"props":7997,"children":7998},{},[7999,8000,8005],{"type":28,"value":117},{"type":23,"tag":36,"props":8001,"children":8003},{"className":8002},[],[8004],{"type":28,"value":49},{"type":28,"value":1181},{"title":8,"searchDepth":61,"depth":61,"links":8007},[],"content:guides:node:node-fetch:loading-javascript-from-a-string.md","guides/node/node-fetch/loading-javascript-from-a-string.md",{"_path":8011,"_dir":7033,"_draft":7,"_partial":7,"_locale":8,"title":1188,"description":8012,"language":11,"library":7035,"property":49,"output":14,"related":8013,"default":7,"body":8014,"_type":63,"_id":8049,"_source":65,"_file":8050,"_extension":67},"/guides/node/node-fetch/loading-javascript-from-a-url","Follow this guide to add custom javascript to your page before converting it to PDF. Using a URL allows you to later be able to change the content of the javascript without having to update the query made to PDFShift. Learn how you can implement this using Node and the NodeFetch library to call the PDFShift's API.",[1064,74,75,76],{"type":20,"children":8015,"toc":8047},[8016,8020,8024,8028,8037],{"type":23,"tag":24,"props":8017,"children":8018},{},[8019],{"type":28,"value":1197},{"type":23,"tag":24,"props":8021,"children":8022},{},[8023],{"type":28,"value":1202},{"type":23,"tag":24,"props":8025,"children":8026},{},[8027],{"type":28,"value":1207},{"type":23,"tag":44,"props":8029,"children":8032},{"className":8030,"code":8031,"language":49,"meta":8},[47],"const fetch = require('node-fetch');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    javascript: 'https://www.example.com/custom.js'\n}\n\nconst response = await fetch('https://api.pdfshift.io/v3/convert/pdf', {\n    method: 'post',\n    headers: {\n        'X-API-Key': api_key,\n        'Content-Type': 'application/json'\n    },\n    body: JSON.stringify(params)\n});\n\nif (!response.ok) {\n    throw new Error(`HTTP error! status: ${response.status}`);\n}\n\nfs.writeFileSync('result.pdf', response.buffer());\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[8033],{"type":23,"tag":36,"props":8034,"children":8035},{"__ignoreMap":8},[8036],{"type":28,"value":8031},{"type":23,"tag":24,"props":8038,"children":8039},{},[8040,8041,8046],{"type":28,"value":117},{"type":23,"tag":36,"props":8042,"children":8044},{"className":8043},[],[8045],{"type":28,"value":49},{"type":28,"value":1227},{"title":8,"searchDepth":61,"depth":61,"links":8048},[],"content:guides:node:node-fetch:loading-javascript-from-a-url.md","guides/node/node-fetch/loading-javascript-from-a-url.md",{"_path":8052,"_dir":7033,"_draft":7,"_partial":7,"_locale":8,"title":1234,"description":8053,"language":11,"library":7035,"property":1236,"output":14,"related":8054,"default":7,"body":8055,"_type":63,"_id":8194,"_source":65,"_file":8195,"_extension":67},"/guides/node/node-fetch/protecting-the-generated-pdf","Learn how to protect your generated PDF with encryption for owner and user, and for choosing who can modify, print and/or copy the generated PDF. This guides explains you to do it using Node and the NodeFetch library and relies on the PDFShift's API.",[317,479],{"type":20,"children":8056,"toc":8192},[8057,8062,8066,8076,8080,8089,8099,8109,8184],{"type":23,"tag":24,"props":8058,"children":8059},{},[8060],{"type":28,"value":8061},"In this guide, we'll show you how you can protect your generated PDF with encryption for owner and user, and for choosing who can modify, print and/or copy the generated PDF. This guides explains you to do it using Node and the NodeFetch library and relies on the PDFShift's API.",{"type":23,"tag":24,"props":8063,"children":8064},{},[8065],{"type":28,"value":1249},{"type":23,"tag":24,"props":8067,"children":8068},{},[8069,8070,8075],{"type":28,"value":1254},{"type":23,"tag":36,"props":8071,"children":8073},{"className":8072},[],[8074],{"type":28,"value":1236},{"type":28,"value":1261},{"type":23,"tag":24,"props":8077,"children":8078},{},[8079],{"type":28,"value":1266},{"type":23,"tag":44,"props":8081,"children":8084},{"className":8082,"code":8083,"language":49,"meta":8},[47],"const fetch = require('node-fetch');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    protection: {\n        owner_password: 'owner_password',\n        user_password: 'user_password',\n        no_print: True,\n        no_modify: True\n    }\n}\n\nconst response = await fetch('https://api.pdfshift.io/v3/convert/pdf', {\n    method: 'post',\n    headers: {\n        'X-API-Key': api_key,\n        'Content-Type': 'application/json'\n    },\n    body: JSON.stringify(params)\n});\n\nif (!response.ok) {\n    throw new Error(`HTTP error! status: ${response.status}`);\n}\n\nfs.writeFileSync('result.pdf', response.buffer());\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[8085],{"type":23,"tag":36,"props":8086,"children":8087},{"__ignoreMap":8},[8088],{"type":28,"value":8083},{"type":23,"tag":24,"props":8090,"children":8091},{},[8092,8093,8098],{"type":28,"value":1280},{"type":23,"tag":36,"props":8094,"children":8096},{"className":8095},[],[8097],{"type":28,"value":1236},{"type":28,"value":1287},{"type":23,"tag":24,"props":8100,"children":8101},{},[8102,8103,8108],{"type":28,"value":117},{"type":23,"tag":36,"props":8104,"children":8106},{"className":8105},[],[8107],{"type":28,"value":1236},{"type":28,"value":1298},{"type":23,"tag":126,"props":8110,"children":8111},{},[8112,8121,8130,8139,8154,8169],{"type":23,"tag":130,"props":8113,"children":8114},{},[8115,8120],{"type":23,"tag":36,"props":8116,"children":8118},{"className":8117},[],[8119],{"type":28,"value":1310},{"type":28,"value":1312},{"type":23,"tag":130,"props":8122,"children":8123},{},[8124,8129],{"type":23,"tag":36,"props":8125,"children":8127},{"className":8126},[],[8128],{"type":28,"value":1321},{"type":28,"value":1323},{"type":23,"tag":130,"props":8131,"children":8132},{},[8133,8138],{"type":23,"tag":36,"props":8134,"children":8136},{"className":8135},[],[8137],{"type":28,"value":1332},{"type":28,"value":1334},{"type":23,"tag":130,"props":8140,"children":8141},{},[8142,8147,8148,8153],{"type":23,"tag":36,"props":8143,"children":8145},{"className":8144},[],[8146],{"type":28,"value":1343},{"type":28,"value":1345},{"type":23,"tag":36,"props":8149,"children":8151},{"className":8150},[],[8152],{"type":28,"value":615},{"type":28,"value":1352},{"type":23,"tag":130,"props":8155,"children":8156},{},[8157,8162,8163,8168],{"type":23,"tag":36,"props":8158,"children":8160},{"className":8159},[],[8161],{"type":28,"value":1361},{"type":28,"value":1345},{"type":23,"tag":36,"props":8164,"children":8166},{"className":8165},[],[8167],{"type":28,"value":615},{"type":28,"value":1369},{"type":23,"tag":130,"props":8170,"children":8171},{},[8172,8177,8178,8183],{"type":23,"tag":36,"props":8173,"children":8175},{"className":8174},[],[8176],{"type":28,"value":1378},{"type":28,"value":1345},{"type":23,"tag":36,"props":8179,"children":8181},{"className":8180},[],[8182],{"type":28,"value":615},{"type":28,"value":1386},{"type":23,"tag":24,"props":8185,"children":8186},{},[8187,8191],{"type":23,"tag":199,"props":8188,"children":8189},{},[8190],{"type":28,"value":1394},{"type":28,"value":1396},{"title":8,"searchDepth":61,"depth":61,"links":8193},[],"content:guides:node:node-fetch:protecting-the-generated-pdf.md","guides/node/node-fetch/protecting-the-generated-pdf.md",{"_path":8197,"_dir":7033,"_draft":7,"_partial":7,"_locale":8,"title":1403,"description":8198,"language":11,"library":7035,"property":1405,"output":14,"related":8199,"default":7,"body":8200,"_type":63,"_id":8277,"_source":65,"_file":8278,"_extension":67},"/guides/node/node-fetch/receive-a-webhook-event","Receive a notification via a POST request on your server once the conversion was done. This allows you to trigger a massive amount of conversion without having to wait on their results, and get notified once they are done. This guides will show you how to receive webhook events in Node and the NodeFetch library to call the PDFShift's API.",[1407,1408],{"type":20,"children":8201,"toc":8275},[8202,8206,8210,8214,8223,8227,8231,8235,8243,8247,8255,8259,8263,8271],{"type":23,"tag":24,"props":8203,"children":8204},{},[8205],{"type":28,"value":1415},{"type":23,"tag":24,"props":8207,"children":8208},{},[8209],{"type":28,"value":1420},{"type":23,"tag":24,"props":8211,"children":8212},{},[8213],{"type":28,"value":1266},{"type":23,"tag":44,"props":8215,"children":8218},{"className":8216,"code":8217,"language":49,"meta":8},[47],"const fetch = require('node-fetch');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    webhook: 'https://enyygzdj8jy9b.x.pipedream.net/'\n}\n\nconst response = await fetch('https://api.pdfshift.io/v3/convert/pdf', {\n    method: 'post',\n    headers: {\n        'X-API-Key': api_key,\n        'Content-Type': 'application/json'\n    },\n    body: JSON.stringify(params)\n});\n\nif (!response.ok) {\n    throw new Error(`HTTP error! status: ${response.status}`);\n}\n\nconsole.log('The PDF document was generated and you will receive an event on your webhook once it is done.');\n",[8219],{"type":23,"tag":36,"props":8220,"children":8221},{"__ignoreMap":8},[8222],{"type":28,"value":8217},{"type":23,"tag":24,"props":8224,"children":8225},{},[8226],{"type":28,"value":1438},{"type":23,"tag":24,"props":8228,"children":8229},{},[8230],{"type":28,"value":1443},{"type":23,"tag":24,"props":8232,"children":8233},{},[8234],{"type":28,"value":1448},{"type":23,"tag":44,"props":8236,"children":8238},{"className":8237,"code":1452,"language":574,"meta":8},[573],[8239],{"type":23,"tag":36,"props":8240,"children":8241},{"__ignoreMap":8},[8242],{"type":28,"value":1452},{"type":23,"tag":24,"props":8244,"children":8245},{},[8246],{"type":28,"value":1462},{"type":23,"tag":44,"props":8248,"children":8250},{"className":8249,"code":1466,"language":574,"meta":8},[573],[8251],{"type":23,"tag":36,"props":8252,"children":8253},{"__ignoreMap":8},[8254],{"type":28,"value":1466},{"type":23,"tag":24,"props":8256,"children":8257},{},[8258],{"type":28,"value":1476},{"type":23,"tag":24,"props":8260,"children":8261},{},[8262],{"type":28,"value":1481},{"type":23,"tag":44,"props":8264,"children":8266},{"className":8265,"code":8,"language":574,"meta":8},[573],[8267],{"type":23,"tag":36,"props":8268,"children":8269},{"__ignoreMap":8},[8270],{"type":28,"value":8},{"type":23,"tag":24,"props":8272,"children":8273},{},[8274],{"type":28,"value":1494},{"title":8,"searchDepth":61,"depth":61,"links":8276},[],"content:guides:node:node-fetch:receive-a-webhook-event.md","guides/node/node-fetch/receive-a-webhook-event.md",{"_path":8280,"_dir":7033,"_draft":7,"_partial":7,"_locale":8,"title":1501,"description":8281,"language":11,"library":7035,"property":1503,"output":14,"related":8282,"default":7,"body":8283,"_type":63,"_id":8353,"_source":65,"_file":8354,"_extension":67},"/guides/node/node-fetch/save-your-pdf-online-and-get-back-a-url","This guides shows you how can generate a PDF document from HTML and get back an URL instead of the raw PDF. This allows you to share the link directly to your users or redirect them to that page. Learn how you can achieve it using Node and the NodeFetch library to call PDFShift's API.",[1408,1505],{"type":20,"children":8284,"toc":8351},[8285,8289,8299,8308,8323,8327,8335,8343],{"type":23,"tag":24,"props":8286,"children":8287},{},[8288],{"type":28,"value":1512},{"type":23,"tag":24,"props":8290,"children":8291},{},[8292,8293,8298],{"type":28,"value":1517},{"type":23,"tag":36,"props":8294,"children":8296},{"className":8295},[],[8297],{"type":28,"value":1503},{"type":28,"value":1524},{"type":23,"tag":44,"props":8300,"children":8303},{"className":8301,"code":8302,"language":49,"meta":8},[47],"const fetch = require('node-fetch');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    filename: 'example.pdf'\n}\n\nconst response = await fetch('https://api.pdfshift.io/v3/convert/pdf', {\n    method: 'post',\n    headers: {\n        'X-API-Key': api_key,\n        'Content-Type': 'application/json'\n    },\n    body: JSON.stringify(params)\n});\n\nif (!response.ok) {\n    throw new Error(`HTTP error! status: ${response.status}`);\n}\n\nconsole.log('The PDF document was generated and is available online via the url in the response');\n",[8304],{"type":23,"tag":36,"props":8305,"children":8306},{"__ignoreMap":8},[8307],{"type":28,"value":8302},{"type":23,"tag":24,"props":8309,"children":8310},{},[8311,8312,8317,8318,8322],{"type":28,"value":1538},{"type":23,"tag":36,"props":8313,"children":8315},{"className":8314},[],[8316],{"type":28,"value":1503},{"type":28,"value":1545},{"type":23,"tag":199,"props":8319,"children":8320},{},[8321],{"type":28,"value":1550},{"type":28,"value":1552},{"type":23,"tag":24,"props":8324,"children":8325},{},[8326],{"type":28,"value":1557},{"type":23,"tag":44,"props":8328,"children":8330},{"className":8329,"code":1561,"language":574,"meta":8},[573],[8331],{"type":23,"tag":36,"props":8332,"children":8333},{"__ignoreMap":8},[8334],{"type":28,"value":1561},{"type":23,"tag":24,"props":8336,"children":8337},{},[8338,8342],{"type":23,"tag":199,"props":8339,"children":8340},{},[8341],{"type":28,"value":203},{"type":28,"value":1575},{"type":23,"tag":24,"props":8344,"children":8345},{},[8346,8350],{"type":23,"tag":199,"props":8347,"children":8348},{},[8349],{"type":28,"value":203},{"type":28,"value":1584},{"title":8,"searchDepth":61,"depth":61,"links":8352},[],"content:guides:node:node-fetch:save-your-pdf-online-and-get-back-a-url.md","guides/node/node-fetch/save-your-pdf-online-and-get-back-a-url.md",{"_path":8356,"_dir":7033,"_draft":7,"_partial":7,"_locale":8,"title":1591,"description":8357,"language":11,"library":7035,"property":1593,"output":14,"related":8358,"default":7,"body":8359,"_type":63,"_id":8446,"_source":65,"_file":8447,"_extension":67},"/guides/node/node-fetch/save-your-pdf-to-your-amazon-s3-bucket","This guides shows you how can generate a PDF document from HTML with PDFShift's API and save it to your own Amazon S3 bucket. This allows you to generate document and automate actions once the document has been created on your bucket. This guides explains you how to do it using Node and the NodeFetch library.",[1407,1505],{"type":20,"children":8360,"toc":8444},[8361,8365,8369,8373,8381,8391,8400,8410,8418,8422,8430,8434],{"type":23,"tag":24,"props":8362,"children":8363},{},[8364],{"type":28,"value":1601},{"type":23,"tag":24,"props":8366,"children":8367},{},[8368],{"type":28,"value":1606},{"type":23,"tag":24,"props":8370,"children":8371},{},[8372],{"type":28,"value":1611},{"type":23,"tag":44,"props":8374,"children":8376},{"className":8375,"code":1615,"language":574,"meta":8},[573],[8377],{"type":23,"tag":36,"props":8378,"children":8379},{"__ignoreMap":8},[8380],{"type":28,"value":1615},{"type":23,"tag":24,"props":8382,"children":8383},{},[8384,8385,8390],{"type":28,"value":1625},{"type":23,"tag":36,"props":8386,"children":8388},{"className":8387},[],[8389],{"type":28,"value":1593},{"type":28,"value":1632},{"type":23,"tag":44,"props":8392,"children":8395},{"className":8393,"code":8394,"language":49,"meta":8},[47],"const fetch = require('node-fetch');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    s3_destination: 's3://DOC-EXAMPLE-BUCKET/test/example.pdf'\n}\n\nconst response = await fetch('https://api.pdfshift.io/v3/convert/pdf', {\n    method: 'post',\n    headers: {\n        'X-API-Key': api_key,\n        'Content-Type': 'application/json'\n    },\n    body: JSON.stringify(params)\n});\n\nif (!response.ok) {\n    throw new Error(`HTTP error! status: ${response.status}`);\n}\n\nfs.writeFileSync('result.pdf', response.buffer());\n\nconsole.log('The PDF document was generated and saved to your S3 Bucket');\n",[8396],{"type":23,"tag":36,"props":8397,"children":8398},{"__ignoreMap":8},[8399],{"type":28,"value":8394},{"type":23,"tag":24,"props":8401,"children":8402},{},[8403,8404,8409],{"type":28,"value":1646},{"type":23,"tag":36,"props":8405,"children":8407},{"className":8406},[],[8408],{"type":28,"value":1593},{"type":28,"value":1653},{"type":23,"tag":44,"props":8411,"children":8413},{"className":8412,"code":1657,"language":574,"meta":8},[573],[8414],{"type":23,"tag":36,"props":8415,"children":8416},{"__ignoreMap":8},[8417],{"type":28,"value":1657},{"type":23,"tag":24,"props":8419,"children":8420},{},[8421],{"type":28,"value":1667},{"type":23,"tag":44,"props":8423,"children":8425},{"className":8424,"code":1671,"language":574,"meta":8},[573],[8426],{"type":23,"tag":36,"props":8427,"children":8428},{"__ignoreMap":8},[8429],{"type":28,"value":1671},{"type":23,"tag":24,"props":8431,"children":8432},{},[8433],{"type":28,"value":1681},{"type":23,"tag":24,"props":8435,"children":8436},{},[8437,8438,8443],{"type":28,"value":1686},{"type":23,"tag":36,"props":8439,"children":8441},{"className":8440},[],[8442],{"type":28,"value":1405},{"type":28,"value":1693},{"title":8,"searchDepth":61,"depth":61,"links":8445},[],"content:guides:node:node-fetch:save-your-pdf-to-your-amazon-s3-bucket.md","guides/node/node-fetch/save-your-pdf-to-your-amazon-s3-bucket.md",{"_path":8449,"_dir":7033,"_draft":7,"_partial":7,"_locale":8,"title":1700,"description":8450,"language":11,"library":7035,"property":1702,"output":14,"related":8451,"default":7,"body":8452,"_type":63,"_id":8477,"_source":65,"_file":8478,"_extension":67},"/guides/node/node-fetch/send-custom-http-headers","Learn how to add custom HTTP headers when requesting an URL to be converted in PDF with PDFShift's API. It allows you to add specific headers that your backend can check against to authenticate a query before converting it to PDF. This guide explains you how using Node and the NodeFetch library.",[17,1704],{"type":20,"children":8453,"toc":8475},[8454,8458,8462,8471],{"type":23,"tag":24,"props":8455,"children":8456},{},[8457],{"type":28,"value":1711},{"type":23,"tag":24,"props":8459,"children":8460},{},[8461],{"type":28,"value":1716},{"type":23,"tag":44,"props":8463,"children":8466},{"className":8464,"code":8465,"language":49,"meta":8},[47],"const fetch = require('node-fetch');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    http_headers: {\n        'x-custom-header': 'custom-value',\n        Authorization: 'Bearer {token}'  // This allows you to authenticate PDFShift to your service in a custom way\n    }\n}\n\nconst response = await fetch('https://api.pdfshift.io/v3/convert/pdf', {\n    method: 'post',\n    headers: {\n        'X-API-Key': api_key,\n        'Content-Type': 'application/json'\n    },\n    body: JSON.stringify(params)\n});\n\nif (!response.ok) {\n    throw new Error(`HTTP error! status: ${response.status}`);\n}\n\nfs.writeFileSync('result.pdf', response.buffer());\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[8467],{"type":23,"tag":36,"props":8468,"children":8469},{"__ignoreMap":8},[8470],{"type":28,"value":8465},{"type":23,"tag":24,"props":8472,"children":8473},{},[8474],{"type":28,"value":1730},{"title":8,"searchDepth":61,"depth":61,"links":8476},[],"content:guides:node:node-fetch:send-custom-http-headers.md","guides/node/node-fetch/send-custom-http-headers.md",{"_path":8480,"_dir":7033,"_draft":7,"_partial":7,"_locale":8,"title":1737,"description":8481,"language":11,"library":7035,"property":1739,"output":14,"related":8482,"default":7,"body":8483,"_type":63,"_id":8563,"_source":65,"_file":8564,"_extension":67},"/guides/node/node-fetch/using-cookies","Learn how to add custom Cookies when requesting an URL to be converted in PDF with PDFShift's API. It allows you to pursue an active session for instance, that will authenticate the request as a specific user before converting the page to PDF. This guide explains you how using Node and the NodeFetch library.",[16,1704],{"type":20,"children":8484,"toc":8561},[8485,8489,8499,8508,8518,8557],{"type":23,"tag":24,"props":8486,"children":8487},{},[8488],{"type":28,"value":1747},{"type":23,"tag":24,"props":8490,"children":8491},{},[8492,8493,8498],{"type":28,"value":1752},{"type":23,"tag":36,"props":8494,"children":8496},{"className":8495},[],[8497],{"type":28,"value":1739},{"type":28,"value":1759},{"type":23,"tag":44,"props":8500,"children":8503},{"className":8501,"code":8502,"language":49,"meta":8},[47],"const fetch = require('node-fetch');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    // The \"cookies\" parameter expects a list of dictionnary that contains the name and the value of the cookies\n    cookies: [\n        { name: 'PHPSESSID', value: 'el4ukv0kqbvoirg7nkp4dncpk3' }\n    ]\n}\n\nconst response = await fetch('https://api.pdfshift.io/v3/convert/pdf', {\n    method: 'post',\n    headers: {\n        'X-API-Key': api_key,\n        'Content-Type': 'application/json'\n    },\n    body: JSON.stringify(params)\n});\n\nif (!response.ok) {\n    throw new Error(`HTTP error! status: ${response.status}`);\n}\n\nfs.writeFileSync('result.pdf', response.buffer());\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[8504],{"type":23,"tag":36,"props":8505,"children":8506},{"__ignoreMap":8},[8507],{"type":28,"value":8502},{"type":23,"tag":24,"props":8509,"children":8510},{},[8511,8512,8517],{"type":28,"value":117},{"type":23,"tag":36,"props":8513,"children":8515},{"className":8514},[],[8516],{"type":28,"value":1739},{"type":28,"value":1779},{"type":23,"tag":126,"props":8519,"children":8520},{},[8521,8530,8539,8548],{"type":23,"tag":130,"props":8522,"children":8523},{},[8524,8529],{"type":23,"tag":36,"props":8525,"children":8527},{"className":8526},[],[8528],{"type":28,"value":1791},{"type":28,"value":1793},{"type":23,"tag":130,"props":8531,"children":8532},{},[8533,8538],{"type":23,"tag":36,"props":8534,"children":8536},{"className":8535},[],[8537],{"type":28,"value":1802},{"type":28,"value":1804},{"type":23,"tag":130,"props":8540,"children":8541},{},[8542,8547],{"type":23,"tag":36,"props":8543,"children":8545},{"className":8544},[],[8546],{"type":28,"value":1813},{"type":28,"value":1815},{"type":23,"tag":130,"props":8549,"children":8550},{},[8551,8556],{"type":23,"tag":36,"props":8552,"children":8554},{"className":8553},[],[8555],{"type":28,"value":1824},{"type":28,"value":1826},{"type":23,"tag":24,"props":8558,"children":8559},{},[8560],{"type":28,"value":1831},{"title":8,"searchDepth":61,"depth":61,"links":8562},[],"content:guides:node:node-fetch:using-cookies.md","guides/node/node-fetch/using-cookies.md",{"_path":8566,"_dir":7033,"_draft":7,"_partial":7,"_locale":8,"title":1838,"description":8567,"language":11,"library":7035,"property":1840,"output":14,"related":8568,"default":7,"body":8569,"_type":63,"_id":8705,"_source":65,"_file":8706,"_extension":67},"/guides/node/node-fetch/waiting-for-a-custom-element-to-be-ready","Learn how to set up a custom javascript function that will waits for a specific condition to become true before allowing the conversion to happen. This is very interesting for waiting on charts to be generated, or custom fonts to be loaded. With PDFShift's API, this can easily be done using Node and the NodeFetch library.",[1842,76],{"type":20,"children":8570,"toc":8703},[8571,8581,8591,8600,8610,8619,8623,8631,8659,8668,8672,8681],{"type":23,"tag":24,"props":8572,"children":8573},{},[8574,8575,8580],{"type":28,"value":117},{"type":23,"tag":36,"props":8576,"children":8578},{"className":8577},[],[8579],{"type":28,"value":1840},{"type":28,"value":1855},{"type":23,"tag":24,"props":8582,"children":8583},{},[8584,8585,8590],{"type":28,"value":1860},{"type":23,"tag":36,"props":8586,"children":8588},{"className":8587},[],[8589],{"type":28,"value":1840},{"type":28,"value":1867},{"type":23,"tag":24,"props":8592,"children":8593},{},[8594,8595,8599],{"type":28,"value":1872},{"type":23,"tag":106,"props":8596,"children":8597},{},[8598],{"type":28,"value":1877},{"type":28,"value":1879},{"type":23,"tag":24,"props":8601,"children":8602},{},[8603,8604,8609],{"type":28,"value":1884},{"type":23,"tag":36,"props":8605,"children":8607},{"className":8606},[],[8608],{"type":28,"value":1840},{"type":28,"value":1891},{"type":23,"tag":24,"props":8611,"children":8612},{},[8613,8614,8618],{"type":28,"value":1896},{"type":23,"tag":199,"props":8615,"children":8616},{},[8617],{"type":28,"value":1901},{"type":28,"value":183},{"type":23,"tag":24,"props":8620,"children":8621},{},[8622],{"type":28,"value":1907},{"type":23,"tag":44,"props":8624,"children":8626},{"className":8625,"code":1911,"language":49,"meta":8},[47],[8627],{"type":23,"tag":36,"props":8628,"children":8629},{"__ignoreMap":8},[8630],{"type":28,"value":1911},{"type":23,"tag":24,"props":8632,"children":8633},{},[8634,8635,8640,8641,8646,8647,8652,8653,8658],{"type":28,"value":1921},{"type":23,"tag":36,"props":8636,"children":8638},{"className":8637},[],[8639],{"type":28,"value":1840},{"type":28,"value":609},{"type":23,"tag":36,"props":8642,"children":8644},{"className":8643},[],[8645],{"type":28,"value":1933},{"type":28,"value":1935},{"type":23,"tag":36,"props":8648,"children":8650},{"className":8649},[],[8651],{"type":28,"value":1933},{"type":28,"value":1942},{"type":23,"tag":36,"props":8654,"children":8656},{"className":8655},[],[8657],{"type":28,"value":644},{"type":28,"value":1949},{"type":23,"tag":44,"props":8660,"children":8663},{"className":8661,"code":8662,"language":49,"meta":8},[47],"const fetch = require('node-fetch');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    wait_for: 'isPageReady'\n}\n\nconst response = await fetch('https://api.pdfshift.io/v3/convert/pdf', {\n    method: 'post',\n    headers: {\n        'X-API-Key': api_key,\n        'Content-Type': 'application/json'\n    },\n    body: JSON.stringify(params)\n});\n\nif (!response.ok) {\n    throw new Error(`HTTP error! status: ${response.status}`);\n}\n\nfs.writeFileSync('result.pdf', response.buffer());\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[8664],{"type":23,"tag":36,"props":8665,"children":8666},{"__ignoreMap":8},[8667],{"type":28,"value":8662},{"type":23,"tag":24,"props":8669,"children":8670},{},[8671],{"type":28,"value":1963},{"type":23,"tag":44,"props":8673,"children":8676},{"className":8674,"code":8675,"language":49,"meta":8},[47],"const fetch = require('node-fetch');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    javascript: 'let isFontReady = false; document.fonts.ready.then(() => isFontReady = true); function isPageReady() { return isFontReady; }',\n    wait_for: 'isPageReady'\n}\n\nconst response = await axios.post(\n    `https://api.pdfshift.io/v3/convert/pdf`,\n    params,\n    {\n        headers: { 'X-API-Key': api_key }\n    }\n});\n\n// Handle errors:\nif (response.status >= 400) {\n    throw new Error(`Request failed with status code ${response.status}: ${response.data}`);\n}\n\nfs.writeFileSync('result.pdf', response.data);\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[8677],{"type":23,"tag":36,"props":8678,"children":8679},{"__ignoreMap":8},[8680],{"type":28,"value":8675},{"type":23,"tag":24,"props":8682,"children":8683},{},[8684,8685,8690,8691,8696,8697,8702],{"type":28,"value":1977},{"type":23,"tag":36,"props":8686,"children":8688},{"className":8687},[],[8689],{"type":28,"value":644},{"type":28,"value":1984},{"type":23,"tag":36,"props":8692,"children":8694},{"className":8693},[],[8695],{"type":28,"value":1933},{"type":28,"value":1991},{"type":23,"tag":36,"props":8698,"children":8700},{"className":8699},[],[8701],{"type":28,"value":1933},{"type":28,"value":1998},{"title":8,"searchDepth":61,"depth":61,"links":8704},[],"content:guides:node:node-fetch:waiting-for-a-custom-element-to-be-ready.md","guides/node/node-fetch/waiting-for-a-custom-element-to-be-ready.md",{"_path":8708,"_dir":8709,"_draft":7,"_partial":7,"_locale":8,"title":9,"description":8710,"language":11,"library":8711,"property":13,"output":14,"related":8712,"default":7,"body":8713,"_type":63,"_id":8745,"_source":65,"_file":8746,"_extension":67},"/guides/node/superagent/accessing-secured-pages","superagent","Learn how to access secured pages using Node and the SuperAgent library. This guide offers detailed steps with code samples in Node and the SuperAgent library, highlighting how you can acces page protected by basic authentication to convert them to PDF using PDFShift's API.","SuperAgent",[16,17],{"type":20,"children":8714,"toc":8743},[8715,8720,8730,8739],{"type":23,"tag":24,"props":8716,"children":8717},{},[8718],{"type":28,"value":8719},"In this guide, we'll show you how to access secured page (protected by basic authentication) using Node and the SuperAgent library to convert them to PDF using PDFShift's API.",{"type":23,"tag":24,"props":8721,"children":8722},{},[8723,8724,8729],{"type":28,"value":34},{"type":23,"tag":36,"props":8725,"children":8727},{"className":8726},[],[8728],{"type":28,"value":13},{"type":28,"value":42},{"type":23,"tag":44,"props":8731,"children":8734},{"className":8732,"code":8733,"language":49,"meta":8},[47],"const superagent = require('superagent');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    // You can set a basic authentication by passing the \"auth\" property which contains a username and password\n    auth: {\n        username: 'user',\n        password: 'password'\n    }\n}\n\nlet response = await superagent\n    .post('https://api.pdfshift.io/v3/convert/pdf')\n    .set('X-API-Key', api_key)\n    .send(params);\n\nfs.writeFileSync('result.pdf', response.body);\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[8735],{"type":23,"tag":36,"props":8736,"children":8737},{"__ignoreMap":8},[8738],{"type":28,"value":8733},{"type":23,"tag":24,"props":8740,"children":8741},{},[8742],{"type":28,"value":59},{"title":8,"searchDepth":61,"depth":61,"links":8744},[],"content:guides:node:superagent:accessing-secured-pages.md","guides/node/superagent/accessing-secured-pages.md",{"_path":8748,"_dir":8709,"_draft":7,"_partial":7,"_locale":8,"title":70,"description":8749,"language":11,"library":8711,"property":72,"output":14,"related":8750,"default":7,"body":8751,"_type":63,"_id":8938,"_source":65,"_file":8939,"_extension":67},"/guides/node/superagent/adding-a-custom-header-or-footer","Discover how to add custom headers or footers to a PDF using Node and the SuperAgent library. This in-depth guide includes Node codes that you can easily follow and quickly generate documents with PDFShift's API.",[74,75,76,77],{"type":20,"children":8752,"toc":8936},[8753,8758,8779,8789,8843,8851,8855,8864,8874,8878,8932],{"type":23,"tag":24,"props":8754,"children":8755},{},[8756],{"type":28,"value":8757},"In this guide, we'll show you how to add custom headers or footers to a PDF using Node and the SuperAgent library.",{"type":23,"tag":24,"props":8759,"children":8760},{},[8761,8762,8767,8768,8773,8774,8778],{"type":28,"value":89},{"type":23,"tag":36,"props":8763,"children":8765},{"className":8764},[],[8766],{"type":28,"value":72},{"type":28,"value":96},{"type":23,"tag":36,"props":8769,"children":8771},{"className":8770},[],[8772],{"type":28,"value":102},{"type":28,"value":104},{"type":23,"tag":106,"props":8775,"children":8776},{},[8777],{"type":28,"value":110},{"type":28,"value":112},{"type":23,"tag":24,"props":8780,"children":8781},{},[8782,8783,8788],{"type":28,"value":117},{"type":23,"tag":36,"props":8784,"children":8786},{"className":8785},[],[8787],{"type":28,"value":72},{"type":28,"value":124},{"type":23,"tag":126,"props":8790,"children":8791},{},[8792,8801,8834],{"type":23,"tag":130,"props":8793,"children":8794},{},[8795,8800],{"type":23,"tag":36,"props":8796,"children":8798},{"className":8797},[],[8799],{"type":28,"value":138},{"type":28,"value":140},{"type":23,"tag":130,"props":8802,"children":8803},{},[8804,8809,8810,8815,8816,8821,8822,8827,8828,8833],{"type":23,"tag":36,"props":8805,"children":8807},{"className":8806},[],[8808],{"type":28,"value":149},{"type":28,"value":151},{"type":23,"tag":36,"props":8811,"children":8813},{"className":8812},[],[8814],{"type":28,"value":157},{"type":28,"value":159},{"type":23,"tag":36,"props":8817,"children":8819},{"className":8818},[],[8820],{"type":28,"value":165},{"type":28,"value":167},{"type":23,"tag":36,"props":8823,"children":8825},{"className":8824},[],[8826],{"type":28,"value":173},{"type":28,"value":175},{"type":23,"tag":36,"props":8829,"children":8831},{"className":8830},[],[8832],{"type":28,"value":181},{"type":28,"value":183},{"type":23,"tag":130,"props":8835,"children":8836},{},[8837,8842],{"type":23,"tag":36,"props":8838,"children":8840},{"className":8839},[],[8841],{"type":28,"value":192},{"type":28,"value":194},{"type":23,"tag":24,"props":8844,"children":8845},{},[8846,8850],{"type":23,"tag":199,"props":8847,"children":8848},{},[8849],{"type":28,"value":203},{"type":28,"value":205},{"type":23,"tag":24,"props":8852,"children":8853},{},[8854],{"type":28,"value":210},{"type":23,"tag":44,"props":8856,"children":8859},{"className":8857,"code":8858,"language":49,"meta":8},[47],"const superagent = require('superagent');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://en.wikipedia.org/wiki/PDF',\n    header: {\n        source: '\u003Cdiv>Page {{ page }} over a total of {{ total }}. Made on {{ date }}\u003C/div>',\n        height: 150,\n        start_at: 2\n    }\n}\n\nlet response = await superagent\n    .post('https://api.pdfshift.io/v3/convert/pdf')\n    .set('X-API-Key', api_key)\n    .send(params);\n\nfs.writeFileSync('result.pdf', response.body);\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[8860],{"type":23,"tag":36,"props":8861,"children":8862},{"__ignoreMap":8},[8863],{"type":28,"value":8858},{"type":23,"tag":24,"props":8865,"children":8866},{},[8867,8868,8873],{"type":28,"value":117},{"type":23,"tag":36,"props":8869,"children":8871},{"className":8870},[],[8872],{"type":28,"value":138},{"type":28,"value":230},{"type":23,"tag":24,"props":8875,"children":8876},{},[8877],{"type":28,"value":235},{"type":23,"tag":126,"props":8879,"children":8880},{},[8881,8890,8899,8908,8917],{"type":23,"tag":130,"props":8882,"children":8883},{},[8884,8889],{"type":23,"tag":36,"props":8885,"children":8887},{"className":8886},[],[8888],{"type":28,"value":247},{"type":28,"value":249},{"type":23,"tag":130,"props":8891,"children":8892},{},[8893,8898],{"type":23,"tag":36,"props":8894,"children":8896},{"className":8895},[],[8897],{"type":28,"value":258},{"type":28,"value":260},{"type":23,"tag":130,"props":8900,"children":8901},{},[8902,8907],{"type":23,"tag":36,"props":8903,"children":8905},{"className":8904},[],[8906],{"type":28,"value":269},{"type":28,"value":271},{"type":23,"tag":130,"props":8909,"children":8910},{},[8911,8916],{"type":23,"tag":36,"props":8912,"children":8914},{"className":8913},[],[8915],{"type":28,"value":280},{"type":28,"value":282},{"type":23,"tag":130,"props":8918,"children":8919},{},[8920,8925,8926,8931],{"type":23,"tag":36,"props":8921,"children":8923},{"className":8922},[],[8924],{"type":28,"value":291},{"type":28,"value":293},{"type":23,"tag":36,"props":8927,"children":8929},{"className":8928},[],[8930],{"type":28,"value":299},{"type":28,"value":301},{"type":23,"tag":24,"props":8933,"children":8934},{},[8935],{"type":28,"value":306},{"title":8,"searchDepth":61,"depth":61,"links":8937},[],"content:guides:node:superagent:adding-a-custom-header-or-footer.md","guides/node/superagent/adding-a-custom-header-or-footer.md",{"_path":8941,"_dir":8709,"_draft":7,"_partial":7,"_locale":8,"title":313,"description":8942,"language":11,"library":8711,"property":315,"output":14,"related":8943,"default":7,"body":8944,"_type":63,"_id":9073,"_source":65,"_file":9074,"_extension":67},"/guides/node/superagent/adding-a-text-watermark","Learn how to add text watermarks to your generated PDF document using Node and the SuperAgent library. With this guide, you'll be able to add watermarks on top of your generated PDFs easily with a quick request to PDFShift's API.",[317,318],{"type":20,"children":8945,"toc":9071},[8946,8950,8960,8969,8973,9030,9034,9055,9059,9063],{"type":23,"tag":24,"props":8947,"children":8948},{},[8949],{"type":28,"value":325},{"type":23,"tag":24,"props":8951,"children":8952},{},[8953,8954,8959],{"type":28,"value":330},{"type":23,"tag":36,"props":8955,"children":8957},{"className":8956},[],[8958],{"type":28,"value":315},{"type":28,"value":337},{"type":23,"tag":44,"props":8961,"children":8964},{"className":8962,"code":8963,"language":49,"meta":8},[47],"const superagent = require('superagent');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    watermark: {\n        text: 'PROTECTED DOCUMENT',\n        offset_x: 'center',\n        offset_top: 'top'\n    }\n}\n\nlet response = await superagent\n    .post('https://api.pdfshift.io/v3/convert/pdf')\n    .set('X-API-Key', api_key)\n    .send(params);\n\nfs.writeFileSync('result.pdf', response.body);\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[8965],{"type":23,"tag":36,"props":8966,"children":8967},{"__ignoreMap":8},[8968],{"type":28,"value":8963},{"type":23,"tag":24,"props":8970,"children":8971},{},[8972],{"type":28,"value":351},{"type":23,"tag":126,"props":8974,"children":8975},{},[8976,8985,8994,9003,9012,9021],{"type":23,"tag":130,"props":8977,"children":8978},{},[8979,8984],{"type":23,"tag":36,"props":8980,"children":8982},{"className":8981},[],[8983],{"type":28,"value":363},{"type":28,"value":365},{"type":23,"tag":130,"props":8986,"children":8987},{},[8988,8993],{"type":23,"tag":36,"props":8989,"children":8991},{"className":8990},[],[8992],{"type":28,"value":374},{"type":28,"value":376},{"type":23,"tag":130,"props":8995,"children":8996},{},[8997,9002],{"type":23,"tag":36,"props":8998,"children":9000},{"className":8999},[],[9001],{"type":28,"value":385},{"type":28,"value":387},{"type":23,"tag":130,"props":9004,"children":9005},{},[9006,9011],{"type":23,"tag":36,"props":9007,"children":9009},{"className":9008},[],[9010],{"type":28,"value":396},{"type":28,"value":398},{"type":23,"tag":130,"props":9013,"children":9014},{},[9015,9020],{"type":23,"tag":36,"props":9016,"children":9018},{"className":9017},[],[9019],{"type":28,"value":407},{"type":28,"value":409},{"type":23,"tag":130,"props":9022,"children":9023},{},[9024,9029],{"type":23,"tag":36,"props":9025,"children":9027},{"className":9026},[],[9028],{"type":28,"value":418},{"type":28,"value":420},{"type":23,"tag":24,"props":9031,"children":9032},{},[9033],{"type":28,"value":425},{"type":23,"tag":126,"props":9035,"children":9036},{},[9037,9046],{"type":23,"tag":130,"props":9038,"children":9039},{},[9040,9045],{"type":23,"tag":36,"props":9041,"children":9043},{"className":9042},[],[9044],{"type":28,"value":437},{"type":28,"value":439},{"type":23,"tag":130,"props":9047,"children":9048},{},[9049,9054],{"type":23,"tag":36,"props":9050,"children":9052},{"className":9051},[],[9053],{"type":28,"value":448},{"type":28,"value":450},{"type":23,"tag":24,"props":9056,"children":9057},{},[9058],{"type":28,"value":455},{"type":23,"tag":24,"props":9060,"children":9061},{},[9062],{"type":28,"value":460},{"type":23,"tag":44,"props":9064,"children":9066},{"className":9065,"code":464,"language":49,"meta":8},[47],[9067],{"type":23,"tag":36,"props":9068,"children":9069},{"__ignoreMap":8},[9070],{"type":28,"value":464},{"title":8,"searchDepth":61,"depth":61,"links":9072},[],"content:guides:node:superagent:adding-a-text-watermark.md","guides/node/superagent/adding-a-text-watermark.md",{"_path":9076,"_dir":8709,"_draft":7,"_partial":7,"_locale":8,"title":476,"description":9077,"language":11,"library":8711,"property":315,"output":14,"related":9078,"default":7,"body":9079,"_type":63,"_id":9172,"_source":65,"_file":9173,"_extension":67},"/guides/node/superagent/adding-an-image-watermark","Discover how to effortlessly add image watermarks to PDFs using Node and the SuperAgent library. Our guide shows you how to add images on top of your PDF to protect your document easily. This is easily done with a simple request to PDFShift's API.",[318,479],{"type":20,"children":9080,"toc":9170},[9081,9085,9095,9104,9108,9119,9129,9133,9154,9158,9162],{"type":23,"tag":24,"props":9082,"children":9083},{},[9084],{"type":28,"value":325},{"type":23,"tag":24,"props":9086,"children":9087},{},[9088,9089,9094],{"type":28,"value":330},{"type":23,"tag":36,"props":9090,"children":9092},{"className":9091},[],[9093],{"type":28,"value":315},{"type":28,"value":496},{"type":23,"tag":44,"props":9096,"children":9099},{"className":9097,"code":9098,"language":49,"meta":8},[47],"const superagent = require('superagent');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    watermark: {\n        image: 'https://placekitten.com/200/300',\n        offset_x: 'center',\n        offset_top: 'top'\n    }\n}\n\nlet response = await superagent\n    .post('https://api.pdfshift.io/v3/convert/pdf')\n    .set('X-API-Key', api_key)\n    .send(params);\n\nfs.writeFileSync('result.pdf', response.body);\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[9100],{"type":23,"tag":36,"props":9101,"children":9102},{"__ignoreMap":8},[9103],{"type":28,"value":9098},{"type":23,"tag":24,"props":9105,"children":9106},{},[9107],{"type":28,"value":510},{"type":23,"tag":126,"props":9109,"children":9110},{},[9111,9115],{"type":23,"tag":130,"props":9112,"children":9113},{},[9114],{"type":28,"value":518},{"type":23,"tag":130,"props":9116,"children":9117},{},[9118],{"type":28,"value":523},{"type":23,"tag":24,"props":9120,"children":9121},{},[9122,9123,9128],{"type":28,"value":528},{"type":23,"tag":36,"props":9124,"children":9126},{"className":9125},[],[9127],{"type":28,"value":534},{"type":28,"value":536},{"type":23,"tag":24,"props":9130,"children":9131},{},[9132],{"type":28,"value":425},{"type":23,"tag":126,"props":9134,"children":9135},{},[9136,9145],{"type":23,"tag":130,"props":9137,"children":9138},{},[9139,9144],{"type":23,"tag":36,"props":9140,"children":9142},{"className":9141},[],[9143],{"type":28,"value":437},{"type":28,"value":439},{"type":23,"tag":130,"props":9146,"children":9147},{},[9148,9153],{"type":23,"tag":36,"props":9149,"children":9151},{"className":9150},[],[9152],{"type":28,"value":448},{"type":28,"value":450},{"type":23,"tag":24,"props":9155,"children":9156},{},[9157],{"type":28,"value":455},{"type":23,"tag":24,"props":9159,"children":9160},{},[9161],{"type":28,"value":460},{"type":23,"tag":44,"props":9163,"children":9165},{"className":9164,"code":464,"language":574,"meta":8},[573],[9166],{"type":23,"tag":36,"props":9167,"children":9168},{"__ignoreMap":8},[9169],{"type":28,"value":464},{"title":8,"searchDepth":61,"depth":61,"links":9171},[],"content:guides:node:superagent:adding-an-image-watermark.md","guides/node/superagent/adding-an-image-watermark.md",{"_path":9175,"_dir":8709,"_draft":7,"_partial":7,"_locale":8,"title":586,"description":9176,"language":11,"library":8711,"property":588,"output":14,"related":9177,"default":7,"body":9178,"_type":63,"_id":9227,"_source":65,"_file":9228,"_extension":67},"/guides/node/superagent/avoid-conversion-on-error","Learn how to avoid the conversion on error when loading the document using Node and the SuperAgent library and relies on the PDFShift's API.",[590],{"type":20,"children":9179,"toc":9225},[9180,9184,9200,9209],{"type":23,"tag":24,"props":9181,"children":9182},{},[9183],{"type":28,"value":597},{"type":23,"tag":24,"props":9185,"children":9186},{},[9187,9188,9193,9194,9199],{"type":28,"value":602},{"type":23,"tag":36,"props":9189,"children":9191},{"className":9190},[],[9192],{"type":28,"value":588},{"type":28,"value":609},{"type":23,"tag":36,"props":9195,"children":9197},{"className":9196},[],[9198],{"type":28,"value":615},{"type":28,"value":617},{"type":23,"tag":44,"props":9201,"children":9204},{"className":9202,"code":9203,"language":49,"meta":8},[47],"const superagent = require('superagent');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.httpstat.us/404',\n    raise_for_status: True\n}\n\nlet response = await superagent\n    .post('https://api.pdfshift.io/v3/convert/pdf')\n    .set('X-API-Key', api_key)\n    .send(params);\n\nfs.writeFileSync('result.pdf', response.body);\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[9205],{"type":23,"tag":36,"props":9206,"children":9207},{"__ignoreMap":8},[9208],{"type":28,"value":9203},{"type":23,"tag":24,"props":9210,"children":9211},{},[9212,9213,9218,9219,9224],{"type":28,"value":631},{"type":23,"tag":36,"props":9214,"children":9216},{"className":9215},[],[9217],{"type":28,"value":588},{"type":28,"value":638},{"type":23,"tag":36,"props":9220,"children":9222},{"className":9221},[],[9223],{"type":28,"value":644},{"type":28,"value":646},{"title":8,"searchDepth":61,"depth":61,"links":9226},[],"content:guides:node:superagent:avoid-conversion-on-error.md","guides/node/superagent/avoid-conversion-on-error.md",{"_path":9230,"_dir":8709,"_draft":7,"_partial":7,"_locale":8,"title":653,"description":9231,"language":11,"library":8711,"property":138,"output":14,"related":9232,"default":7,"body":9233,"_type":63,"_id":9254,"_source":65,"_file":9255,"_extension":67},"/guides/node/superagent/convert-html-to-pdf-from-a-url","Learn how to easily convert HTML documents to PDF from a URL using Node and the SuperAgent library. This how-to guide offers clear Node code examples that show developers how to implement this using the PDFShift API.",[590,656],{"type":20,"children":9234,"toc":9252},[9235,9239,9248],{"type":23,"tag":24,"props":9236,"children":9237},{},[9238],{"type":28,"value":663},{"type":23,"tag":44,"props":9240,"children":9243},{"className":9241,"code":9242,"language":49,"meta":8},[47],"const superagent = require('superagent');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n}\n\nlet response = await superagent\n    .post('https://api.pdfshift.io/v3/convert/pdf')\n    .set('X-API-Key', api_key)\n    .send(params);\n\nfs.writeFileSync('result.pdf', response.body);\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[9244],{"type":23,"tag":36,"props":9245,"children":9246},{"__ignoreMap":8},[9247],{"type":28,"value":9242},{"type":23,"tag":24,"props":9249,"children":9250},{},[9251],{"type":28,"value":677},{"title":8,"searchDepth":61,"depth":61,"links":9253},[],"content:guides:node:superagent:convert-html-to-pdf-from-a-url.md","guides/node/superagent/convert-html-to-pdf-from-a-url.md",{"_path":9257,"_dir":8709,"_draft":7,"_partial":7,"_locale":8,"title":684,"description":9258,"language":11,"library":8711,"output":14,"related":9259,"default":7,"body":9260,"_type":63,"_id":9333,"_source":65,"_file":9334,"_extension":67},"/guides/node/superagent/convert-html-to-pdf-from-raw-html","Learn how to to convert raw HTML document to PDF using Node and the SuperAgent library. Our guide will explain you how to quickly convert documents with PDFShift's API.",[687],{"type":20,"children":9261,"toc":9331},[9262,9267,9282,9298,9308,9312,9321],{"type":23,"tag":24,"props":9263,"children":9264},{},[9265],{"type":28,"value":9266},"In this guide, we'll show you how to convert an HTML document to PDF using Node and the SuperAgent library.\nProviding the HTML document as raw as a lot of great advantages :",{"type":23,"tag":126,"props":9268,"children":9269},{},[9270,9274,9278],{"type":23,"tag":130,"props":9271,"children":9272},{},[9273],{"type":28,"value":702},{"type":23,"tag":130,"props":9275,"children":9276},{},[9277],{"type":28,"value":707},{"type":23,"tag":130,"props":9279,"children":9280},{},[9281],{"type":28,"value":712},{"type":23,"tag":24,"props":9283,"children":9284},{},[9285,9286,9291,9292,9297],{"type":28,"value":717},{"type":23,"tag":36,"props":9287,"children":9289},{"className":9288},[],[9290],{"type":28,"value":723},{"type":28,"value":725},{"type":23,"tag":36,"props":9293,"children":9295},{"className":9294},[],[9296],{"type":28,"value":731},{"type":28,"value":733},{"type":23,"tag":24,"props":9299,"children":9300},{},[9301,9302,9307],{"type":28,"value":738},{"type":23,"tag":36,"props":9303,"children":9305},{"className":9304},[],[9306],{"type":28,"value":138},{"type":28,"value":745},{"type":23,"tag":24,"props":9309,"children":9310},{},[9311],{"type":28,"value":210},{"type":23,"tag":44,"props":9313,"children":9316},{"className":9314,"code":9315,"language":49,"meta":8},[47],"const superagent = require('superagent');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: '\u003Chtml>\u003Cbody>\u003Ch1>This will be a PDF document\u003C/h1>\u003Cp>This will generate a basic PDF to show how you can add raw HTML\u003C/body>\u003C/html>',\n}\n\nlet response = await superagent\n    .post('https://api.pdfshift.io/v3/convert/pdf')\n    .set('X-API-Key', api_key)\n    .send(params);\n\nfs.writeFileSync('result.pdf', response.body);\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[9317],{"type":23,"tag":36,"props":9318,"children":9319},{"__ignoreMap":8},[9320],{"type":28,"value":9315},{"type":23,"tag":24,"props":9322,"children":9323},{},[9324,9325,9330],{"type":28,"value":763},{"type":23,"tag":36,"props":9326,"children":9328},{"className":9327},[],[9329],{"type":28,"value":138},{"type":28,"value":770},{"title":8,"searchDepth":61,"depth":61,"links":9332},[],"content:guides:node:superagent:convert-html-to-pdf-from-raw-html.md","guides/node/superagent/convert-html-to-pdf-from-raw-html.md",{"_path":9336,"_dir":8709,"_draft":7,"_partial":7,"_locale":8,"title":777,"description":9337,"language":11,"library":8711,"property":779,"output":14,"related":9338,"default":7,"body":9339,"_type":63,"_id":9379,"_source":65,"_file":9380,"_extension":67},"/guides/node/superagent/define-a-time-limit","Learn how to set a conversion time limit at PDFShift. This will allow you to define a maximum time for the conversion process to complete, and if the process takes longer than the defined time, the conversion will be aborted. This guides explains you how to achieve it using Node and the SuperAgent library.",[781],{"type":20,"children":9340,"toc":9377},[9341,9345,9349,9364,9373],{"type":23,"tag":24,"props":9342,"children":9343},{},[9344],{"type":28,"value":788},{"type":23,"tag":24,"props":9346,"children":9347},{},[9348],{"type":28,"value":793},{"type":23,"tag":24,"props":9350,"children":9351},{},[9352,9353,9358,9359,9363],{"type":28,"value":798},{"type":23,"tag":36,"props":9354,"children":9356},{"className":9355},[],[9357],{"type":28,"value":779},{"type":28,"value":805},{"type":23,"tag":199,"props":9360,"children":9361},{},[9362],{"type":28,"value":810},{"type":28,"value":812},{"type":23,"tag":44,"props":9365,"children":9368},{"className":9366,"code":9367,"language":49,"meta":8},[47],"const superagent = require('superagent');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    timeout: 10\n}\n\nlet response = await superagent\n    .post('https://api.pdfshift.io/v3/convert/pdf')\n    .set('X-API-Key', api_key)\n    .send(params);\n\nfs.writeFileSync('result.pdf', response.body);\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[9369],{"type":23,"tag":36,"props":9370,"children":9371},{"__ignoreMap":8},[9372],{"type":28,"value":9367},{"type":23,"tag":24,"props":9374,"children":9375},{},[9376],{"type":28,"value":826},{"title":8,"searchDepth":61,"depth":61,"links":9378},[],"content:guides:node:superagent:define-a-time-limit.md","guides/node/superagent/define-a-time-limit.md",{"_path":9382,"_dir":8709,"_draft":7,"_partial":7,"_locale":8,"title":833,"description":9383,"language":11,"library":8711,"property":835,"output":14,"default":7,"body":9384,"_type":63,"_id":9461,"_source":65,"_file":9462,"_extension":67},"/guides/node/superagent/exporting-only-a-specific-set-of-pages","Learn how to export only a specific set of pages from a document using Node and the SuperAgent library. This guide offers detailed steps with code samples in Node and the SuperAgent library, highlighting how you can export only a specific set of pages from a document using PDFShift's API.",{"type":20,"children":9385,"toc":9459},[9386,9391,9401,9405,9409,9442,9446,9450],{"type":23,"tag":24,"props":9387,"children":9388},{},[9389],{"type":28,"value":9390},"In this guide, we'll show you how to export only a specific set of pages from a document using Node and the SuperAgent library to convert them to PDF using PDFShift's API.",{"type":23,"tag":24,"props":9392,"children":9393},{},[9394,9395,9400],{"type":28,"value":847},{"type":23,"tag":36,"props":9396,"children":9398},{"className":9397},[],[9399],{"type":28,"value":835},{"type":28,"value":42},{"type":23,"tag":24,"props":9402,"children":9403},{},[9404],{"type":28,"value":858},{"type":23,"tag":24,"props":9406,"children":9407},{},[9408],{"type":28,"value":863},{"type":23,"tag":126,"props":9410,"children":9411},{},[9412,9422,9432],{"type":23,"tag":130,"props":9413,"children":9414},{},[9415,9416,9421],{"type":28,"value":871},{"type":23,"tag":36,"props":9417,"children":9419},{"className":9418},[],[9420],{"type":28,"value":877},{"type":28,"value":879},{"type":23,"tag":130,"props":9423,"children":9424},{},[9425,9426,9431],{"type":28,"value":884},{"type":23,"tag":36,"props":9427,"children":9429},{"className":9428},[],[9430],{"type":28,"value":890},{"type":28,"value":892},{"type":23,"tag":130,"props":9433,"children":9434},{},[9435,9436,9441],{"type":28,"value":897},{"type":23,"tag":36,"props":9437,"children":9439},{"className":9438},[],[9440],{"type":28,"value":903},{"type":28,"value":905},{"type":23,"tag":24,"props":9443,"children":9444},{},[9445],{"type":28,"value":910},{"type":23,"tag":24,"props":9447,"children":9448},{},[9449],{"type":28,"value":210},{"type":23,"tag":44,"props":9451,"children":9454},{"className":9452,"code":9453,"language":49,"meta":8},[47],"const superagent = require('superagent');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://en.wikipedia.org/wiki/PDF',\n    pages: '2-4'\n}\n\nlet response = await superagent\n    .post('https://api.pdfshift.io/v3/convert/pdf')\n    .set('X-API-Key', api_key)\n    .send(params);\n\nfs.writeFileSync('result.pdf', response.body);\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[9455],{"type":23,"tag":36,"props":9456,"children":9457},{"__ignoreMap":8},[9458],{"type":28,"value":9453},{"title":8,"searchDepth":61,"depth":61,"links":9460},[],"content:guides:node:superagent:exporting-only-a-specific-set-of-pages.md","guides/node/superagent/exporting-only-a-specific-set-of-pages.md",{"_path":9464,"_dir":8709,"_draft":7,"_partial":7,"_locale":8,"title":930,"description":9465,"language":11,"library":8711,"property":932,"output":14,"default":7,"body":9466,"_type":63,"_id":9569,"_source":65,"_file":9570,"_extension":67},"/guides/node/superagent/generate-a-document-with-full-height","Learn to generate full-height documents dynamically with our step-by-step guide. This will allow you to create documents with a dynamic height, based on the content of the document. This guide provides Node code samples using the SuperAgent library to help you generate full-height documents with PDFShift's API.",{"type":20,"children":9467,"toc":9567},[9468,9473,9489,9498,9502,9511,9527,9531,9539],{"type":23,"tag":24,"props":9469,"children":9470},{},[9471],{"type":28,"value":9472},"In this guide, we'll show you how to generate a document with full height dynamically using Node and the SuperAgent library to convert them to PDF using PDFShift's API.",{"type":23,"tag":24,"props":9474,"children":9475},{},[9476,9477,9482,9483,9488],{"type":28,"value":944},{"type":23,"tag":36,"props":9478,"children":9480},{"className":9479},[],[9481],{"type":28,"value":932},{"type":28,"value":951},{"type":23,"tag":36,"props":9484,"children":9486},{"className":9485},[],[9487],{"type":28,"value":957},{"type":28,"value":959},{"type":23,"tag":44,"props":9490,"children":9493},{"className":9491,"code":9492,"language":49,"meta":8},[47],"const superagent = require('superagent');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    format: '1280xauto'\n}\n\nlet response = await superagent\n    .post('https://api.pdfshift.io/v3/convert/pdf')\n    .set('X-API-Key', api_key)\n    .send(params);\n\nfs.writeFileSync('result.pdf', response.body);\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[9494],{"type":23,"tag":36,"props":9495,"children":9496},{"__ignoreMap":8},[9497],{"type":28,"value":9492},{"type":23,"tag":24,"props":9499,"children":9500},{},[9501],{"type":28,"value":973},{"type":23,"tag":24,"props":9503,"children":9504},{},[9505,9506],{"type":28,"value":978},{"type":23,"tag":36,"props":9507,"children":9509},{"className":9508},[],[9510],{"type":28,"value":984},{"type":23,"tag":24,"props":9512,"children":9513},{},[9514,9515,9520,9521,9526],{"type":28,"value":989},{"type":23,"tag":36,"props":9516,"children":9518},{"className":9517},[],[9519],{"type":28,"value":995},{"type":28,"value":725},{"type":23,"tag":36,"props":9522,"children":9524},{"className":9523},[],[9525],{"type":28,"value":149},{"type":28,"value":1003},{"type":23,"tag":24,"props":9528,"children":9529},{},[9530],{"type":28,"value":1008},{"type":23,"tag":44,"props":9532,"children":9534},{"className":9533,"code":1012,"language":574,"meta":8},[573],[9535],{"type":23,"tag":36,"props":9536,"children":9537},{"__ignoreMap":8},[9538],{"type":28,"value":1012},{"type":23,"tag":24,"props":9540,"children":9541},{},[9542,9543,9548,9549,9554,9555,9560,9561,9566],{"type":28,"value":1022},{"type":23,"tag":36,"props":9544,"children":9546},{"className":9545},[],[9547],{"type":28,"value":957},{"type":28,"value":1029},{"type":23,"tag":36,"props":9550,"children":9552},{"className":9551},[],[9553],{"type":28,"value":1035},{"type":28,"value":1037},{"type":23,"tag":36,"props":9556,"children":9558},{"className":9557},[],[9559],{"type":28,"value":1043},{"type":28,"value":1045},{"type":23,"tag":36,"props":9562,"children":9564},{"className":9563},[],[9565],{"type":28,"value":1051},{"type":28,"value":1053},{"title":8,"searchDepth":61,"depth":61,"links":9568},[],"content:guides:node:superagent:generate-a-document-with-full-height.md","guides/node/superagent/generate-a-document-with-full-height.md",{"_path":9572,"_dir":8709,"_draft":7,"_partial":7,"_locale":8,"title":1060,"description":9573,"language":11,"library":8711,"property":1062,"output":14,"related":9574,"default":7,"body":9575,"_type":63,"_id":9606,"_source":65,"_file":9607,"_extension":67},"/guides/node/superagent/loading-css-from-a-string","Follow this guide to load custom CSS as a given string when converting an HTML document to PDF with PDFShift's API. This guide provides Node code samples with the SuperAgent library.",[1064,75,76,77],{"type":20,"children":9576,"toc":9604},[9577,9581,9585,9594],{"type":23,"tag":24,"props":9578,"children":9579},{},[9580],{"type":28,"value":1071},{"type":23,"tag":24,"props":9582,"children":9583},{},[9584],{"type":28,"value":1076},{"type":23,"tag":44,"props":9586,"children":9589},{"className":9587,"code":9588,"language":49,"meta":8},[47],"const superagent = require('superagent');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    css: 'body { background-color: #f00; }'\n}\n\nlet response = await superagent\n    .post('https://api.pdfshift.io/v3/convert/pdf')\n    .set('X-API-Key', api_key)\n    .send(params);\n\nfs.writeFileSync('result.pdf', response.body);\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[9590],{"type":23,"tag":36,"props":9591,"children":9592},{"__ignoreMap":8},[9593],{"type":28,"value":9588},{"type":23,"tag":24,"props":9595,"children":9596},{},[9597,9598,9603],{"type":28,"value":117},{"type":23,"tag":36,"props":9599,"children":9601},{"className":9600},[],[9602],{"type":28,"value":1062},{"type":28,"value":1096},{"title":8,"searchDepth":61,"depth":61,"links":9605},[],"content:guides:node:superagent:loading-css-from-a-string.md","guides/node/superagent/loading-css-from-a-string.md",{"_path":9609,"_dir":8709,"_draft":7,"_partial":7,"_locale":8,"title":1103,"description":9610,"language":11,"library":8711,"property":1062,"output":14,"related":9611,"default":7,"body":9612,"_type":63,"_id":9647,"_source":65,"_file":9648,"_extension":67},"/guides/node/superagent/loading-css-from-a-url","This guides shows you how to add a custom CSS from an URL onto your document to customize the output of your generated PDF. Follow this guides to learn how to do it using Node and the SuperAgent library and see how it can quickly be implemented using the PDFShift's API.",[1064,74,76,77],{"type":20,"children":9613,"toc":9645},[9614,9618,9622,9626,9635],{"type":23,"tag":24,"props":9615,"children":9616},{},[9617],{"type":28,"value":1112},{"type":23,"tag":24,"props":9619,"children":9620},{},[9621],{"type":28,"value":1076},{"type":23,"tag":24,"props":9623,"children":9624},{},[9625],{"type":28,"value":1121},{"type":23,"tag":44,"props":9627,"children":9630},{"className":9628,"code":9629,"language":49,"meta":8},[47],"const superagent = require('superagent');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    css: \"https://www.example.com/public/style/print.css\"\n}\n\nlet response = await superagent\n    .post('https://api.pdfshift.io/v3/convert/pdf')\n    .set('X-API-Key', api_key)\n    .send(params);\n\nfs.writeFileSync('result.pdf', response.body);\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[9631],{"type":23,"tag":36,"props":9632,"children":9633},{"__ignoreMap":8},[9634],{"type":28,"value":9629},{"type":23,"tag":24,"props":9636,"children":9637},{},[9638,9639,9644],{"type":28,"value":117},{"type":23,"tag":36,"props":9640,"children":9642},{"className":9641},[],[9643],{"type":28,"value":1062},{"type":28,"value":1096},{"title":8,"searchDepth":61,"depth":61,"links":9646},[],"content:guides:node:superagent:loading-css-from-a-url.md","guides/node/superagent/loading-css-from-a-url.md",{"_path":9650,"_dir":8709,"_draft":7,"_partial":7,"_locale":8,"title":1147,"description":9651,"language":11,"library":8711,"property":49,"output":14,"related":9652,"default":7,"body":9653,"_type":63,"_id":9684,"_source":65,"_file":9685,"_extension":67},"/guides/node/superagent/loading-javascript-from-a-string","Follow this guide to learn how to add custom javascript to your page to customize the output of your generated PDF. This allows you to modify elements on the page, add or remove content, etc. This guide uses Node and the SuperAgent library and relies on the PDFShift's API.",[1064,74,75,77],{"type":20,"children":9654,"toc":9682},[9655,9659,9663,9672],{"type":23,"tag":24,"props":9656,"children":9657},{},[9658],{"type":28,"value":1156},{"type":23,"tag":24,"props":9660,"children":9661},{},[9662],{"type":28,"value":1161},{"type":23,"tag":44,"props":9664,"children":9667},{"className":9665,"code":9666,"language":49,"meta":8},[47],"const superagent = require('superagent');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    javascript: 'document.querySelector(\"h1\").style.color = \"red\";'\n}\n\nlet response = await superagent\n    .post('https://api.pdfshift.io/v3/convert/pdf')\n    .set('X-API-Key', api_key)\n    .send(params);\n\nfs.writeFileSync('result.pdf', response.body);\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[9668],{"type":23,"tag":36,"props":9669,"children":9670},{"__ignoreMap":8},[9671],{"type":28,"value":9666},{"type":23,"tag":24,"props":9673,"children":9674},{},[9675,9676,9681],{"type":28,"value":117},{"type":23,"tag":36,"props":9677,"children":9679},{"className":9678},[],[9680],{"type":28,"value":49},{"type":28,"value":1181},{"title":8,"searchDepth":61,"depth":61,"links":9683},[],"content:guides:node:superagent:loading-javascript-from-a-string.md","guides/node/superagent/loading-javascript-from-a-string.md",{"_path":9687,"_dir":8709,"_draft":7,"_partial":7,"_locale":8,"title":1188,"description":9688,"language":11,"library":8711,"property":49,"output":14,"related":9689,"default":7,"body":9690,"_type":63,"_id":9725,"_source":65,"_file":9726,"_extension":67},"/guides/node/superagent/loading-javascript-from-a-url","Follow this guide to add custom javascript to your page before converting it to PDF. Using a URL allows you to later be able to change the content of the javascript without having to update the query made to PDFShift. Learn how you can implement this using Node and the SuperAgent library to call the PDFShift's API.",[1064,74,75,76],{"type":20,"children":9691,"toc":9723},[9692,9696,9700,9704,9713],{"type":23,"tag":24,"props":9693,"children":9694},{},[9695],{"type":28,"value":1197},{"type":23,"tag":24,"props":9697,"children":9698},{},[9699],{"type":28,"value":1202},{"type":23,"tag":24,"props":9701,"children":9702},{},[9703],{"type":28,"value":1207},{"type":23,"tag":44,"props":9705,"children":9708},{"className":9706,"code":9707,"language":49,"meta":8},[47],"const superagent = require('superagent');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    javascript: 'https://www.example.com/custom.js'\n}\n\nlet response = await superagent\n    .post('https://api.pdfshift.io/v3/convert/pdf')\n    .set('X-API-Key', api_key)\n    .send(params);\n\nfs.writeFileSync('result.pdf', response.body);\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[9709],{"type":23,"tag":36,"props":9710,"children":9711},{"__ignoreMap":8},[9712],{"type":28,"value":9707},{"type":23,"tag":24,"props":9714,"children":9715},{},[9716,9717,9722],{"type":28,"value":117},{"type":23,"tag":36,"props":9718,"children":9720},{"className":9719},[],[9721],{"type":28,"value":49},{"type":28,"value":1227},{"title":8,"searchDepth":61,"depth":61,"links":9724},[],"content:guides:node:superagent:loading-javascript-from-a-url.md","guides/node/superagent/loading-javascript-from-a-url.md",{"_path":9728,"_dir":8709,"_draft":7,"_partial":7,"_locale":8,"title":1234,"description":9729,"language":11,"library":8711,"property":1236,"output":14,"related":9730,"default":7,"body":9731,"_type":63,"_id":9870,"_source":65,"_file":9871,"_extension":67},"/guides/node/superagent/protecting-the-generated-pdf","Learn how to protect your generated PDF with encryption for owner and user, and for choosing who can modify, print and/or copy the generated PDF. This guides explains you to do it using Node and the SuperAgent library and relies on the PDFShift's API.",[317,479],{"type":20,"children":9732,"toc":9868},[9733,9738,9742,9752,9756,9765,9775,9785,9860],{"type":23,"tag":24,"props":9734,"children":9735},{},[9736],{"type":28,"value":9737},"In this guide, we'll show you how you can protect your generated PDF with encryption for owner and user, and for choosing who can modify, print and/or copy the generated PDF. This guides explains you to do it using Node and the SuperAgent library and relies on the PDFShift's API.",{"type":23,"tag":24,"props":9739,"children":9740},{},[9741],{"type":28,"value":1249},{"type":23,"tag":24,"props":9743,"children":9744},{},[9745,9746,9751],{"type":28,"value":1254},{"type":23,"tag":36,"props":9747,"children":9749},{"className":9748},[],[9750],{"type":28,"value":1236},{"type":28,"value":1261},{"type":23,"tag":24,"props":9753,"children":9754},{},[9755],{"type":28,"value":1266},{"type":23,"tag":44,"props":9757,"children":9760},{"className":9758,"code":9759,"language":49,"meta":8},[47],"const superagent = require('superagent');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    protection: {\n        owner_password: 'owner_password',\n        user_password: 'user_password',\n        no_print: True,\n        no_modify: True\n    }\n}\n\nlet response = await superagent\n    .post('https://api.pdfshift.io/v3/convert/pdf')\n    .set('X-API-Key', api_key)\n    .send(params);\n\nfs.writeFileSync('result.pdf', response.body);\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[9761],{"type":23,"tag":36,"props":9762,"children":9763},{"__ignoreMap":8},[9764],{"type":28,"value":9759},{"type":23,"tag":24,"props":9766,"children":9767},{},[9768,9769,9774],{"type":28,"value":1280},{"type":23,"tag":36,"props":9770,"children":9772},{"className":9771},[],[9773],{"type":28,"value":1236},{"type":28,"value":1287},{"type":23,"tag":24,"props":9776,"children":9777},{},[9778,9779,9784],{"type":28,"value":117},{"type":23,"tag":36,"props":9780,"children":9782},{"className":9781},[],[9783],{"type":28,"value":1236},{"type":28,"value":1298},{"type":23,"tag":126,"props":9786,"children":9787},{},[9788,9797,9806,9815,9830,9845],{"type":23,"tag":130,"props":9789,"children":9790},{},[9791,9796],{"type":23,"tag":36,"props":9792,"children":9794},{"className":9793},[],[9795],{"type":28,"value":1310},{"type":28,"value":1312},{"type":23,"tag":130,"props":9798,"children":9799},{},[9800,9805],{"type":23,"tag":36,"props":9801,"children":9803},{"className":9802},[],[9804],{"type":28,"value":1321},{"type":28,"value":1323},{"type":23,"tag":130,"props":9807,"children":9808},{},[9809,9814],{"type":23,"tag":36,"props":9810,"children":9812},{"className":9811},[],[9813],{"type":28,"value":1332},{"type":28,"value":1334},{"type":23,"tag":130,"props":9816,"children":9817},{},[9818,9823,9824,9829],{"type":23,"tag":36,"props":9819,"children":9821},{"className":9820},[],[9822],{"type":28,"value":1343},{"type":28,"value":1345},{"type":23,"tag":36,"props":9825,"children":9827},{"className":9826},[],[9828],{"type":28,"value":615},{"type":28,"value":1352},{"type":23,"tag":130,"props":9831,"children":9832},{},[9833,9838,9839,9844],{"type":23,"tag":36,"props":9834,"children":9836},{"className":9835},[],[9837],{"type":28,"value":1361},{"type":28,"value":1345},{"type":23,"tag":36,"props":9840,"children":9842},{"className":9841},[],[9843],{"type":28,"value":615},{"type":28,"value":1369},{"type":23,"tag":130,"props":9846,"children":9847},{},[9848,9853,9854,9859],{"type":23,"tag":36,"props":9849,"children":9851},{"className":9850},[],[9852],{"type":28,"value":1378},{"type":28,"value":1345},{"type":23,"tag":36,"props":9855,"children":9857},{"className":9856},[],[9858],{"type":28,"value":615},{"type":28,"value":1386},{"type":23,"tag":24,"props":9861,"children":9862},{},[9863,9867],{"type":23,"tag":199,"props":9864,"children":9865},{},[9866],{"type":28,"value":1394},{"type":28,"value":1396},{"title":8,"searchDepth":61,"depth":61,"links":9869},[],"content:guides:node:superagent:protecting-the-generated-pdf.md","guides/node/superagent/protecting-the-generated-pdf.md",{"_path":9873,"_dir":8709,"_draft":7,"_partial":7,"_locale":8,"title":1403,"description":9874,"language":11,"library":8711,"property":1405,"output":14,"related":9875,"default":7,"body":9876,"_type":63,"_id":9953,"_source":65,"_file":9954,"_extension":67},"/guides/node/superagent/receive-a-webhook-event","Receive a notification via a POST request on your server once the conversion was done. This allows you to trigger a massive amount of conversion without having to wait on their results, and get notified once they are done. This guides will show you how to receive webhook events in Node and the SuperAgent library to call the PDFShift's API.",[1407,1408],{"type":20,"children":9877,"toc":9951},[9878,9882,9886,9890,9899,9903,9907,9911,9919,9923,9931,9935,9939,9947],{"type":23,"tag":24,"props":9879,"children":9880},{},[9881],{"type":28,"value":1415},{"type":23,"tag":24,"props":9883,"children":9884},{},[9885],{"type":28,"value":1420},{"type":23,"tag":24,"props":9887,"children":9888},{},[9889],{"type":28,"value":1266},{"type":23,"tag":44,"props":9891,"children":9894},{"className":9892,"code":9893,"language":49,"meta":8},[47],"const superagent = require('superagent');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    webhook: 'https://enyygzdj8jy9b.x.pipedream.net/'\n}\n\nlet response = await superagent\n    .post('https://api.pdfshift.io/v3/convert/pdf')\n    .set('X-API-Key', api_key)\n    .send(params);\n\nconsole.log('The PDF document was generated and you will receive an event on your webhook once it is done.');\n",[9895],{"type":23,"tag":36,"props":9896,"children":9897},{"__ignoreMap":8},[9898],{"type":28,"value":9893},{"type":23,"tag":24,"props":9900,"children":9901},{},[9902],{"type":28,"value":1438},{"type":23,"tag":24,"props":9904,"children":9905},{},[9906],{"type":28,"value":1443},{"type":23,"tag":24,"props":9908,"children":9909},{},[9910],{"type":28,"value":1448},{"type":23,"tag":44,"props":9912,"children":9914},{"className":9913,"code":1452,"language":574,"meta":8},[573],[9915],{"type":23,"tag":36,"props":9916,"children":9917},{"__ignoreMap":8},[9918],{"type":28,"value":1452},{"type":23,"tag":24,"props":9920,"children":9921},{},[9922],{"type":28,"value":1462},{"type":23,"tag":44,"props":9924,"children":9926},{"className":9925,"code":1466,"language":574,"meta":8},[573],[9927],{"type":23,"tag":36,"props":9928,"children":9929},{"__ignoreMap":8},[9930],{"type":28,"value":1466},{"type":23,"tag":24,"props":9932,"children":9933},{},[9934],{"type":28,"value":1476},{"type":23,"tag":24,"props":9936,"children":9937},{},[9938],{"type":28,"value":1481},{"type":23,"tag":44,"props":9940,"children":9942},{"className":9941,"code":8,"language":574,"meta":8},[573],[9943],{"type":23,"tag":36,"props":9944,"children":9945},{"__ignoreMap":8},[9946],{"type":28,"value":8},{"type":23,"tag":24,"props":9948,"children":9949},{},[9950],{"type":28,"value":1494},{"title":8,"searchDepth":61,"depth":61,"links":9952},[],"content:guides:node:superagent:receive-a-webhook-event.md","guides/node/superagent/receive-a-webhook-event.md",{"_path":9956,"_dir":8709,"_draft":7,"_partial":7,"_locale":8,"title":1501,"description":9957,"language":11,"library":8711,"property":1503,"output":14,"related":9958,"default":7,"body":9959,"_type":63,"_id":10029,"_source":65,"_file":10030,"_extension":67},"/guides/node/superagent/save-your-pdf-online-and-get-back-a-url","This guides shows you how can generate a PDF document from HTML and get back an URL instead of the raw PDF. This allows you to share the link directly to your users or redirect them to that page. Learn how you can achieve it using Node and the SuperAgent library to call PDFShift's API.",[1408,1505],{"type":20,"children":9960,"toc":10027},[9961,9965,9975,9984,9999,10003,10011,10019],{"type":23,"tag":24,"props":9962,"children":9963},{},[9964],{"type":28,"value":1512},{"type":23,"tag":24,"props":9966,"children":9967},{},[9968,9969,9974],{"type":28,"value":1517},{"type":23,"tag":36,"props":9970,"children":9972},{"className":9971},[],[9973],{"type":28,"value":1503},{"type":28,"value":1524},{"type":23,"tag":44,"props":9976,"children":9979},{"className":9977,"code":9978,"language":49,"meta":8},[47],"const superagent = require('superagent');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    filename: 'example.pdf'\n}\n\nlet response = await superagent\n    .post('https://api.pdfshift.io/v3/convert/pdf')\n    .set('X-API-Key', api_key)\n    .send(params);\n\nconsole.log('The PDF document was generated and is available online via the url in the response');\n",[9980],{"type":23,"tag":36,"props":9981,"children":9982},{"__ignoreMap":8},[9983],{"type":28,"value":9978},{"type":23,"tag":24,"props":9985,"children":9986},{},[9987,9988,9993,9994,9998],{"type":28,"value":1538},{"type":23,"tag":36,"props":9989,"children":9991},{"className":9990},[],[9992],{"type":28,"value":1503},{"type":28,"value":1545},{"type":23,"tag":199,"props":9995,"children":9996},{},[9997],{"type":28,"value":1550},{"type":28,"value":1552},{"type":23,"tag":24,"props":10000,"children":10001},{},[10002],{"type":28,"value":1557},{"type":23,"tag":44,"props":10004,"children":10006},{"className":10005,"code":1561,"language":574,"meta":8},[573],[10007],{"type":23,"tag":36,"props":10008,"children":10009},{"__ignoreMap":8},[10010],{"type":28,"value":1561},{"type":23,"tag":24,"props":10012,"children":10013},{},[10014,10018],{"type":23,"tag":199,"props":10015,"children":10016},{},[10017],{"type":28,"value":203},{"type":28,"value":1575},{"type":23,"tag":24,"props":10020,"children":10021},{},[10022,10026],{"type":23,"tag":199,"props":10023,"children":10024},{},[10025],{"type":28,"value":203},{"type":28,"value":1584},{"title":8,"searchDepth":61,"depth":61,"links":10028},[],"content:guides:node:superagent:save-your-pdf-online-and-get-back-a-url.md","guides/node/superagent/save-your-pdf-online-and-get-back-a-url.md",{"_path":10032,"_dir":8709,"_draft":7,"_partial":7,"_locale":8,"title":1591,"description":10033,"language":11,"library":8711,"property":1593,"output":14,"related":10034,"default":7,"body":10035,"_type":63,"_id":10122,"_source":65,"_file":10123,"_extension":67},"/guides/node/superagent/save-your-pdf-to-your-amazon-s3-bucket","This guides shows you how can generate a PDF document from HTML with PDFShift's API and save it to your own Amazon S3 bucket. This allows you to generate document and automate actions once the document has been created on your bucket. This guides explains you how to do it using Node and the SuperAgent library.",[1407,1505],{"type":20,"children":10036,"toc":10120},[10037,10041,10045,10049,10057,10067,10076,10086,10094,10098,10106,10110],{"type":23,"tag":24,"props":10038,"children":10039},{},[10040],{"type":28,"value":1601},{"type":23,"tag":24,"props":10042,"children":10043},{},[10044],{"type":28,"value":1606},{"type":23,"tag":24,"props":10046,"children":10047},{},[10048],{"type":28,"value":1611},{"type":23,"tag":44,"props":10050,"children":10052},{"className":10051,"code":1615,"language":574,"meta":8},[573],[10053],{"type":23,"tag":36,"props":10054,"children":10055},{"__ignoreMap":8},[10056],{"type":28,"value":1615},{"type":23,"tag":24,"props":10058,"children":10059},{},[10060,10061,10066],{"type":28,"value":1625},{"type":23,"tag":36,"props":10062,"children":10064},{"className":10063},[],[10065],{"type":28,"value":1593},{"type":28,"value":1632},{"type":23,"tag":44,"props":10068,"children":10071},{"className":10069,"code":10070,"language":49,"meta":8},[47],"const superagent = require('superagent');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    s3_destination: 's3://DOC-EXAMPLE-BUCKET/test/example.pdf'\n}\n\nlet response = await superagent\n    .post('https://api.pdfshift.io/v3/convert/pdf')\n    .set('X-API-Key', api_key)\n    .send(params);\n\nconsole.log('The PDF document was generated and saved to your S3 Bucket');\n",[10072],{"type":23,"tag":36,"props":10073,"children":10074},{"__ignoreMap":8},[10075],{"type":28,"value":10070},{"type":23,"tag":24,"props":10077,"children":10078},{},[10079,10080,10085],{"type":28,"value":1646},{"type":23,"tag":36,"props":10081,"children":10083},{"className":10082},[],[10084],{"type":28,"value":1593},{"type":28,"value":1653},{"type":23,"tag":44,"props":10087,"children":10089},{"className":10088,"code":1657,"language":574,"meta":8},[573],[10090],{"type":23,"tag":36,"props":10091,"children":10092},{"__ignoreMap":8},[10093],{"type":28,"value":1657},{"type":23,"tag":24,"props":10095,"children":10096},{},[10097],{"type":28,"value":1667},{"type":23,"tag":44,"props":10099,"children":10101},{"className":10100,"code":1671,"language":574,"meta":8},[573],[10102],{"type":23,"tag":36,"props":10103,"children":10104},{"__ignoreMap":8},[10105],{"type":28,"value":1671},{"type":23,"tag":24,"props":10107,"children":10108},{},[10109],{"type":28,"value":1681},{"type":23,"tag":24,"props":10111,"children":10112},{},[10113,10114,10119],{"type":28,"value":1686},{"type":23,"tag":36,"props":10115,"children":10117},{"className":10116},[],[10118],{"type":28,"value":1405},{"type":28,"value":1693},{"title":8,"searchDepth":61,"depth":61,"links":10121},[],"content:guides:node:superagent:save-your-pdf-to-your-amazon-s3-bucket.md","guides/node/superagent/save-your-pdf-to-your-amazon-s3-bucket.md",{"_path":10125,"_dir":8709,"_draft":7,"_partial":7,"_locale":8,"title":1700,"description":10126,"language":11,"library":8711,"property":1702,"output":14,"related":10127,"default":7,"body":10128,"_type":63,"_id":10153,"_source":65,"_file":10154,"_extension":67},"/guides/node/superagent/send-custom-http-headers","Learn how to add custom HTTP headers when requesting an URL to be converted in PDF with PDFShift's API. It allows you to add specific headers that your backend can check against to authenticate a query before converting it to PDF. This guide explains you how using Node and the SuperAgent library.",[17,1704],{"type":20,"children":10129,"toc":10151},[10130,10134,10138,10147],{"type":23,"tag":24,"props":10131,"children":10132},{},[10133],{"type":28,"value":1711},{"type":23,"tag":24,"props":10135,"children":10136},{},[10137],{"type":28,"value":1716},{"type":23,"tag":44,"props":10139,"children":10142},{"className":10140,"code":10141,"language":49,"meta":8},[47],"const superagent = require('superagent');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    http_headers: {\n        'x-custom-header': 'custom-value',\n        Authorization: 'Bearer {token}'  // This allows you to authenticate PDFShift to your service in a custom way\n    }\n}\n\nlet response = await superagent\n    .post('https://api.pdfshift.io/v3/convert/pdf')\n    .set('X-API-Key', api_key)\n    .send(params);\n\nfs.writeFileSync('result.pdf', response.body);\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[10143],{"type":23,"tag":36,"props":10144,"children":10145},{"__ignoreMap":8},[10146],{"type":28,"value":10141},{"type":23,"tag":24,"props":10148,"children":10149},{},[10150],{"type":28,"value":1730},{"title":8,"searchDepth":61,"depth":61,"links":10152},[],"content:guides:node:superagent:send-custom-http-headers.md","guides/node/superagent/send-custom-http-headers.md",{"_path":10156,"_dir":8709,"_draft":7,"_partial":7,"_locale":8,"title":1737,"description":10157,"language":11,"library":8711,"property":1739,"output":14,"related":10158,"default":7,"body":10159,"_type":63,"_id":10239,"_source":65,"_file":10240,"_extension":67},"/guides/node/superagent/using-cookies","Learn how to add custom Cookies when requesting an URL to be converted in PDF with PDFShift's API. It allows you to pursue an active session for instance, that will authenticate the request as a specific user before converting the page to PDF. This guide explains you how using Node and the SuperAgent library.",[16,1704],{"type":20,"children":10160,"toc":10237},[10161,10165,10175,10184,10194,10233],{"type":23,"tag":24,"props":10162,"children":10163},{},[10164],{"type":28,"value":1747},{"type":23,"tag":24,"props":10166,"children":10167},{},[10168,10169,10174],{"type":28,"value":1752},{"type":23,"tag":36,"props":10170,"children":10172},{"className":10171},[],[10173],{"type":28,"value":1739},{"type":28,"value":1759},{"type":23,"tag":44,"props":10176,"children":10179},{"className":10177,"code":10178,"language":49,"meta":8},[47],"const superagent = require('superagent');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    // The \"cookies\" parameter expects a list of dictionnary that contains the name and the value of the cookies\n    cookies: [\n        { name: 'PHPSESSID', value: 'el4ukv0kqbvoirg7nkp4dncpk3' }\n    ]\n}\n\nlet response = await superagent\n    .post('https://api.pdfshift.io/v3/convert/pdf')\n    .set('X-API-Key', api_key)\n    .send(params);\n\nfs.writeFileSync('result.pdf', response.body);\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[10180],{"type":23,"tag":36,"props":10181,"children":10182},{"__ignoreMap":8},[10183],{"type":28,"value":10178},{"type":23,"tag":24,"props":10185,"children":10186},{},[10187,10188,10193],{"type":28,"value":117},{"type":23,"tag":36,"props":10189,"children":10191},{"className":10190},[],[10192],{"type":28,"value":1739},{"type":28,"value":1779},{"type":23,"tag":126,"props":10195,"children":10196},{},[10197,10206,10215,10224],{"type":23,"tag":130,"props":10198,"children":10199},{},[10200,10205],{"type":23,"tag":36,"props":10201,"children":10203},{"className":10202},[],[10204],{"type":28,"value":1791},{"type":28,"value":1793},{"type":23,"tag":130,"props":10207,"children":10208},{},[10209,10214],{"type":23,"tag":36,"props":10210,"children":10212},{"className":10211},[],[10213],{"type":28,"value":1802},{"type":28,"value":1804},{"type":23,"tag":130,"props":10216,"children":10217},{},[10218,10223],{"type":23,"tag":36,"props":10219,"children":10221},{"className":10220},[],[10222],{"type":28,"value":1813},{"type":28,"value":1815},{"type":23,"tag":130,"props":10225,"children":10226},{},[10227,10232],{"type":23,"tag":36,"props":10228,"children":10230},{"className":10229},[],[10231],{"type":28,"value":1824},{"type":28,"value":1826},{"type":23,"tag":24,"props":10234,"children":10235},{},[10236],{"type":28,"value":1831},{"title":8,"searchDepth":61,"depth":61,"links":10238},[],"content:guides:node:superagent:using-cookies.md","guides/node/superagent/using-cookies.md",{"_path":10242,"_dir":8709,"_draft":7,"_partial":7,"_locale":8,"title":1838,"description":10243,"language":11,"library":8711,"property":1840,"output":14,"related":10244,"default":7,"body":10245,"_type":63,"_id":10381,"_source":65,"_file":10382,"_extension":67},"/guides/node/superagent/waiting-for-a-custom-element-to-be-ready","Learn how to set up a custom javascript function that will waits for a specific condition to become true before allowing the conversion to happen. This is very interesting for waiting on charts to be generated, or custom fonts to be loaded. With PDFShift's API, this can easily be done using Node and the SuperAgent library.",[1842,76],{"type":20,"children":10246,"toc":10379},[10247,10257,10267,10276,10286,10295,10299,10307,10335,10344,10348,10357],{"type":23,"tag":24,"props":10248,"children":10249},{},[10250,10251,10256],{"type":28,"value":117},{"type":23,"tag":36,"props":10252,"children":10254},{"className":10253},[],[10255],{"type":28,"value":1840},{"type":28,"value":1855},{"type":23,"tag":24,"props":10258,"children":10259},{},[10260,10261,10266],{"type":28,"value":1860},{"type":23,"tag":36,"props":10262,"children":10264},{"className":10263},[],[10265],{"type":28,"value":1840},{"type":28,"value":1867},{"type":23,"tag":24,"props":10268,"children":10269},{},[10270,10271,10275],{"type":28,"value":1872},{"type":23,"tag":106,"props":10272,"children":10273},{},[10274],{"type":28,"value":1877},{"type":28,"value":1879},{"type":23,"tag":24,"props":10277,"children":10278},{},[10279,10280,10285],{"type":28,"value":1884},{"type":23,"tag":36,"props":10281,"children":10283},{"className":10282},[],[10284],{"type":28,"value":1840},{"type":28,"value":1891},{"type":23,"tag":24,"props":10287,"children":10288},{},[10289,10290,10294],{"type":28,"value":1896},{"type":23,"tag":199,"props":10291,"children":10292},{},[10293],{"type":28,"value":1901},{"type":28,"value":183},{"type":23,"tag":24,"props":10296,"children":10297},{},[10298],{"type":28,"value":1907},{"type":23,"tag":44,"props":10300,"children":10302},{"className":10301,"code":1911,"language":49,"meta":8},[47],[10303],{"type":23,"tag":36,"props":10304,"children":10305},{"__ignoreMap":8},[10306],{"type":28,"value":1911},{"type":23,"tag":24,"props":10308,"children":10309},{},[10310,10311,10316,10317,10322,10323,10328,10329,10334],{"type":28,"value":1921},{"type":23,"tag":36,"props":10312,"children":10314},{"className":10313},[],[10315],{"type":28,"value":1840},{"type":28,"value":609},{"type":23,"tag":36,"props":10318,"children":10320},{"className":10319},[],[10321],{"type":28,"value":1933},{"type":28,"value":1935},{"type":23,"tag":36,"props":10324,"children":10326},{"className":10325},[],[10327],{"type":28,"value":1933},{"type":28,"value":1942},{"type":23,"tag":36,"props":10330,"children":10332},{"className":10331},[],[10333],{"type":28,"value":644},{"type":28,"value":1949},{"type":23,"tag":44,"props":10336,"children":10339},{"className":10337,"code":10338,"language":49,"meta":8},[47],"const superagent = require('superagent');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    wait_for: 'isPageReady'\n}\n\nlet response = await superagent\n    .post('https://api.pdfshift.io/v3/convert/pdf')\n    .set('X-API-Key', api_key)\n    .send(params);\n\nfs.writeFileSync('result.pdf', response.body);\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[10340],{"type":23,"tag":36,"props":10341,"children":10342},{"__ignoreMap":8},[10343],{"type":28,"value":10338},{"type":23,"tag":24,"props":10345,"children":10346},{},[10347],{"type":28,"value":1963},{"type":23,"tag":44,"props":10349,"children":10352},{"className":10350,"code":10351,"language":49,"meta":8},[47],"const superagent = require('superagent');\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    javascript: 'let isFontReady = false; document.fonts.ready.then(() => isFontReady = true); function isPageReady() { return isFontReady; }',\n    wait_for: 'isPageReady'\n}\n\nlet response = await superagent\n    .post('https://api.pdfshift.io/v3/convert/pdf')\n    .set('X-API-Key', api_key)\n    .send(params);\n\nfs.writeFileSync('result.pdf', response.body);\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[10353],{"type":23,"tag":36,"props":10354,"children":10355},{"__ignoreMap":8},[10356],{"type":28,"value":10351},{"type":23,"tag":24,"props":10358,"children":10359},{},[10360,10361,10366,10367,10372,10373,10378],{"type":28,"value":1977},{"type":23,"tag":36,"props":10362,"children":10364},{"className":10363},[],[10365],{"type":28,"value":644},{"type":28,"value":1984},{"type":23,"tag":36,"props":10368,"children":10370},{"className":10369},[],[10371],{"type":28,"value":1933},{"type":28,"value":1991},{"type":23,"tag":36,"props":10374,"children":10376},{"className":10375},[],[10377],{"type":28,"value":1933},{"type":28,"value":1998},{"title":8,"searchDepth":61,"depth":61,"links":10380},[],"content:guides:node:superagent:waiting-for-a-custom-element-to-be-ready.md","guides/node/superagent/waiting-for-a-custom-element-to-be-ready.md",{"_path":10384,"_dir":10385,"_draft":7,"_partial":7,"_locale":8,"title":9,"description":10386,"language":11,"library":10387,"property":13,"output":14,"related":10388,"default":7,"body":10389,"_type":63,"_id":10421,"_source":65,"_file":10422,"_extension":67},"/guides/node/unfetch/accessing-secured-pages","unfetch","Learn how to access secured pages using Node and the Unfetch library. This guide offers detailed steps with code samples in Node and the Unfetch library, highlighting how you can acces page protected by basic authentication to convert them to PDF using PDFShift's API.","Unfetch",[16,17],{"type":20,"children":10390,"toc":10419},[10391,10396,10406,10415],{"type":23,"tag":24,"props":10392,"children":10393},{},[10394],{"type":28,"value":10395},"In this guide, we'll show you how to access secured page (protected by basic authentication) using Node and the Unfetch library to convert them to PDF using PDFShift's API.",{"type":23,"tag":24,"props":10397,"children":10398},{},[10399,10400,10405],{"type":28,"value":34},{"type":23,"tag":36,"props":10401,"children":10403},{"className":10402},[],[10404],{"type":28,"value":13},{"type":28,"value":42},{"type":23,"tag":44,"props":10407,"children":10410},{"className":10408,"code":10409,"language":49,"meta":8},[47],"const fetch = require('unfetch')\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    // You can set a basic authentication by passing the \"auth\" property which contains a username and password\n    auth: {\n        username: 'user',\n        password: 'password'\n    }\n}\n\nconst response = await fetch('https://api.pdfshift.io/v3/convert/pdf', {\n    method: 'POST',\n    headers: {\n        'Content-Type': 'application/json',\n        'X-API-Key': api_key\n    },\n    body: JSON.stringify(params)\n})\n\n// Handle errors:\nif (!response.ok) {\n    throw new Error(`Request failed with status code ${response.status}: ${response.data}`);\n}\n\nfs.writeFileSync('result.pdf', await response.blob());\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[10411],{"type":23,"tag":36,"props":10412,"children":10413},{"__ignoreMap":8},[10414],{"type":28,"value":10409},{"type":23,"tag":24,"props":10416,"children":10417},{},[10418],{"type":28,"value":59},{"title":8,"searchDepth":61,"depth":61,"links":10420},[],"content:guides:node:unfetch:accessing-secured-pages.md","guides/node/unfetch/accessing-secured-pages.md",{"_path":10424,"_dir":10385,"_draft":7,"_partial":7,"_locale":8,"title":70,"description":10425,"language":11,"library":10387,"property":72,"output":14,"related":10426,"default":7,"body":10427,"_type":63,"_id":10614,"_source":65,"_file":10615,"_extension":67},"/guides/node/unfetch/adding-a-custom-header-or-footer","Discover how to add custom headers or footers to a PDF using Node and the Unfetch library. This in-depth guide includes Node codes that you can easily follow and quickly generate documents with PDFShift's API.",[74,75,76,77],{"type":20,"children":10428,"toc":10612},[10429,10434,10455,10465,10519,10527,10531,10540,10550,10554,10608],{"type":23,"tag":24,"props":10430,"children":10431},{},[10432],{"type":28,"value":10433},"In this guide, we'll show you how to add custom headers or footers to a PDF using Node and the Unfetch library.",{"type":23,"tag":24,"props":10435,"children":10436},{},[10437,10438,10443,10444,10449,10450,10454],{"type":28,"value":89},{"type":23,"tag":36,"props":10439,"children":10441},{"className":10440},[],[10442],{"type":28,"value":72},{"type":28,"value":96},{"type":23,"tag":36,"props":10445,"children":10447},{"className":10446},[],[10448],{"type":28,"value":102},{"type":28,"value":104},{"type":23,"tag":106,"props":10451,"children":10452},{},[10453],{"type":28,"value":110},{"type":28,"value":112},{"type":23,"tag":24,"props":10456,"children":10457},{},[10458,10459,10464],{"type":28,"value":117},{"type":23,"tag":36,"props":10460,"children":10462},{"className":10461},[],[10463],{"type":28,"value":72},{"type":28,"value":124},{"type":23,"tag":126,"props":10466,"children":10467},{},[10468,10477,10510],{"type":23,"tag":130,"props":10469,"children":10470},{},[10471,10476],{"type":23,"tag":36,"props":10472,"children":10474},{"className":10473},[],[10475],{"type":28,"value":138},{"type":28,"value":140},{"type":23,"tag":130,"props":10478,"children":10479},{},[10480,10485,10486,10491,10492,10497,10498,10503,10504,10509],{"type":23,"tag":36,"props":10481,"children":10483},{"className":10482},[],[10484],{"type":28,"value":149},{"type":28,"value":151},{"type":23,"tag":36,"props":10487,"children":10489},{"className":10488},[],[10490],{"type":28,"value":157},{"type":28,"value":159},{"type":23,"tag":36,"props":10493,"children":10495},{"className":10494},[],[10496],{"type":28,"value":165},{"type":28,"value":167},{"type":23,"tag":36,"props":10499,"children":10501},{"className":10500},[],[10502],{"type":28,"value":173},{"type":28,"value":175},{"type":23,"tag":36,"props":10505,"children":10507},{"className":10506},[],[10508],{"type":28,"value":181},{"type":28,"value":183},{"type":23,"tag":130,"props":10511,"children":10512},{},[10513,10518],{"type":23,"tag":36,"props":10514,"children":10516},{"className":10515},[],[10517],{"type":28,"value":192},{"type":28,"value":194},{"type":23,"tag":24,"props":10520,"children":10521},{},[10522,10526],{"type":23,"tag":199,"props":10523,"children":10524},{},[10525],{"type":28,"value":203},{"type":28,"value":205},{"type":23,"tag":24,"props":10528,"children":10529},{},[10530],{"type":28,"value":210},{"type":23,"tag":44,"props":10532,"children":10535},{"className":10533,"code":10534,"language":49,"meta":8},[47],"const fetch = require('unfetch')\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://en.wikipedia.org/wiki/PDF',\n    header: {\n        source: '\u003Cdiv>Page {{ page }} over a total of {{ total }}. Made on {{ date }}\u003C/div>',\n        height: 150,\n        start_at: 2\n    }\n}\n\nconst response = await fetch('https://api.pdfshift.io/v3/convert/pdf', {\n    method: 'POST',\n    headers: {\n        'Content-Type': 'application/json',\n        'X-API-Key': api_key\n    },\n    body: JSON.stringify(params)\n})\n\n// Handle errors:\nif (!response.ok) {\n    throw new Error(`Request failed with status code ${response.status}: ${response.data}`);\n}\n\nfs.writeFileSync('result.pdf', await response.blob());\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[10536],{"type":23,"tag":36,"props":10537,"children":10538},{"__ignoreMap":8},[10539],{"type":28,"value":10534},{"type":23,"tag":24,"props":10541,"children":10542},{},[10543,10544,10549],{"type":28,"value":117},{"type":23,"tag":36,"props":10545,"children":10547},{"className":10546},[],[10548],{"type":28,"value":138},{"type":28,"value":230},{"type":23,"tag":24,"props":10551,"children":10552},{},[10553],{"type":28,"value":235},{"type":23,"tag":126,"props":10555,"children":10556},{},[10557,10566,10575,10584,10593],{"type":23,"tag":130,"props":10558,"children":10559},{},[10560,10565],{"type":23,"tag":36,"props":10561,"children":10563},{"className":10562},[],[10564],{"type":28,"value":247},{"type":28,"value":249},{"type":23,"tag":130,"props":10567,"children":10568},{},[10569,10574],{"type":23,"tag":36,"props":10570,"children":10572},{"className":10571},[],[10573],{"type":28,"value":258},{"type":28,"value":260},{"type":23,"tag":130,"props":10576,"children":10577},{},[10578,10583],{"type":23,"tag":36,"props":10579,"children":10581},{"className":10580},[],[10582],{"type":28,"value":269},{"type":28,"value":271},{"type":23,"tag":130,"props":10585,"children":10586},{},[10587,10592],{"type":23,"tag":36,"props":10588,"children":10590},{"className":10589},[],[10591],{"type":28,"value":280},{"type":28,"value":282},{"type":23,"tag":130,"props":10594,"children":10595},{},[10596,10601,10602,10607],{"type":23,"tag":36,"props":10597,"children":10599},{"className":10598},[],[10600],{"type":28,"value":291},{"type":28,"value":293},{"type":23,"tag":36,"props":10603,"children":10605},{"className":10604},[],[10606],{"type":28,"value":299},{"type":28,"value":301},{"type":23,"tag":24,"props":10609,"children":10610},{},[10611],{"type":28,"value":306},{"title":8,"searchDepth":61,"depth":61,"links":10613},[],"content:guides:node:unfetch:adding-a-custom-header-or-footer.md","guides/node/unfetch/adding-a-custom-header-or-footer.md",{"_path":10617,"_dir":10385,"_draft":7,"_partial":7,"_locale":8,"title":313,"description":10618,"language":11,"library":10387,"property":315,"output":14,"related":10619,"default":7,"body":10620,"_type":63,"_id":10749,"_source":65,"_file":10750,"_extension":67},"/guides/node/unfetch/adding-a-text-watermark","Learn how to add text watermarks to your generated PDF document using Node and the Unfetch library. With this guide, you'll be able to add watermarks on top of your generated PDFs easily with a quick request to PDFShift's API.",[317,318],{"type":20,"children":10621,"toc":10747},[10622,10626,10636,10645,10649,10706,10710,10731,10735,10739],{"type":23,"tag":24,"props":10623,"children":10624},{},[10625],{"type":28,"value":325},{"type":23,"tag":24,"props":10627,"children":10628},{},[10629,10630,10635],{"type":28,"value":330},{"type":23,"tag":36,"props":10631,"children":10633},{"className":10632},[],[10634],{"type":28,"value":315},{"type":28,"value":337},{"type":23,"tag":44,"props":10637,"children":10640},{"className":10638,"code":10639,"language":49,"meta":8},[47],"const fetch = require('unfetch')\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    watermark: {\n        text: 'PROTECTED DOCUMENT',\n        offset_x: 'center',\n        offset_top: 'top'\n    }\n}\n\nconst response = await fetch('https://api.pdfshift.io/v3/convert/pdf', {\n    method: 'POST',\n    headers: {\n        'Content-Type': 'application/json',\n        'X-API-Key': api_key\n    },\n    body: JSON.stringify(params)\n})\n\n// Handle errors:\nif (!response.ok) {\n    throw new Error(`Request failed with status code ${response.status}: ${response.data}`);\n}\n\nfs.writeFileSync('result.pdf', await response.blob());\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[10641],{"type":23,"tag":36,"props":10642,"children":10643},{"__ignoreMap":8},[10644],{"type":28,"value":10639},{"type":23,"tag":24,"props":10646,"children":10647},{},[10648],{"type":28,"value":351},{"type":23,"tag":126,"props":10650,"children":10651},{},[10652,10661,10670,10679,10688,10697],{"type":23,"tag":130,"props":10653,"children":10654},{},[10655,10660],{"type":23,"tag":36,"props":10656,"children":10658},{"className":10657},[],[10659],{"type":28,"value":363},{"type":28,"value":365},{"type":23,"tag":130,"props":10662,"children":10663},{},[10664,10669],{"type":23,"tag":36,"props":10665,"children":10667},{"className":10666},[],[10668],{"type":28,"value":374},{"type":28,"value":376},{"type":23,"tag":130,"props":10671,"children":10672},{},[10673,10678],{"type":23,"tag":36,"props":10674,"children":10676},{"className":10675},[],[10677],{"type":28,"value":385},{"type":28,"value":387},{"type":23,"tag":130,"props":10680,"children":10681},{},[10682,10687],{"type":23,"tag":36,"props":10683,"children":10685},{"className":10684},[],[10686],{"type":28,"value":396},{"type":28,"value":398},{"type":23,"tag":130,"props":10689,"children":10690},{},[10691,10696],{"type":23,"tag":36,"props":10692,"children":10694},{"className":10693},[],[10695],{"type":28,"value":407},{"type":28,"value":409},{"type":23,"tag":130,"props":10698,"children":10699},{},[10700,10705],{"type":23,"tag":36,"props":10701,"children":10703},{"className":10702},[],[10704],{"type":28,"value":418},{"type":28,"value":420},{"type":23,"tag":24,"props":10707,"children":10708},{},[10709],{"type":28,"value":425},{"type":23,"tag":126,"props":10711,"children":10712},{},[10713,10722],{"type":23,"tag":130,"props":10714,"children":10715},{},[10716,10721],{"type":23,"tag":36,"props":10717,"children":10719},{"className":10718},[],[10720],{"type":28,"value":437},{"type":28,"value":439},{"type":23,"tag":130,"props":10723,"children":10724},{},[10725,10730],{"type":23,"tag":36,"props":10726,"children":10728},{"className":10727},[],[10729],{"type":28,"value":448},{"type":28,"value":450},{"type":23,"tag":24,"props":10732,"children":10733},{},[10734],{"type":28,"value":455},{"type":23,"tag":24,"props":10736,"children":10737},{},[10738],{"type":28,"value":460},{"type":23,"tag":44,"props":10740,"children":10742},{"className":10741,"code":464,"language":49,"meta":8},[47],[10743],{"type":23,"tag":36,"props":10744,"children":10745},{"__ignoreMap":8},[10746],{"type":28,"value":464},{"title":8,"searchDepth":61,"depth":61,"links":10748},[],"content:guides:node:unfetch:adding-a-text-watermark.md","guides/node/unfetch/adding-a-text-watermark.md",{"_path":10752,"_dir":10385,"_draft":7,"_partial":7,"_locale":8,"title":476,"description":10753,"language":11,"library":10387,"property":315,"output":14,"related":10754,"default":7,"body":10755,"_type":63,"_id":10848,"_source":65,"_file":10849,"_extension":67},"/guides/node/unfetch/adding-an-image-watermark","Discover how to effortlessly add image watermarks to PDFs using Node and the Unfetch library. Our guide shows you how to add images on top of your PDF to protect your document easily. This is easily done with a simple request to PDFShift's API.",[318,479],{"type":20,"children":10756,"toc":10846},[10757,10761,10771,10780,10784,10795,10805,10809,10830,10834,10838],{"type":23,"tag":24,"props":10758,"children":10759},{},[10760],{"type":28,"value":325},{"type":23,"tag":24,"props":10762,"children":10763},{},[10764,10765,10770],{"type":28,"value":330},{"type":23,"tag":36,"props":10766,"children":10768},{"className":10767},[],[10769],{"type":28,"value":315},{"type":28,"value":496},{"type":23,"tag":44,"props":10772,"children":10775},{"className":10773,"code":10774,"language":49,"meta":8},[47],"const fetch = require('unfetch')\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    watermark: {\n        image: 'https://placekitten.com/200/300',\n        offset_x: 'center',\n        offset_top: 'top'\n    }\n}\n\nconst response = await fetch('https://api.pdfshift.io/v3/convert/pdf', {\n    method: 'POST',\n    headers: {\n        'Content-Type': 'application/json',\n        'X-API-Key': api_key\n    },\n    body: JSON.stringify(params)\n})\n\n// Handle errors:\nif (!response.ok) {\n    throw new Error(`Request failed with status code ${response.status}: ${response.data}`);\n}\n\nfs.writeFileSync('result.pdf', await response.blob());\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[10776],{"type":23,"tag":36,"props":10777,"children":10778},{"__ignoreMap":8},[10779],{"type":28,"value":10774},{"type":23,"tag":24,"props":10781,"children":10782},{},[10783],{"type":28,"value":510},{"type":23,"tag":126,"props":10785,"children":10786},{},[10787,10791],{"type":23,"tag":130,"props":10788,"children":10789},{},[10790],{"type":28,"value":518},{"type":23,"tag":130,"props":10792,"children":10793},{},[10794],{"type":28,"value":523},{"type":23,"tag":24,"props":10796,"children":10797},{},[10798,10799,10804],{"type":28,"value":528},{"type":23,"tag":36,"props":10800,"children":10802},{"className":10801},[],[10803],{"type":28,"value":534},{"type":28,"value":536},{"type":23,"tag":24,"props":10806,"children":10807},{},[10808],{"type":28,"value":425},{"type":23,"tag":126,"props":10810,"children":10811},{},[10812,10821],{"type":23,"tag":130,"props":10813,"children":10814},{},[10815,10820],{"type":23,"tag":36,"props":10816,"children":10818},{"className":10817},[],[10819],{"type":28,"value":437},{"type":28,"value":439},{"type":23,"tag":130,"props":10822,"children":10823},{},[10824,10829],{"type":23,"tag":36,"props":10825,"children":10827},{"className":10826},[],[10828],{"type":28,"value":448},{"type":28,"value":450},{"type":23,"tag":24,"props":10831,"children":10832},{},[10833],{"type":28,"value":455},{"type":23,"tag":24,"props":10835,"children":10836},{},[10837],{"type":28,"value":460},{"type":23,"tag":44,"props":10839,"children":10841},{"className":10840,"code":464,"language":574,"meta":8},[573],[10842],{"type":23,"tag":36,"props":10843,"children":10844},{"__ignoreMap":8},[10845],{"type":28,"value":464},{"title":8,"searchDepth":61,"depth":61,"links":10847},[],"content:guides:node:unfetch:adding-an-image-watermark.md","guides/node/unfetch/adding-an-image-watermark.md",{"_path":10851,"_dir":10385,"_draft":7,"_partial":7,"_locale":8,"title":586,"description":10852,"language":11,"library":10387,"property":588,"output":14,"related":10853,"default":7,"body":10854,"_type":63,"_id":10903,"_source":65,"_file":10904,"_extension":67},"/guides/node/unfetch/avoid-conversion-on-error","Learn how to avoid the conversion on error when loading the document using Node and the Unfetch library and relies on the PDFShift's API.",[590],{"type":20,"children":10855,"toc":10901},[10856,10860,10876,10885],{"type":23,"tag":24,"props":10857,"children":10858},{},[10859],{"type":28,"value":597},{"type":23,"tag":24,"props":10861,"children":10862},{},[10863,10864,10869,10870,10875],{"type":28,"value":602},{"type":23,"tag":36,"props":10865,"children":10867},{"className":10866},[],[10868],{"type":28,"value":588},{"type":28,"value":609},{"type":23,"tag":36,"props":10871,"children":10873},{"className":10872},[],[10874],{"type":28,"value":615},{"type":28,"value":617},{"type":23,"tag":44,"props":10877,"children":10880},{"className":10878,"code":10879,"language":49,"meta":8},[47],"const fetch = require('unfetch')\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.httpstat.us/404',\n    raise_for_status: True\n}\n\nconst response = await fetch('https://api.pdfshift.io/v3/convert/pdf', {\n    method: 'POST',\n    headers: {\n        'Content-Type': 'application/json',\n        'X-API-Key': api_key\n    },\n    body: JSON.stringify(params)\n})\n\n// Handle errors:\nif (!response.ok) {\n    throw new Error(`Request failed with status code ${response.status}: ${response.data}`);\n}\n\nfs.writeFileSync('result.pdf', await response.blob());\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[10881],{"type":23,"tag":36,"props":10882,"children":10883},{"__ignoreMap":8},[10884],{"type":28,"value":10879},{"type":23,"tag":24,"props":10886,"children":10887},{},[10888,10889,10894,10895,10900],{"type":28,"value":631},{"type":23,"tag":36,"props":10890,"children":10892},{"className":10891},[],[10893],{"type":28,"value":588},{"type":28,"value":638},{"type":23,"tag":36,"props":10896,"children":10898},{"className":10897},[],[10899],{"type":28,"value":644},{"type":28,"value":646},{"title":8,"searchDepth":61,"depth":61,"links":10902},[],"content:guides:node:unfetch:avoid-conversion-on-error.md","guides/node/unfetch/avoid-conversion-on-error.md",{"_path":10906,"_dir":10385,"_draft":7,"_partial":7,"_locale":8,"title":653,"description":10907,"language":11,"library":10387,"property":138,"output":14,"related":10908,"default":7,"body":10909,"_type":63,"_id":10930,"_source":65,"_file":10931,"_extension":67},"/guides/node/unfetch/convert-html-to-pdf-from-a-url","Learn how to easily convert HTML documents to PDF from a URL using Node and the Unfetch library. This how-to guide offers clear Node code examples that show developers how to implement this using the PDFShift API.",[590,656],{"type":20,"children":10910,"toc":10928},[10911,10915,10924],{"type":23,"tag":24,"props":10912,"children":10913},{},[10914],{"type":28,"value":663},{"type":23,"tag":44,"props":10916,"children":10919},{"className":10917,"code":10918,"language":49,"meta":8},[47],"const fetch = require('unfetch')\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n}\n\nconst response = await fetch('https://api.pdfshift.io/v3/convert/pdf', {\n    method: 'POST',\n    headers: {\n        'Content-Type': 'application/json',\n        'X-API-Key': api_key\n    },\n    body: JSON.stringify(params)\n})\n\n// Handle errors:\nif (!response.ok) {\n    throw new Error(`Request failed with status code ${response.status}: ${response.data}`);\n}\n\nfs.writeFileSync('result.pdf', await response.blob());\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[10920],{"type":23,"tag":36,"props":10921,"children":10922},{"__ignoreMap":8},[10923],{"type":28,"value":10918},{"type":23,"tag":24,"props":10925,"children":10926},{},[10927],{"type":28,"value":677},{"title":8,"searchDepth":61,"depth":61,"links":10929},[],"content:guides:node:unfetch:convert-html-to-pdf-from-a-url.md","guides/node/unfetch/convert-html-to-pdf-from-a-url.md",{"_path":10933,"_dir":10385,"_draft":7,"_partial":7,"_locale":8,"title":684,"description":10934,"language":11,"library":10387,"output":14,"related":10935,"default":7,"body":10936,"_type":63,"_id":11009,"_source":65,"_file":11010,"_extension":67},"/guides/node/unfetch/convert-html-to-pdf-from-raw-html","Learn how to to convert raw HTML document to PDF using Node and the Unfetch library. Our guide will explain you how to quickly convert documents with PDFShift's API.",[687],{"type":20,"children":10937,"toc":11007},[10938,10943,10958,10974,10984,10988,10997],{"type":23,"tag":24,"props":10939,"children":10940},{},[10941],{"type":28,"value":10942},"In this guide, we'll show you how to convert an HTML document to PDF using Node and the Unfetch library.\nProviding the HTML document as raw as a lot of great advantages :",{"type":23,"tag":126,"props":10944,"children":10945},{},[10946,10950,10954],{"type":23,"tag":130,"props":10947,"children":10948},{},[10949],{"type":28,"value":702},{"type":23,"tag":130,"props":10951,"children":10952},{},[10953],{"type":28,"value":707},{"type":23,"tag":130,"props":10955,"children":10956},{},[10957],{"type":28,"value":712},{"type":23,"tag":24,"props":10959,"children":10960},{},[10961,10962,10967,10968,10973],{"type":28,"value":717},{"type":23,"tag":36,"props":10963,"children":10965},{"className":10964},[],[10966],{"type":28,"value":723},{"type":28,"value":725},{"type":23,"tag":36,"props":10969,"children":10971},{"className":10970},[],[10972],{"type":28,"value":731},{"type":28,"value":733},{"type":23,"tag":24,"props":10975,"children":10976},{},[10977,10978,10983],{"type":28,"value":738},{"type":23,"tag":36,"props":10979,"children":10981},{"className":10980},[],[10982],{"type":28,"value":138},{"type":28,"value":745},{"type":23,"tag":24,"props":10985,"children":10986},{},[10987],{"type":28,"value":210},{"type":23,"tag":44,"props":10989,"children":10992},{"className":10990,"code":10991,"language":49,"meta":8},[47],"const fetch = require('unfetch')\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: '\u003Chtml>\u003Cbody>\u003Ch1>This will be a PDF document\u003C/h1>\u003Cp>This will generate a basic PDF to show how you can add raw HTML\u003C/body>\u003C/html>',\n}\n\nconst response = await fetch('https://api.pdfshift.io/v3/convert/pdf', {\n    method: 'POST',\n    headers: {\n        'Content-Type': 'application/json',\n        'X-API-Key': api_key\n    },\n    body: JSON.stringify(params)\n})\n\n// Handle errors:\nif (!response.ok) {\n    throw new Error(`Request failed with status code ${response.status}: ${response.data}`);\n}\n\nfs.writeFileSync('result.pdf', await response.blob());\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[10993],{"type":23,"tag":36,"props":10994,"children":10995},{"__ignoreMap":8},[10996],{"type":28,"value":10991},{"type":23,"tag":24,"props":10998,"children":10999},{},[11000,11001,11006],{"type":28,"value":763},{"type":23,"tag":36,"props":11002,"children":11004},{"className":11003},[],[11005],{"type":28,"value":138},{"type":28,"value":770},{"title":8,"searchDepth":61,"depth":61,"links":11008},[],"content:guides:node:unfetch:convert-html-to-pdf-from-raw-html.md","guides/node/unfetch/convert-html-to-pdf-from-raw-html.md",{"_path":11012,"_dir":10385,"_draft":7,"_partial":7,"_locale":8,"title":777,"description":11013,"language":11,"library":10387,"property":779,"output":14,"related":11014,"default":7,"body":11015,"_type":63,"_id":11055,"_source":65,"_file":11056,"_extension":67},"/guides/node/unfetch/define-a-time-limit","Learn how to set a conversion time limit at PDFShift. This will allow you to define a maximum time for the conversion process to complete, and if the process takes longer than the defined time, the conversion will be aborted. This guides explains you how to achieve it using Node and the Unfetch library.",[781],{"type":20,"children":11016,"toc":11053},[11017,11021,11025,11040,11049],{"type":23,"tag":24,"props":11018,"children":11019},{},[11020],{"type":28,"value":788},{"type":23,"tag":24,"props":11022,"children":11023},{},[11024],{"type":28,"value":793},{"type":23,"tag":24,"props":11026,"children":11027},{},[11028,11029,11034,11035,11039],{"type":28,"value":798},{"type":23,"tag":36,"props":11030,"children":11032},{"className":11031},[],[11033],{"type":28,"value":779},{"type":28,"value":805},{"type":23,"tag":199,"props":11036,"children":11037},{},[11038],{"type":28,"value":810},{"type":28,"value":812},{"type":23,"tag":44,"props":11041,"children":11044},{"className":11042,"code":11043,"language":49,"meta":8},[47],"const fetch = require('unfetch')\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    timeout: 10\n}\n\nconst response = await fetch('https://api.pdfshift.io/v3/convert/pdf', {\n    method: 'POST',\n    headers: {\n        'Content-Type': 'application/json',\n        'X-API-Key': api_key\n    },\n    body: JSON.stringify(params)\n})\n\n// Handle errors:\nif (!response.ok) {\n    throw new Error(`Request failed with status code ${response.status}: ${response.data}`);\n}\n\nfs.writeFileSync('result.pdf', await response.blob());\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[11045],{"type":23,"tag":36,"props":11046,"children":11047},{"__ignoreMap":8},[11048],{"type":28,"value":11043},{"type":23,"tag":24,"props":11050,"children":11051},{},[11052],{"type":28,"value":826},{"title":8,"searchDepth":61,"depth":61,"links":11054},[],"content:guides:node:unfetch:define-a-time-limit.md","guides/node/unfetch/define-a-time-limit.md",{"_path":11058,"_dir":10385,"_draft":7,"_partial":7,"_locale":8,"title":833,"description":11059,"language":11,"library":10387,"property":835,"output":14,"default":7,"body":11060,"_type":63,"_id":11137,"_source":65,"_file":11138,"_extension":67},"/guides/node/unfetch/exporting-only-a-specific-set-of-pages","Learn how to export only a specific set of pages from a document using Node and the Unfetch library. This guide offers detailed steps with code samples in Node and the Unfetch library, highlighting how you can export only a specific set of pages from a document using PDFShift's API.",{"type":20,"children":11061,"toc":11135},[11062,11067,11077,11081,11085,11118,11122,11126],{"type":23,"tag":24,"props":11063,"children":11064},{},[11065],{"type":28,"value":11066},"In this guide, we'll show you how to export only a specific set of pages from a document using Node and the Unfetch library to convert them to PDF using PDFShift's API.",{"type":23,"tag":24,"props":11068,"children":11069},{},[11070,11071,11076],{"type":28,"value":847},{"type":23,"tag":36,"props":11072,"children":11074},{"className":11073},[],[11075],{"type":28,"value":835},{"type":28,"value":42},{"type":23,"tag":24,"props":11078,"children":11079},{},[11080],{"type":28,"value":858},{"type":23,"tag":24,"props":11082,"children":11083},{},[11084],{"type":28,"value":863},{"type":23,"tag":126,"props":11086,"children":11087},{},[11088,11098,11108],{"type":23,"tag":130,"props":11089,"children":11090},{},[11091,11092,11097],{"type":28,"value":871},{"type":23,"tag":36,"props":11093,"children":11095},{"className":11094},[],[11096],{"type":28,"value":877},{"type":28,"value":879},{"type":23,"tag":130,"props":11099,"children":11100},{},[11101,11102,11107],{"type":28,"value":884},{"type":23,"tag":36,"props":11103,"children":11105},{"className":11104},[],[11106],{"type":28,"value":890},{"type":28,"value":892},{"type":23,"tag":130,"props":11109,"children":11110},{},[11111,11112,11117],{"type":28,"value":897},{"type":23,"tag":36,"props":11113,"children":11115},{"className":11114},[],[11116],{"type":28,"value":903},{"type":28,"value":905},{"type":23,"tag":24,"props":11119,"children":11120},{},[11121],{"type":28,"value":910},{"type":23,"tag":24,"props":11123,"children":11124},{},[11125],{"type":28,"value":210},{"type":23,"tag":44,"props":11127,"children":11130},{"className":11128,"code":11129,"language":49,"meta":8},[47],"const fetch = require('unfetch')\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://en.wikipedia.org/wiki/PDF',\n    pages: '2-4'\n}\n\nconst response = await fetch('https://api.pdfshift.io/v3/convert/pdf', {\n    method: 'POST',\n    headers: {\n        'Content-Type': 'application/json',\n        'X-API-Key': api_key\n    },\n    body: JSON.stringify(params)\n})\n\n// Handle errors:\nif (!response.ok) {\n    throw new Error(`Request failed with status code ${response.status}: ${response.data}`);\n}\n\nfs.writeFileSync('result.pdf', await response.blob());\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[11131],{"type":23,"tag":36,"props":11132,"children":11133},{"__ignoreMap":8},[11134],{"type":28,"value":11129},{"title":8,"searchDepth":61,"depth":61,"links":11136},[],"content:guides:node:unfetch:exporting-only-a-specific-set-of-pages.md","guides/node/unfetch/exporting-only-a-specific-set-of-pages.md",{"_path":11140,"_dir":10385,"_draft":7,"_partial":7,"_locale":8,"title":930,"description":11141,"language":11,"library":10387,"property":932,"output":14,"default":7,"body":11142,"_type":63,"_id":11245,"_source":65,"_file":11246,"_extension":67},"/guides/node/unfetch/generate-a-document-with-full-height","Learn to generate full-height documents dynamically with our step-by-step guide. This will allow you to create documents with a dynamic height, based on the content of the document. This guide provides Node code samples using the Unfetch library to help you generate full-height documents with PDFShift's API.",{"type":20,"children":11143,"toc":11243},[11144,11149,11165,11174,11178,11187,11203,11207,11215],{"type":23,"tag":24,"props":11145,"children":11146},{},[11147],{"type":28,"value":11148},"In this guide, we'll show you how to generate a document with full height dynamically using Node and the Unfetch library to convert them to PDF using PDFShift's API.",{"type":23,"tag":24,"props":11150,"children":11151},{},[11152,11153,11158,11159,11164],{"type":28,"value":944},{"type":23,"tag":36,"props":11154,"children":11156},{"className":11155},[],[11157],{"type":28,"value":932},{"type":28,"value":951},{"type":23,"tag":36,"props":11160,"children":11162},{"className":11161},[],[11163],{"type":28,"value":957},{"type":28,"value":959},{"type":23,"tag":44,"props":11166,"children":11169},{"className":11167,"code":11168,"language":49,"meta":8},[47],"const fetch = require('unfetch')\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    format: '1280xauto'\n}\n\nconst response = await fetch('https://api.pdfshift.io/v3/convert/pdf', {\n    method: 'POST',\n    headers: {\n        'Content-Type': 'application/json',\n        'X-API-Key': api_key\n    },\n    body: JSON.stringify(params)\n})\n\n// Handle errors:\nif (!response.ok) {\n    throw new Error(`Request failed with status code ${response.status}: ${response.data}`);\n}\n\nfs.writeFileSync('result.pdf', await response.blob());\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[11170],{"type":23,"tag":36,"props":11171,"children":11172},{"__ignoreMap":8},[11173],{"type":28,"value":11168},{"type":23,"tag":24,"props":11175,"children":11176},{},[11177],{"type":28,"value":973},{"type":23,"tag":24,"props":11179,"children":11180},{},[11181,11182],{"type":28,"value":978},{"type":23,"tag":36,"props":11183,"children":11185},{"className":11184},[],[11186],{"type":28,"value":984},{"type":23,"tag":24,"props":11188,"children":11189},{},[11190,11191,11196,11197,11202],{"type":28,"value":989},{"type":23,"tag":36,"props":11192,"children":11194},{"className":11193},[],[11195],{"type":28,"value":995},{"type":28,"value":725},{"type":23,"tag":36,"props":11198,"children":11200},{"className":11199},[],[11201],{"type":28,"value":149},{"type":28,"value":1003},{"type":23,"tag":24,"props":11204,"children":11205},{},[11206],{"type":28,"value":1008},{"type":23,"tag":44,"props":11208,"children":11210},{"className":11209,"code":1012,"language":574,"meta":8},[573],[11211],{"type":23,"tag":36,"props":11212,"children":11213},{"__ignoreMap":8},[11214],{"type":28,"value":1012},{"type":23,"tag":24,"props":11216,"children":11217},{},[11218,11219,11224,11225,11230,11231,11236,11237,11242],{"type":28,"value":1022},{"type":23,"tag":36,"props":11220,"children":11222},{"className":11221},[],[11223],{"type":28,"value":957},{"type":28,"value":1029},{"type":23,"tag":36,"props":11226,"children":11228},{"className":11227},[],[11229],{"type":28,"value":1035},{"type":28,"value":1037},{"type":23,"tag":36,"props":11232,"children":11234},{"className":11233},[],[11235],{"type":28,"value":1043},{"type":28,"value":1045},{"type":23,"tag":36,"props":11238,"children":11240},{"className":11239},[],[11241],{"type":28,"value":1051},{"type":28,"value":1053},{"title":8,"searchDepth":61,"depth":61,"links":11244},[],"content:guides:node:unfetch:generate-a-document-with-full-height.md","guides/node/unfetch/generate-a-document-with-full-height.md",{"_path":11248,"_dir":10385,"_draft":7,"_partial":7,"_locale":8,"title":1060,"description":11249,"language":11,"library":10387,"property":1062,"output":14,"related":11250,"default":7,"body":11251,"_type":63,"_id":11282,"_source":65,"_file":11283,"_extension":67},"/guides/node/unfetch/loading-css-from-a-string","Follow this guide to load custom CSS as a given string when converting an HTML document to PDF with PDFShift's API. This guide provides Node code samples with the Unfetch library.",[1064,75,76,77],{"type":20,"children":11252,"toc":11280},[11253,11257,11261,11270],{"type":23,"tag":24,"props":11254,"children":11255},{},[11256],{"type":28,"value":1071},{"type":23,"tag":24,"props":11258,"children":11259},{},[11260],{"type":28,"value":1076},{"type":23,"tag":44,"props":11262,"children":11265},{"className":11263,"code":11264,"language":49,"meta":8},[47],"const fetch = require('unfetch')\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    css: 'body { background-color: #f00; }'\n}\n\nconst response = await fetch('https://api.pdfshift.io/v3/convert/pdf', {\n    method: 'POST',\n    headers: {\n        'Content-Type': 'application/json',\n        'X-API-Key': api_key\n    },\n    body: JSON.stringify(params)\n})\n\n// Handle errors:\nif (!response.ok) {\n    throw new Error(`Request failed with status code ${response.status}: ${response.data}`);\n}\n\nfs.writeFileSync('result.pdf', await response.blob());\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[11266],{"type":23,"tag":36,"props":11267,"children":11268},{"__ignoreMap":8},[11269],{"type":28,"value":11264},{"type":23,"tag":24,"props":11271,"children":11272},{},[11273,11274,11279],{"type":28,"value":117},{"type":23,"tag":36,"props":11275,"children":11277},{"className":11276},[],[11278],{"type":28,"value":1062},{"type":28,"value":1096},{"title":8,"searchDepth":61,"depth":61,"links":11281},[],"content:guides:node:unfetch:loading-css-from-a-string.md","guides/node/unfetch/loading-css-from-a-string.md",{"_path":11285,"_dir":10385,"_draft":7,"_partial":7,"_locale":8,"title":1103,"description":11286,"language":11,"library":10387,"property":1062,"output":14,"related":11287,"default":7,"body":11288,"_type":63,"_id":11323,"_source":65,"_file":11324,"_extension":67},"/guides/node/unfetch/loading-css-from-a-url","This guides shows you how to add a custom CSS from an URL onto your document to customize the output of your generated PDF. Follow this guides to learn how to do it using Node and the Unfetch library and see how it can quickly be implemented using the PDFShift's API.",[1064,74,76,77],{"type":20,"children":11289,"toc":11321},[11290,11294,11298,11302,11311],{"type":23,"tag":24,"props":11291,"children":11292},{},[11293],{"type":28,"value":1112},{"type":23,"tag":24,"props":11295,"children":11296},{},[11297],{"type":28,"value":1076},{"type":23,"tag":24,"props":11299,"children":11300},{},[11301],{"type":28,"value":1121},{"type":23,"tag":44,"props":11303,"children":11306},{"className":11304,"code":11305,"language":49,"meta":8},[47],"const fetch = require('unfetch')\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    css: \"https://www.example.com/public/style/print.css\"\n}\n\nconst response = await fetch('https://api.pdfshift.io/v3/convert/pdf', {\n    method: 'POST',\n    headers: {\n        'Content-Type': 'application/json',\n        'X-API-Key': api_key\n    },\n    body: JSON.stringify(params)\n})\n\n// Handle errors:\nif (!response.ok) {\n    throw new Error(`Request failed with status code ${response.status}: ${response.data}`);\n}\n\nfs.writeFileSync('result.pdf', await response.blob());\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[11307],{"type":23,"tag":36,"props":11308,"children":11309},{"__ignoreMap":8},[11310],{"type":28,"value":11305},{"type":23,"tag":24,"props":11312,"children":11313},{},[11314,11315,11320],{"type":28,"value":117},{"type":23,"tag":36,"props":11316,"children":11318},{"className":11317},[],[11319],{"type":28,"value":1062},{"type":28,"value":1096},{"title":8,"searchDepth":61,"depth":61,"links":11322},[],"content:guides:node:unfetch:loading-css-from-a-url.md","guides/node/unfetch/loading-css-from-a-url.md",{"_path":11326,"_dir":10385,"_draft":7,"_partial":7,"_locale":8,"title":1147,"description":11327,"language":11,"library":10387,"property":49,"output":14,"related":11328,"default":7,"body":11329,"_type":63,"_id":11360,"_source":65,"_file":11361,"_extension":67},"/guides/node/unfetch/loading-javascript-from-a-string","Follow this guide to learn how to add custom javascript to your page to customize the output of your generated PDF. This allows you to modify elements on the page, add or remove content, etc. This guide uses Node and the Unfetch library and relies on the PDFShift's API.",[1064,74,75,77],{"type":20,"children":11330,"toc":11358},[11331,11335,11339,11348],{"type":23,"tag":24,"props":11332,"children":11333},{},[11334],{"type":28,"value":1156},{"type":23,"tag":24,"props":11336,"children":11337},{},[11338],{"type":28,"value":1161},{"type":23,"tag":44,"props":11340,"children":11343},{"className":11341,"code":11342,"language":49,"meta":8},[47],"const fetch = require('unfetch')\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    javascript: 'document.querySelector(\"h1\").style.color = \"red\";'\n}\n\nconst response = await fetch('https://api.pdfshift.io/v3/convert/pdf', {\n    method: 'POST',\n    headers: {\n        'Content-Type': 'application/json',\n        'X-API-Key': api_key\n    },\n    body: JSON.stringify(params)\n})\n\n// Handle errors:\nif (!response.ok) {\n    throw new Error(`Request failed with status code ${response.status}: ${response.data}`);\n}\n\nfs.writeFileSync('result.pdf', await response.blob());\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[11344],{"type":23,"tag":36,"props":11345,"children":11346},{"__ignoreMap":8},[11347],{"type":28,"value":11342},{"type":23,"tag":24,"props":11349,"children":11350},{},[11351,11352,11357],{"type":28,"value":117},{"type":23,"tag":36,"props":11353,"children":11355},{"className":11354},[],[11356],{"type":28,"value":49},{"type":28,"value":1181},{"title":8,"searchDepth":61,"depth":61,"links":11359},[],"content:guides:node:unfetch:loading-javascript-from-a-string.md","guides/node/unfetch/loading-javascript-from-a-string.md",{"_path":11363,"_dir":10385,"_draft":7,"_partial":7,"_locale":8,"title":1188,"description":11364,"language":11,"library":10387,"property":49,"output":14,"related":11365,"default":7,"body":11366,"_type":63,"_id":11401,"_source":65,"_file":11402,"_extension":67},"/guides/node/unfetch/loading-javascript-from-a-url","Follow this guide to add custom javascript to your page before converting it to PDF. Using a URL allows you to later be able to change the content of the javascript without having to update the query made to PDFShift. Learn how you can implement this using Node and the Unfetch library to call the PDFShift's API.",[1064,74,75,76],{"type":20,"children":11367,"toc":11399},[11368,11372,11376,11380,11389],{"type":23,"tag":24,"props":11369,"children":11370},{},[11371],{"type":28,"value":1197},{"type":23,"tag":24,"props":11373,"children":11374},{},[11375],{"type":28,"value":1202},{"type":23,"tag":24,"props":11377,"children":11378},{},[11379],{"type":28,"value":1207},{"type":23,"tag":44,"props":11381,"children":11384},{"className":11382,"code":11383,"language":49,"meta":8},[47],"const fetch = require('unfetch')\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    javascript: 'https://www.example.com/custom.js'\n}\n\nconst response = await fetch('https://api.pdfshift.io/v3/convert/pdf', {\n    method: 'POST',\n    headers: {\n        'Content-Type': 'application/json',\n        'X-API-Key': api_key\n    },\n    body: JSON.stringify(params)\n})\n\n// Handle errors:\nif (!response.ok) {\n    throw new Error(`Request failed with status code ${response.status}: ${response.data}`);\n}\n\nfs.writeFileSync('result.pdf', await response.blob());\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[11385],{"type":23,"tag":36,"props":11386,"children":11387},{"__ignoreMap":8},[11388],{"type":28,"value":11383},{"type":23,"tag":24,"props":11390,"children":11391},{},[11392,11393,11398],{"type":28,"value":117},{"type":23,"tag":36,"props":11394,"children":11396},{"className":11395},[],[11397],{"type":28,"value":49},{"type":28,"value":1227},{"title":8,"searchDepth":61,"depth":61,"links":11400},[],"content:guides:node:unfetch:loading-javascript-from-a-url.md","guides/node/unfetch/loading-javascript-from-a-url.md",{"_path":11404,"_dir":10385,"_draft":7,"_partial":7,"_locale":8,"title":1234,"description":11405,"language":11,"library":10387,"property":1236,"output":14,"related":11406,"default":7,"body":11407,"_type":63,"_id":11546,"_source":65,"_file":11547,"_extension":67},"/guides/node/unfetch/protecting-the-generated-pdf","Learn how to protect your generated PDF with encryption for owner and user, and for choosing who can modify, print and/or copy the generated PDF. This guides explains you to do it using Node and the Unfetch library and relies on the PDFShift's API.",[317,479],{"type":20,"children":11408,"toc":11544},[11409,11414,11418,11428,11432,11441,11451,11461,11536],{"type":23,"tag":24,"props":11410,"children":11411},{},[11412],{"type":28,"value":11413},"In this guide, we'll show you how you can protect your generated PDF with encryption for owner and user, and for choosing who can modify, print and/or copy the generated PDF. This guides explains you to do it using Node and the Unfetch library and relies on the PDFShift's API.",{"type":23,"tag":24,"props":11415,"children":11416},{},[11417],{"type":28,"value":1249},{"type":23,"tag":24,"props":11419,"children":11420},{},[11421,11422,11427],{"type":28,"value":1254},{"type":23,"tag":36,"props":11423,"children":11425},{"className":11424},[],[11426],{"type":28,"value":1236},{"type":28,"value":1261},{"type":23,"tag":24,"props":11429,"children":11430},{},[11431],{"type":28,"value":1266},{"type":23,"tag":44,"props":11433,"children":11436},{"className":11434,"code":11435,"language":49,"meta":8},[47],"const fetch = require('unfetch')\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    protection: {\n        owner_password: 'owner_password',\n        user_password: 'user_password',\n        no_print: True,\n        no_modify: True\n    }\n}\n\nconst response = await fetch('https://api.pdfshift.io/v3/convert/pdf', {\n    method: 'POST',\n    headers: {\n        'Content-Type': 'application/json',\n        'X-API-Key': api_key\n    },\n    body: JSON.stringify(params)\n})\n\n// Handle errors:\nif (!response.ok) {\n    throw new Error(`Request failed with status code ${response.status}: ${response.data}`);\n}\n\nfs.writeFileSync('result.pdf', await response.blob());\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[11437],{"type":23,"tag":36,"props":11438,"children":11439},{"__ignoreMap":8},[11440],{"type":28,"value":11435},{"type":23,"tag":24,"props":11442,"children":11443},{},[11444,11445,11450],{"type":28,"value":1280},{"type":23,"tag":36,"props":11446,"children":11448},{"className":11447},[],[11449],{"type":28,"value":1236},{"type":28,"value":1287},{"type":23,"tag":24,"props":11452,"children":11453},{},[11454,11455,11460],{"type":28,"value":117},{"type":23,"tag":36,"props":11456,"children":11458},{"className":11457},[],[11459],{"type":28,"value":1236},{"type":28,"value":1298},{"type":23,"tag":126,"props":11462,"children":11463},{},[11464,11473,11482,11491,11506,11521],{"type":23,"tag":130,"props":11465,"children":11466},{},[11467,11472],{"type":23,"tag":36,"props":11468,"children":11470},{"className":11469},[],[11471],{"type":28,"value":1310},{"type":28,"value":1312},{"type":23,"tag":130,"props":11474,"children":11475},{},[11476,11481],{"type":23,"tag":36,"props":11477,"children":11479},{"className":11478},[],[11480],{"type":28,"value":1321},{"type":28,"value":1323},{"type":23,"tag":130,"props":11483,"children":11484},{},[11485,11490],{"type":23,"tag":36,"props":11486,"children":11488},{"className":11487},[],[11489],{"type":28,"value":1332},{"type":28,"value":1334},{"type":23,"tag":130,"props":11492,"children":11493},{},[11494,11499,11500,11505],{"type":23,"tag":36,"props":11495,"children":11497},{"className":11496},[],[11498],{"type":28,"value":1343},{"type":28,"value":1345},{"type":23,"tag":36,"props":11501,"children":11503},{"className":11502},[],[11504],{"type":28,"value":615},{"type":28,"value":1352},{"type":23,"tag":130,"props":11507,"children":11508},{},[11509,11514,11515,11520],{"type":23,"tag":36,"props":11510,"children":11512},{"className":11511},[],[11513],{"type":28,"value":1361},{"type":28,"value":1345},{"type":23,"tag":36,"props":11516,"children":11518},{"className":11517},[],[11519],{"type":28,"value":615},{"type":28,"value":1369},{"type":23,"tag":130,"props":11522,"children":11523},{},[11524,11529,11530,11535],{"type":23,"tag":36,"props":11525,"children":11527},{"className":11526},[],[11528],{"type":28,"value":1378},{"type":28,"value":1345},{"type":23,"tag":36,"props":11531,"children":11533},{"className":11532},[],[11534],{"type":28,"value":615},{"type":28,"value":1386},{"type":23,"tag":24,"props":11537,"children":11538},{},[11539,11543],{"type":23,"tag":199,"props":11540,"children":11541},{},[11542],{"type":28,"value":1394},{"type":28,"value":1396},{"title":8,"searchDepth":61,"depth":61,"links":11545},[],"content:guides:node:unfetch:protecting-the-generated-pdf.md","guides/node/unfetch/protecting-the-generated-pdf.md",{"_path":11549,"_dir":10385,"_draft":7,"_partial":7,"_locale":8,"title":1403,"description":11550,"language":11,"library":10387,"property":1405,"output":14,"related":11551,"default":7,"body":11552,"_type":63,"_id":11629,"_source":65,"_file":11630,"_extension":67},"/guides/node/unfetch/receive-a-webhook-event","Receive a notification via a POST request on your server once the conversion was done. This allows you to trigger a massive amount of conversion without having to wait on their results, and get notified once they are done. This guides will show you how to receive webhook events in Node and the Unfetch library to call the PDFShift's API.",[1407,1408],{"type":20,"children":11553,"toc":11627},[11554,11558,11562,11566,11575,11579,11583,11587,11595,11599,11607,11611,11615,11623],{"type":23,"tag":24,"props":11555,"children":11556},{},[11557],{"type":28,"value":1415},{"type":23,"tag":24,"props":11559,"children":11560},{},[11561],{"type":28,"value":1420},{"type":23,"tag":24,"props":11563,"children":11564},{},[11565],{"type":28,"value":1266},{"type":23,"tag":44,"props":11567,"children":11570},{"className":11568,"code":11569,"language":49,"meta":8},[47],"const fetch = require('unfetch')\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    webhook: 'https://enyygzdj8jy9b.x.pipedream.net/'\n}\n\nconst response = await fetch('https://api.pdfshift.io/v3/convert/pdf', {\n    method: 'POST',\n    headers: {\n        'Content-Type': 'application/json',\n        'X-API-Key': api_key\n    },\n    body: JSON.stringify(params)\n})\n\n// Handle errors:\nif (!response.ok) {\n    throw new Error(`Request failed with status code ${response.status}: ${response.data}`);\n}\n\nconsole.log('The PDF document was generated and you will receive an event on your webhook once it is done.');\n",[11571],{"type":23,"tag":36,"props":11572,"children":11573},{"__ignoreMap":8},[11574],{"type":28,"value":11569},{"type":23,"tag":24,"props":11576,"children":11577},{},[11578],{"type":28,"value":1438},{"type":23,"tag":24,"props":11580,"children":11581},{},[11582],{"type":28,"value":1443},{"type":23,"tag":24,"props":11584,"children":11585},{},[11586],{"type":28,"value":1448},{"type":23,"tag":44,"props":11588,"children":11590},{"className":11589,"code":1452,"language":574,"meta":8},[573],[11591],{"type":23,"tag":36,"props":11592,"children":11593},{"__ignoreMap":8},[11594],{"type":28,"value":1452},{"type":23,"tag":24,"props":11596,"children":11597},{},[11598],{"type":28,"value":1462},{"type":23,"tag":44,"props":11600,"children":11602},{"className":11601,"code":1466,"language":574,"meta":8},[573],[11603],{"type":23,"tag":36,"props":11604,"children":11605},{"__ignoreMap":8},[11606],{"type":28,"value":1466},{"type":23,"tag":24,"props":11608,"children":11609},{},[11610],{"type":28,"value":1476},{"type":23,"tag":24,"props":11612,"children":11613},{},[11614],{"type":28,"value":1481},{"type":23,"tag":44,"props":11616,"children":11618},{"className":11617,"code":8,"language":574,"meta":8},[573],[11619],{"type":23,"tag":36,"props":11620,"children":11621},{"__ignoreMap":8},[11622],{"type":28,"value":8},{"type":23,"tag":24,"props":11624,"children":11625},{},[11626],{"type":28,"value":1494},{"title":8,"searchDepth":61,"depth":61,"links":11628},[],"content:guides:node:unfetch:receive-a-webhook-event.md","guides/node/unfetch/receive-a-webhook-event.md",{"_path":11632,"_dir":10385,"_draft":7,"_partial":7,"_locale":8,"title":1501,"description":11633,"language":11,"library":10387,"property":1503,"output":14,"related":11634,"default":7,"body":11635,"_type":63,"_id":11705,"_source":65,"_file":11706,"_extension":67},"/guides/node/unfetch/save-your-pdf-online-and-get-back-a-url","This guides shows you how can generate a PDF document from HTML and get back an URL instead of the raw PDF. This allows you to share the link directly to your users or redirect them to that page. Learn how you can achieve it using Node and the Unfetch library to call PDFShift's API.",[1408,1505],{"type":20,"children":11636,"toc":11703},[11637,11641,11651,11660,11675,11679,11687,11695],{"type":23,"tag":24,"props":11638,"children":11639},{},[11640],{"type":28,"value":1512},{"type":23,"tag":24,"props":11642,"children":11643},{},[11644,11645,11650],{"type":28,"value":1517},{"type":23,"tag":36,"props":11646,"children":11648},{"className":11647},[],[11649],{"type":28,"value":1503},{"type":28,"value":1524},{"type":23,"tag":44,"props":11652,"children":11655},{"className":11653,"code":11654,"language":49,"meta":8},[47],"const fetch = require('unfetch')\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    filename: 'example.pdf'\n}\n\nconst response = await fetch('https://api.pdfshift.io/v3/convert/pdf', {\n    method: 'POST',\n    headers: {\n        'Content-Type': 'application/json',\n        'X-API-Key': api_key\n    },\n    body: JSON.stringify(params)\n})\n\n// Handle errors:\nif (!response.ok) {\n    throw new Error(`Request failed with status code ${response.status}: ${response.data}`);\n}\n\nconsole.log('The PDF document was generated and is available online via the url in the response');\n",[11656],{"type":23,"tag":36,"props":11657,"children":11658},{"__ignoreMap":8},[11659],{"type":28,"value":11654},{"type":23,"tag":24,"props":11661,"children":11662},{},[11663,11664,11669,11670,11674],{"type":28,"value":1538},{"type":23,"tag":36,"props":11665,"children":11667},{"className":11666},[],[11668],{"type":28,"value":1503},{"type":28,"value":1545},{"type":23,"tag":199,"props":11671,"children":11672},{},[11673],{"type":28,"value":1550},{"type":28,"value":1552},{"type":23,"tag":24,"props":11676,"children":11677},{},[11678],{"type":28,"value":1557},{"type":23,"tag":44,"props":11680,"children":11682},{"className":11681,"code":1561,"language":574,"meta":8},[573],[11683],{"type":23,"tag":36,"props":11684,"children":11685},{"__ignoreMap":8},[11686],{"type":28,"value":1561},{"type":23,"tag":24,"props":11688,"children":11689},{},[11690,11694],{"type":23,"tag":199,"props":11691,"children":11692},{},[11693],{"type":28,"value":203},{"type":28,"value":1575},{"type":23,"tag":24,"props":11696,"children":11697},{},[11698,11702],{"type":23,"tag":199,"props":11699,"children":11700},{},[11701],{"type":28,"value":203},{"type":28,"value":1584},{"title":8,"searchDepth":61,"depth":61,"links":11704},[],"content:guides:node:unfetch:save-your-pdf-online-and-get-back-a-url.md","guides/node/unfetch/save-your-pdf-online-and-get-back-a-url.md",{"_path":11708,"_dir":10385,"_draft":7,"_partial":7,"_locale":8,"title":1591,"description":11709,"language":11,"library":10387,"property":1593,"output":14,"related":11710,"default":7,"body":11711,"_type":63,"_id":11798,"_source":65,"_file":11799,"_extension":67},"/guides/node/unfetch/save-your-pdf-to-your-amazon-s3-bucket","This guides shows you how can generate a PDF document from HTML with PDFShift's API and save it to your own Amazon S3 bucket. This allows you to generate document and automate actions once the document has been created on your bucket. This guides explains you how to do it using Node and the Unfetch library.",[1407,1505],{"type":20,"children":11712,"toc":11796},[11713,11717,11721,11725,11733,11743,11752,11762,11770,11774,11782,11786],{"type":23,"tag":24,"props":11714,"children":11715},{},[11716],{"type":28,"value":1601},{"type":23,"tag":24,"props":11718,"children":11719},{},[11720],{"type":28,"value":1606},{"type":23,"tag":24,"props":11722,"children":11723},{},[11724],{"type":28,"value":1611},{"type":23,"tag":44,"props":11726,"children":11728},{"className":11727,"code":1615,"language":574,"meta":8},[573],[11729],{"type":23,"tag":36,"props":11730,"children":11731},{"__ignoreMap":8},[11732],{"type":28,"value":1615},{"type":23,"tag":24,"props":11734,"children":11735},{},[11736,11737,11742],{"type":28,"value":1625},{"type":23,"tag":36,"props":11738,"children":11740},{"className":11739},[],[11741],{"type":28,"value":1593},{"type":28,"value":1632},{"type":23,"tag":44,"props":11744,"children":11747},{"className":11745,"code":11746,"language":49,"meta":8},[47],"const fetch = require('unfetch')\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    s3_destination: 's3://DOC-EXAMPLE-BUCKET/test/example.pdf'\n}\n\nconst response = await fetch('https://api.pdfshift.io/v3/convert/pdf', {\n    method: 'POST',\n    headers: {\n        'Content-Type': 'application/json',\n        'X-API-Key': api_key\n    },\n    body: JSON.stringify(params)\n})\n\n// Handle errors:\nif (!response.ok) {\n    throw new Error(`Request failed with status code ${response.status}: ${response.data}`);\n}\n\nconsole.log('The PDF document was generated and saved to your S3 Bucket');\n",[11748],{"type":23,"tag":36,"props":11749,"children":11750},{"__ignoreMap":8},[11751],{"type":28,"value":11746},{"type":23,"tag":24,"props":11753,"children":11754},{},[11755,11756,11761],{"type":28,"value":1646},{"type":23,"tag":36,"props":11757,"children":11759},{"className":11758},[],[11760],{"type":28,"value":1593},{"type":28,"value":1653},{"type":23,"tag":44,"props":11763,"children":11765},{"className":11764,"code":1657,"language":574,"meta":8},[573],[11766],{"type":23,"tag":36,"props":11767,"children":11768},{"__ignoreMap":8},[11769],{"type":28,"value":1657},{"type":23,"tag":24,"props":11771,"children":11772},{},[11773],{"type":28,"value":1667},{"type":23,"tag":44,"props":11775,"children":11777},{"className":11776,"code":1671,"language":574,"meta":8},[573],[11778],{"type":23,"tag":36,"props":11779,"children":11780},{"__ignoreMap":8},[11781],{"type":28,"value":1671},{"type":23,"tag":24,"props":11783,"children":11784},{},[11785],{"type":28,"value":1681},{"type":23,"tag":24,"props":11787,"children":11788},{},[11789,11790,11795],{"type":28,"value":1686},{"type":23,"tag":36,"props":11791,"children":11793},{"className":11792},[],[11794],{"type":28,"value":1405},{"type":28,"value":1693},{"title":8,"searchDepth":61,"depth":61,"links":11797},[],"content:guides:node:unfetch:save-your-pdf-to-your-amazon-s3-bucket.md","guides/node/unfetch/save-your-pdf-to-your-amazon-s3-bucket.md",{"_path":11801,"_dir":10385,"_draft":7,"_partial":7,"_locale":8,"title":1700,"description":11802,"language":11,"library":10387,"property":1702,"output":14,"related":11803,"default":7,"body":11804,"_type":63,"_id":11829,"_source":65,"_file":11830,"_extension":67},"/guides/node/unfetch/send-custom-http-headers","Learn how to add custom HTTP headers when requesting an URL to be converted in PDF with PDFShift's API. It allows you to add specific headers that your backend can check against to authenticate a query before converting it to PDF. This guide explains you how using Node and the Unfetch library.",[17,1704],{"type":20,"children":11805,"toc":11827},[11806,11810,11814,11823],{"type":23,"tag":24,"props":11807,"children":11808},{},[11809],{"type":28,"value":1711},{"type":23,"tag":24,"props":11811,"children":11812},{},[11813],{"type":28,"value":1716},{"type":23,"tag":44,"props":11815,"children":11818},{"className":11816,"code":11817,"language":49,"meta":8},[47],"const fetch = require('unfetch')\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    http_headers: {\n        'x-custom-header': 'custom-value',\n        Authorization: 'Bearer {token}'  // This allows you to authenticate PDFShift to your service in a custom way\n    }\n}\n\nconst response = await fetch('https://api.pdfshift.io/v3/convert/pdf', {\n    method: 'POST',\n    headers: {\n        'Content-Type': 'application/json',\n        'X-API-Key': api_key\n    },\n    body: JSON.stringify(params)\n})\n\n// Handle errors:\nif (!response.ok) {\n    throw new Error(`Request failed with status code ${response.status}: ${response.data}`);\n}\n\nfs.writeFileSync('result.pdf', await response.blob());\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[11819],{"type":23,"tag":36,"props":11820,"children":11821},{"__ignoreMap":8},[11822],{"type":28,"value":11817},{"type":23,"tag":24,"props":11824,"children":11825},{},[11826],{"type":28,"value":1730},{"title":8,"searchDepth":61,"depth":61,"links":11828},[],"content:guides:node:unfetch:send-custom-http-headers.md","guides/node/unfetch/send-custom-http-headers.md",{"_path":11832,"_dir":10385,"_draft":7,"_partial":7,"_locale":8,"title":1737,"description":11833,"language":11,"library":10387,"property":1739,"output":14,"related":11834,"default":7,"body":11835,"_type":63,"_id":11915,"_source":65,"_file":11916,"_extension":67},"/guides/node/unfetch/using-cookies","Learn how to add custom Cookies when requesting an URL to be converted in PDF with PDFShift's API. It allows you to pursue an active session for instance, that will authenticate the request as a specific user before converting the page to PDF. This guide explains you how using Node and the Unfetch library.",[16,1704],{"type":20,"children":11836,"toc":11913},[11837,11841,11851,11860,11870,11909],{"type":23,"tag":24,"props":11838,"children":11839},{},[11840],{"type":28,"value":1747},{"type":23,"tag":24,"props":11842,"children":11843},{},[11844,11845,11850],{"type":28,"value":1752},{"type":23,"tag":36,"props":11846,"children":11848},{"className":11847},[],[11849],{"type":28,"value":1739},{"type":28,"value":1759},{"type":23,"tag":44,"props":11852,"children":11855},{"className":11853,"code":11854,"language":49,"meta":8},[47],"const fetch = require('unfetch')\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    // The \"cookies\" parameter expects a list of dictionnary that contains the name and the value of the cookies\n    cookies: [\n        { name: 'PHPSESSID', value: 'el4ukv0kqbvoirg7nkp4dncpk3' }\n    ]\n}\n\nconst response = await fetch('https://api.pdfshift.io/v3/convert/pdf', {\n    method: 'POST',\n    headers: {\n        'Content-Type': 'application/json',\n        'X-API-Key': api_key\n    },\n    body: JSON.stringify(params)\n})\n\n// Handle errors:\nif (!response.ok) {\n    throw new Error(`Request failed with status code ${response.status}: ${response.data}`);\n}\n\nfs.writeFileSync('result.pdf', await response.blob());\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[11856],{"type":23,"tag":36,"props":11857,"children":11858},{"__ignoreMap":8},[11859],{"type":28,"value":11854},{"type":23,"tag":24,"props":11861,"children":11862},{},[11863,11864,11869],{"type":28,"value":117},{"type":23,"tag":36,"props":11865,"children":11867},{"className":11866},[],[11868],{"type":28,"value":1739},{"type":28,"value":1779},{"type":23,"tag":126,"props":11871,"children":11872},{},[11873,11882,11891,11900],{"type":23,"tag":130,"props":11874,"children":11875},{},[11876,11881],{"type":23,"tag":36,"props":11877,"children":11879},{"className":11878},[],[11880],{"type":28,"value":1791},{"type":28,"value":1793},{"type":23,"tag":130,"props":11883,"children":11884},{},[11885,11890],{"type":23,"tag":36,"props":11886,"children":11888},{"className":11887},[],[11889],{"type":28,"value":1802},{"type":28,"value":1804},{"type":23,"tag":130,"props":11892,"children":11893},{},[11894,11899],{"type":23,"tag":36,"props":11895,"children":11897},{"className":11896},[],[11898],{"type":28,"value":1813},{"type":28,"value":1815},{"type":23,"tag":130,"props":11901,"children":11902},{},[11903,11908],{"type":23,"tag":36,"props":11904,"children":11906},{"className":11905},[],[11907],{"type":28,"value":1824},{"type":28,"value":1826},{"type":23,"tag":24,"props":11910,"children":11911},{},[11912],{"type":28,"value":1831},{"title":8,"searchDepth":61,"depth":61,"links":11914},[],"content:guides:node:unfetch:using-cookies.md","guides/node/unfetch/using-cookies.md",{"_path":11918,"_dir":10385,"_draft":7,"_partial":7,"_locale":8,"title":1838,"description":11919,"language":11,"library":10387,"property":1840,"output":14,"related":11920,"default":7,"body":11921,"_type":63,"_id":12057,"_source":65,"_file":12058,"_extension":67},"/guides/node/unfetch/waiting-for-a-custom-element-to-be-ready","Learn how to set up a custom javascript function that will waits for a specific condition to become true before allowing the conversion to happen. This is very interesting for waiting on charts to be generated, or custom fonts to be loaded. With PDFShift's API, this can easily be done using Node and the Unfetch library.",[1842,76],{"type":20,"children":11922,"toc":12055},[11923,11933,11943,11952,11962,11971,11975,11983,12011,12020,12024,12033],{"type":23,"tag":24,"props":11924,"children":11925},{},[11926,11927,11932],{"type":28,"value":117},{"type":23,"tag":36,"props":11928,"children":11930},{"className":11929},[],[11931],{"type":28,"value":1840},{"type":28,"value":1855},{"type":23,"tag":24,"props":11934,"children":11935},{},[11936,11937,11942],{"type":28,"value":1860},{"type":23,"tag":36,"props":11938,"children":11940},{"className":11939},[],[11941],{"type":28,"value":1840},{"type":28,"value":1867},{"type":23,"tag":24,"props":11944,"children":11945},{},[11946,11947,11951],{"type":28,"value":1872},{"type":23,"tag":106,"props":11948,"children":11949},{},[11950],{"type":28,"value":1877},{"type":28,"value":1879},{"type":23,"tag":24,"props":11953,"children":11954},{},[11955,11956,11961],{"type":28,"value":1884},{"type":23,"tag":36,"props":11957,"children":11959},{"className":11958},[],[11960],{"type":28,"value":1840},{"type":28,"value":1891},{"type":23,"tag":24,"props":11963,"children":11964},{},[11965,11966,11970],{"type":28,"value":1896},{"type":23,"tag":199,"props":11967,"children":11968},{},[11969],{"type":28,"value":1901},{"type":28,"value":183},{"type":23,"tag":24,"props":11972,"children":11973},{},[11974],{"type":28,"value":1907},{"type":23,"tag":44,"props":11976,"children":11978},{"className":11977,"code":1911,"language":49,"meta":8},[47],[11979],{"type":23,"tag":36,"props":11980,"children":11981},{"__ignoreMap":8},[11982],{"type":28,"value":1911},{"type":23,"tag":24,"props":11984,"children":11985},{},[11986,11987,11992,11993,11998,11999,12004,12005,12010],{"type":28,"value":1921},{"type":23,"tag":36,"props":11988,"children":11990},{"className":11989},[],[11991],{"type":28,"value":1840},{"type":28,"value":609},{"type":23,"tag":36,"props":11994,"children":11996},{"className":11995},[],[11997],{"type":28,"value":1933},{"type":28,"value":1935},{"type":23,"tag":36,"props":12000,"children":12002},{"className":12001},[],[12003],{"type":28,"value":1933},{"type":28,"value":1942},{"type":23,"tag":36,"props":12006,"children":12008},{"className":12007},[],[12009],{"type":28,"value":644},{"type":28,"value":1949},{"type":23,"tag":44,"props":12012,"children":12015},{"className":12013,"code":12014,"language":49,"meta":8},[47],"const fetch = require('unfetch')\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    wait_for: 'isPageReady'\n}\n\nconst response = await fetch('https://api.pdfshift.io/v3/convert/pdf', {\n    method: 'POST',\n    headers: {\n        'Content-Type': 'application/json',\n        'X-API-Key': api_key\n    },\n    body: JSON.stringify(params)\n})\n\n// Handle errors:\nif (!response.ok) {\n    throw new Error(`Request failed with status code ${response.status}: ${response.data}`);\n}\n\nfs.writeFileSync('result.pdf', await response.blob());\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[12016],{"type":23,"tag":36,"props":12017,"children":12018},{"__ignoreMap":8},[12019],{"type":28,"value":12014},{"type":23,"tag":24,"props":12021,"children":12022},{},[12023],{"type":28,"value":1963},{"type":23,"tag":44,"props":12025,"children":12028},{"className":12026,"code":12027,"language":49,"meta":8},[47],"const fetch = require('unfetch')\nconst fs = require('fs');\n\n// You can get an API key at https://pdfshift.io\napi_key = 'sk_xxxxxxxxxxxx'\n\nparams = {\n    source: 'https://www.example.com',\n    javascript: 'let isFontReady = false; document.fonts.ready.then(() => isFontReady = true); function isPageReady() { return isFontReady; }',\n    wait_for: 'isPageReady'\n}\n\nconst response = await fetch('https://api.pdfshift.io/v3/convert/pdf', {\n    method: 'POST',\n    headers: {\n        'Content-Type': 'application/json',\n        'X-API-Key': api_key\n    },\n    body: JSON.stringify(params)\n})\n\n// Handle errors:\nif (!response.ok) {\n    throw new Error(`Request failed with status code ${response.status}: ${response.data}`);\n}\n\nfs.writeFileSync('result.pdf', await response.blob());\n\nconsole.log('The PDF document was generated and saved to result.pdf');\n",[12029],{"type":23,"tag":36,"props":12030,"children":12031},{"__ignoreMap":8},[12032],{"type":28,"value":12027},{"type":23,"tag":24,"props":12034,"children":12035},{},[12036,12037,12042,12043,12048,12049,12054],{"type":28,"value":1977},{"type":23,"tag":36,"props":12038,"children":12040},{"className":12039},[],[12041],{"type":28,"value":644},{"type":28,"value":1984},{"type":23,"tag":36,"props":12044,"children":12046},{"className":12045},[],[12047],{"type":28,"value":1933},{"type":28,"value":1991},{"type":23,"tag":36,"props":12050,"children":12052},{"className":12051},[],[12053],{"type":28,"value":1933},{"type":28,"value":1998},{"title":8,"searchDepth":61,"depth":61,"links":12056},[],"content:guides:node:unfetch:waiting-for-a-custom-element-to-be-ready.md","guides/node/unfetch/waiting-for-a-custom-element-to-be-ready.md",1785426825009]